This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: Section placement into C constants


Am 14.07.2010 17:54, schrieb Luke Trowbridge:
I would like to get a reference to the start of the GOT in my code. My attempt:

extern void __got_start__;
void * const pGot = (void * const)&__got_start__;

However, pGot is assigned zero (not the start of the GOT) even though the
linker map file shows that __got_start__ is assigned the correct value.

If this is even possible, what is the best way to accomplish this outside of
an executable statement?


I think you refer to linker symbols as

extern unsigned char __got_start__[];

Then you could do
void * const pGot = (void * const)__got_start__;

Best regards.


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