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: R_386_RELATIVE question


Gregory Shtrasberg <shtras@gmail.com> writes:

> What I ment to say is if I want to reassemble the code in some way, the
> address of __dso_handle will change. Naturally, every other place that has
> address in the data section has a linker relocation on it, like R_386_32,
> which also tells me that the value is an address and needs to be altered. So
> that I can change the value according to new code order, e.g. 08 1c 00 00
> will become the new address of __dso_handle.
> But here the only relocation here unlike other places is R_386_RELATIVE,
> which, as you said does different thing.
> So, this looks to me as some sort of bug in gcc. Or am I missing something?

You are looking at a shared library, created using gcc -shared.  I can
tell because only shared libraries have R_386_RELATIVE relocations.  I'm
not sure what you mean by "reassemble", but it is certainly true that
you can not add new code to an existing shared library, any more than
you can add new code to an existing fully linked executable.  A shared
library essentially is an executable, just one that happens to be
position independent.

Let me know if that does not make sense.

Ian


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