From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13226 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: undefined reference to __stack_chk_fail_local (x86) Date: Tue, 11 Sep 2018 15:07:50 +0200 Message-ID: <20180911130750.GP4418@port70.net> References: <20180911092726.28cb3d13@prometeo.example.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1536671164 14280 195.159.176.226 (11 Sep 2018 13:06:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2018 13:06:04 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) To: musl@lists.openwall.com Original-X-From: musl-return-13242-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 11 15:05:59 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fziMc-0003UH-AK for gllmg-musl@m.gmane.org; Tue, 11 Sep 2018 15:05:54 +0200 Original-Received: (qmail 7884 invoked by uid 550); 11 Sep 2018 13:08:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7809 invoked from network); 11 Sep 2018 13:08:02 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20180911092726.28cb3d13@prometeo.example.org> Xref: news.gmane.org gmane.linux.lib.musl.general:13226 Archived-At: * Matias Fonzo [2018-09-11 09:27:45 -0300]: > Bootstrapping Dragora (distro) reflects an error trying to build the > kernel headers using musl 1.1.20: > > Running build() ... > UPD include/generated/uapi/linux/version.h > HOSTCC scripts/basic/fixdep > /tmp/ccONBchp.o: In function `read_file': > fixdep.c:(.text+0x12a): undefined reference to `__stack_chk_fail_local' > /tmp/ccONBchp.o: In function `main': > fixdep.c:(.text.startup+0x6e2): undefined reference to > `__stack_chk_fail_local' /tools/lib32/gcc/i586-linux-musl/8.2.1/../../../../i586-linux-musl/bin/ld: > scripts/basic/fixdep: hidden symbol `__stack_chk_fail_local' isn't > defined /tools/lib32/gcc/i586-linux-musl/8.2.1/../../../../i586-linux-musl/bin/ld: > final link failed: Bad value collect2: error: ld returned 1 exit status > make[1]: *** [scripts/Makefile.host:90: scripts/basic/fixdep] Error 1 > make: *** [Makefile:464: scripts_basic] Error 2 Return status = 2 > this happens because on i386 and powerpc gcc emits _local_ calls to __stack_chk_fail_local which means it has to be defined within the same module that you are linking (not in libc.so). (that symbol should either call the extern __stack_chk_fail in libc.so or just crash) this should have been done by libgcc.a having a definition for this symbol (since the compiler is using it), but instead it got added to glibc libc_nonshared.a which is added to the link command by using a linker script in place of libc.so. musl does not want to copy that hack, so the usual workaround is to make gcc pass -lssp_nonshared to the linker when stack-protector is in use and then have a libssp_nonshared.a with the appropriate definition. (this is what alpine linux does) you can also do this manually or disable ssp with -fno-stack-protector, it may also work if a preincluded header declared it as weak so undefined weak reference would just become 0 (and crash at runtime which is the intended behaviour), but i havent tested that. > In this case, the build procedure occurs inside of a temporary system, > where the pieces are replaced one-by-one. I haven't touch the build > procedure in long time, under x86_64 works fine. I haven't see this > error before... > > The current toolchain is: binutils-2.30, GCC-8, musl 1.1.20+ (from > commit ("fix namespace violation for c11 mutex functions", patched using > the patches for the kernel UAPI 4.18). > > Anyone else have tried to compile the kernel headers for x86?. (for > i586, in this case).