[Bug target/64237] [5 Regression] glibc build failure

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 9 14:41:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64237

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Markus Trippelsdorf from comment #4)
> (In reply to H.J. Lu from comment #3)
> > (In reply to Markus Trippelsdorf from comment #0)
> > > trippels@gcc20 nscd % cat nscd.i
> > > extern int program_invocation_name;
> > > extern void fn2(int, int);
> > > void
> > > fn1() { fn2(0, program_invocation_name); }
> > > 
> > > trippels@gcc20 nscd % gcc -shared nscd.i -fpie
> > > /home/trippels/bin/ld: /home/trippels/tmp/ccoI5Lbg.o: relocation
> > > R_X86_64_PC32 against undefined symbol
> > > `program_invocation_name@@GLIBC_2.2.5' can not be used when making a shared
> > > object; recompile with -fPIC
> > > /home/trippels/bin/ld: final link failed: Bad value
> > > collect2: error: ld returned 1 exit status
> > 
> > If you use -fpie, you should use -pie.
> > If you use -shared, you should use -fpic.
> 
> -shared was used for demonstration purpose only.
> Same issue with -pie:
> 
>  % gcc -O2 -pie nscd.i -fPIE
> /usr/lib/x86_64-linux-gnu/Scrt1.o: In function `_start':
> (.text+0x20): undefined reference to `main'
> /home/trippels/bin/ld: /home/trippels/tmp/ccZF5sOU.o: relocation
> R_X86_64_PC32 against undefined symbol
> `program_invocation_name@@GLIBC_2.2.5' can not be used when making a shared
> object; recompile with -fPIC

Does -fuse-ld=gold work?



More information about the Gcc-bugs mailing list