Bug 13232

Summary: Regression: --gc-sections: local symbol `_dl_argv@@GLIBC_PRIVATE' in ld.so is referenced by DSO
Product: binutils Reporter: Jan Kratochvil <jan.kratochvil>
Component: ldAssignee: Not yet assigned to anyone <unassigned>
Severity: normal    
Priority: P2    
Version: 2.24   
Target Milestone: ---   
Host: Target: x86_64-fedora16-linux-gnu
Build: Last reconfirmed:
Bug Depends on: 13177    
Bug Blocks:    

Description Jan Kratochvil 2011-09-28 18:31:26 UTC
3475fe928892df696f6ea9b2c912e1379591e736 is the first bad commit

On Wed, 14 Sep 2011 21:14:38 +0200, H.J. Lu wrote:
> 2011-09-14  H.J. Lu  <hongjiu.lu@intel.com>
>       PR ld/13177
>       * elflink.c (elf_gc_sweep_symbol): Also hide symbols without PLT
>       nor GOT references.

echo 'int main(void){return 0;}'|gcc -o 1.o -c -Wall -x c -;gcc -v -o 1 1.o -Wall -Wl,--gc-sections

# OK but replace collect2 (old system BFD ld) with BFD HEAD ld:

.../ld/ld-new --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o 1 /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.1/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.6.1 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../.. 1.o --gc-sections -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.6.1/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crtn.o

ld-new: 1: local symbol `_dl_argv@@GLIBC_PRIVATE' in /lib64/ld-linux-x86-64.so.2 is referenced by DSO
ld-new: final link failed: Bad value

Tested on fedora-16-x86_64.  gold works OK.
Comment 1 H.J. Lu 2011-09-28 18:35:55 UTC

*** This bug has been marked as a duplicate of bug 13195 ***
Comment 2 Jackie Rosen 2014-02-16 17:45:43 UTC Comment hidden (spam)