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

--- Comment #9 from Romain Naour <romain.naour at gmail dot com> ---
(In reply to Eric Botcazou from comment #7)
> > The previous gcc command line was from the busybox build (without -fPIC) but
> > this is not busybox that crash... this is the libc.
> > 
> > See how the libc (uClibc) was built:
> > 
> > output/host/bin/sparc-buildroot-linux-uclibc-gcc -c libc/stdlib/atoll.c -o
> > libc/stdlib/atoll.os -Wall -Wstrict-prototypes -Wstrict-aliasing
> > -Wno-nonnull-compare -funsigned-char -fno-builtin -fcommon -fno-asm
> > -fmerge-all-constants -std=gnu99 -mcpu=v8 -fno-stack-protector -nostdinc
> > -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/sparc
> > -I./libc/sysdeps/linux -I./ldso/ldso/sparc -I./ldso/include -I. -Os
> > -fstrict-aliasing -D__USE_STDIO_FUTEXES__ -DHAVE_FORCED_UNWIND
> > -D_LIBC_REENTRANT -I./libpthread/nptl -I./libpthread/nptl
> > -I./libpthread/nptl/sysdeps/unix/sysv/linux/sparc
> > -I./libpthread/nptl/sysdeps/sparc -I./libpthread/nptl/sysdeps/sparc
> > -I./libpthread/nptl/sysdeps/unix/sysv/linux
> > -I./libpthread/nptl/sysdeps/unix/sysv/linux
> > -I./libpthread/nptl/sysdeps/pthread -I./libpthread/nptl/sysdeps/pthread/bits
> > -I./libpthread/nptl/sysdeps/generic -I./libc/sysdeps/linux/common -isystem
> > output/host/lib/gcc/sparc-buildroot-linux-uclibc/10.2.0/include-fixed
> > -isystem output/host/lib/gcc/sparc-buildroot-linux-uclibc/10.2.0/include
> > -Ioutput/build/linux-headers-5.4.88/usr/include/ -DNDEBUG -DIN_LIB=libc
> > -fPIC -MT libc/stdlib/atoll.os -MD -MP -MF libc/stdlib/.atoll.os.dep
> > 
> > Indeed we have "-fPIC"
> 
> OK, this makes sense now and this looks like a bootstrap problem, e.g. the
> code setting up _GLOBAL_OFFSET_TABLE_ in the libc might be trying to access
> it or something along this line.
> 
> Can you find out which module of uClibc sets up _GLOBAL_OFFSET_TABLE_ and
> confirm that it is compiled with -fPIC as well?  If so, would it be possible
> *not* to compile with -fPIC?

There is an option [1] to build all of uClibc as PIC objects but some other
part are build unconditionally as PIC objects. This option us always set in the
Buildroot's uClibc configuration. By disabling this option doesn't make any
diffrence. Removing -fPIC in Makefiles produce a non working libc.

[1]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/extra/Configs/Config.in?id=ab1dd83bec59c9e65c31efd6e887182948f627be#n296

Reply via email to