When building a file with -fPIE -pie and -Wl,--no-export-dynamic it still export dynamic symbols not exported for a "normal" executable. According to info ld this should normally not happen, but does not specify what is considered not normal. As this behavior actually breaks the testsuite for ld if you compile it with -fPIE -pie my question is if this is a bug that should be fixed or if this is considered expected.
Example below on how to reporoduce (have reproduced on a Fedora 13-system running ld 2.20.51.0.2, and on a Gentoo box running 2.20.1), the vers4.c file can be found in the testsuite as ld/testsuite/ld-elfvers/vers4.c: $ cat vers4.c /* * Testcase to make sure that a versioned symbol definition in an * application correctly defines the version node, if and only if * the actual symbol is exported. This is built both with and without * -export-dynamic. */ #include <stdio.h> extern int foo (); int bar() { return 3; } int new_foo() { return 1000+bar(); } __asm__(".symver new_foo,foo@@VERS_2.0"); int main() { printf("%d\n", foo()); return 0; } $ gcc -o test1 -Wl,--no-export-dynamic vers4.c $ gcc -o test2 -fPIE -pie -Wl,--no-export-dynamic vers4.c $ objdump -T test* test1: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 printf 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 __libc_start_main 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.4 __stack_chk_fail test2: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000270 l d .interp 0000000000000000 .interp 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 printf 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 w D *UND* 0000000000000000 _Jv_RegisterClasses 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 __libc_start_main 0000000000000000 w DF *UND* 0000000000000000 GLIBC_2.2.5 __cxa_finalize 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.4 __stack_chk_fail 00000000000008be g DF .text 000000000000003c VERS_2.0 foo 0000000000201020 g D *ABS* 0000000000000000 Base _end 0000000000201010 g D *ABS* 0000000000000000 Base _edata 0000000000000960 g DF .text 0000000000000088 Base __libc_csu_init 0000000000201010 g D *ABS* 0000000000000000 Base __bss_start 0000000000000000 g DO *ABS* 0000000000000000 VERS_2.0 VERS_2.0 00000000000008fa g DF .text 0000000000000054 Base main 0000000000000950 g DF .text 0000000000000002 Base __libc_csu_fini -- Summary: --no-export-dynamic broken for PIE? Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: xake at rymdraket dot net CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=11413 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils