berkus / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

Separate the GOTPLT setction from the GOT section in X86 Backend #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure why the GOTPLT section would be put into the GOT section in the 
initial design of X86 Backend, most cases seem to work so far though.

However, this design may run into problems (e.g., runtime segfault) as -z relro 
is given. And the cause is GOT will be put into PT_RELRO, but GOTPLT should 
only be put into PT_RELRO when giving "-z now" at the same time.

Original issue reported on code.google.com by pete.c...@gmail.com on 14 Jun 2012 at 2:15

GoogleCodeExporter commented 9 years ago
We put GOTPLT and GOT sections together for quick implementation. HJ and I 
realize that is a wrong design but works in Android system. In x86 Linux, the 
correct design should be as what you mentioned. We should separate GOTPLT 
section from the GOT section.

I remember current ELFDynamic section is ready for this separation.
ELFFileFormat, ELFExecFormat and ELFDynObjFormat should add support of GOTPLT 
section.
Then, create a new GOTPLT section and add it into segment.

Original comment by LubaTang on 14 Jun 2012 at 2:26

GoogleCodeExporter commented 9 years ago
I'll take care of this.

Original comment by mysekki on 14 Jun 2012 at 3:29

GoogleCodeExporter commented 9 years ago
done at Revision 8f3e5f3b7137. Now mclinker can successfully link itself on 
X86-32 without giving the option -z now but with -z relro.

Original comment by mysekki on 21 Jun 2012 at 2:38