https://sourceware.org/bugzilla/show_bug.cgi?id=22221
--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> --- (In reply to Cary Coutant from comment #3) > I'm not sure I understand exactly what this option is for. If "-static -pie" > will produce a static-pie executable, wouldn't such an executable already > lack a dynamic linker? That's (part of) what -static does. The problem is that when both "-static -pie" are used -pie currently forces PT_INTERP to be set. Generally "-static -pie" could be thought of as a hardened -static. % cat aslr.c #include <stdio.h> static void foo() {} static int bar = 5; int main() { int baz = 5; printf("function: %p, library function: %p, data: %p, stack: %p\n", foo, &printf, &bar, &baz); } (gcc trunk supports -static-pie, glibc with PIE libc.a is needed) ~ % gcc -fuse-ld=bfd -static-pie -fPIE aslr.c ~ % file a.out a.out: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, for GNU/Linux 4.10.0, with debug_info, not stripped ~ % ldd ./a.out statically linked ~ % ./a.out function: 0x7f1c3fd130e5, library function: 0x7f1c3fd21b00, data: 0x7f1c3ffaf070, stack: 0x7ffeb1d24c0c ~ % ./a.out function: 0x7f137df070e5, library function: 0x7f137df15b00, data: 0x7f137e1a3070, stack: 0x7ffeeeb59eac > What does the option have to do with the PT_PHDR header and segment? From > the name & description, it sounds like it's intended to suppress the > PT_INTERP header. ld.bfd outputs no PT_PHDR header with -static-pie, so I just tried to copy its behavior. > If the option is also supposed to suppress the PT_PHDR header, shouldn't we > issue a warning or an error if this option is used and we see a PHDRS clause > in the linker script? Probably yes. But first we have to get the basic functionality working. (Also the labels for the output from comment 2 are wrong. They should be the other way round. ld.bfd output is ld.gold output and vice versa. Sorry.) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils