From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2DC2B3959E5C; Tue, 26 Jan 2021 21:24:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DC2B3959E5C From: "romain.naour at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/98784] [8/9/10/11 Regression] problematic build of uClibc with -fPIC Date: Tue, 26 Jan 2021 21:24:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: romain.naour at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2021 21:24:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98784 --- Comment #9 from Romain Naour --- (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. > >=20 > > See how the libc (uClibc) was built: > >=20 > > 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=3Dgnu99 -mcpu=3Dv8 -fno-stack-protector -nos= tdinc > > -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 -isys= tem > > 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=3Dli= bc > > -fPIC -MT libc/stdlib/atoll.os -MD -MP -MF libc/stdlib/.atoll.os.dep > >=20 > > Indeed we have "-fPIC" >=20 > 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 acce= ss > it or something along this line. >=20 > 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 possi= ble > *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=3Dab1dd83bec59c9e65c31efd6e887182948f627be#n296=