>>> Andrew Lewycky <[EMAIL PROTECTED]> 03/01/00 11:24AM >>>
> Jeremy White wrote:
> >
> > Question:
> > If I declare a variable as, say struct PE pe __attribute((section("hackpe")))
>= {};
> > that causes the variable 'pe' to be placed into the object section called 'hackpe'.
> > If I then modify the stock ldscript for elf/i386, and place a section handler
> > for hackpe prior to the handler for .text, I can then cause a .so file to be
> > created that has my variable 'pe' placed _prior_ to the text section of
> > the .so file.
> There may be another option: according to the GNU ld documentation,
> unless the
> SORT command is used in the ldscript (it is not, at least not to sort
> the text
> section), sections are built up in the order in which they are seen
> during the
> link. Therefore if you can put your variable into the .text section of a
> separate .o and arrange for it to be first on the linker command line,
> this
> should work. (Like all advice in usenet, the giver has never tried it :)
Good point. Unfortunately, I need to write into that variable, and the text
section is flagged as readonly.
Sadly, I misstated the problem and my hack doesn't even work.
I need the pe data space to be in *memory* prior to the text
section. Being in the file prior to the text section has no necessary
correlation to in memory relocation address. Hmm... gotta play
with ld a bit more.
Thanks,
Jeremy