This is the mail archive of the gcc@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]

Relocation of code with gcc


Hello,

I am currently trying to figure out how gcc handle full
relocatable code. What i would like to have is a code where
jump and subroutines call are relative, and where data access
is also relative.

But for the moment, if I request a code that is not relative,
I obtain a code where jump and call are relative, but where
data pages and access are "hardwired" at a fixed address (And
I have see that I am able to move this address using -Text option)

When I request a relocatable object, using -fPIC, I obtain a
code where every access (jump, call, data) use a pointer
indexed in a table (the GOT section of the ELF) and ... for
the moment, it's a bit fuzzy for me.

I remember, when I was programming on MS-DOS that program was
located in a segment, data after the code and that access was
relative to the current CS:IP. I just would like to reproduce
that, but using GCC, and using pages.

Using this feature, It would be possible to locate a code
anywhere in memory, without filling a GOT table and it would
behave always the same

Is that (or something similar) possible ?

Thank you!

Seb

PS: Just for info, I am using GCC for i386, but I think, any
flavor of GCC behave the same.

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)




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