This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Position independent CODE with position dependent DATA ?


> Implement a new loader option which would be specified to gcc as
> 
>     -Wl,-z,fixedGOT=0x4000
> 

At least some parts of a similar idea work already, just by assigning to
_GLOBAL_OFFSET_TABLE_ in a linker script:

	ld --other_flags_here --verbose  > my.lds

then edit my.lds to remove the header and trailer lines (marked with
"==========") and add the assignment (spaces matter):
----- my.lds
     . . .
_GLOBAL_OFFSET_TABLE_ = 0x4000 ;

SECTIONS
{
     . . .
-----

$ gcc -fPIC -o hello -Wl,--script=my.lds hello.c
$ nm hello | grep _GLOBAL_OFFSET_TABLE_
00004000 a _GLOBAL_OFFSET_TABLE_

-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]