This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

PING^N: [PATCH] Add --enable-static-pie to build static PIE [BZ #19574]


I'd like to get static PIE:

https://sourceware.org/ml/libc-alpha/2017-10/msg00587.html

Static PIE is simply an extension of ld.so.  The following changes are made
for static PIE:

1. Add a new function, _dl_relocate_static_pie, to:
   a. Get the run-time load address.
   b. Read the dynamic section.
   c. Perform dynamic relocations.
Dynamic linker also performs these steps.  But static PIE doesn't load
any shared objects.
2. Call _dl_relocate_static_pie at entrance of LIBC_START_MAIN in
libc.a.  crt1.o, which is used to create dynamic and non-PIE static
executables, is updated to include a dummy _dl_relocate_static_pie.
Pcrt1.o is added to create static PIE, which will link in the real
_dl_relocate_static_pie.  gPcrt1.o is also added to create static PIE
with -pg.

The main issues with static PIE are

1. Many binutils targets don't handle PIE properly.  I opened a few binutils
bugs for PIE.
2. Many assembly codes assumes PIC == SHARED. I opened a glibc bug for it.
3. Some dl-machine.h files may not handle undefined weak symbols in PIE
properly.   But we will never know for sure unless we build static PIE.

I'd like to add static PIE support into glibc 2.27, which works on
i686 and x86-64.
I will help other target developers get static PIE working for his/her target.

-- 
H.J.


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