This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PING: [PATCH] Add --enable-static-pie to build static PIE
On 2017.09.27 at 01:30 -0700, H.J. Lu wrote:
> No separate PIE copy of libc.a, is used for static PIE to minimize
> GCC driver change. To improve system security, glibc can be built with
> --enable-static-pie, and the same libc.a can be used to build both static
> executable and static PIE.
It doesn't work:
~ % echo "int main(){}" | gcc -x c - -static
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib64/libc.a(dl-support.o): In function `elf_machine_load_address':
/home/markus/glibc/elf/../sysdeps/x86_64/dl-machine.h:59: undefined reference to `_DYNAMIC'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib64/libc.a(dl-support.o): In function `elf_get_dynamic_info':
/home/markus/glibc/elf/get-dynamic-info.h:48: undefined reference to `_DYNAMIC'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: a.out: hidden symbol `_DYNAMIC' isn't defined
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
--
Markus