Loading object files into executing programs

Bjorn Benson bjorn at dataio.UUCP
Tue Apr 9 09:02:57 AEST 1985


Request for help:

I have a program "PROG" and a number of subroutines "SUB1", "SUB2", etc.
that are all in seperate files (PROG is an executable, SUB? are .o files).
What I would like to do is have PROG read in any of the SUB? object files
and execute them.  There are three problems I see:
	(1)	Symbol resolution (dynamic linking)
	(2)	'Text' expansion (a la sbrk(2))
	(3)	How to read the linked file in and know its start address
Solutions:
	(1)	Use ld(1) with various flags
	(2)	*** This is where I need help ***
	(3)	*** I need help here to, but I would guess a read(2)? ***
The solution does not have to be portable, but it needs to work under 4.2bsd.

I have looked at the Franz Lisp source and it seems to read object files
into the 'data' segment (via sbrk(2)) and I don't even know if they are 
executable code or just data.  (My problem requires executable code.)

I appreciate the time anyone takes to help me...

				Thank you,
				  Bjorn Benson
				  ..!uw-beaver!entropy!dataio!bjorn



More information about the Comp.unix.wizards mailing list