From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12816 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: undefined reference to `raise' with musl static toolchain Date: Tue, 8 May 2018 12:34:23 -0400 Message-ID: <20180508163423.GM1392@brightrain.aerifal.cx> References: <20180508144417.216cefa5@windsurf.home> <20180508162226.GA30163@voyager> 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 1525797152 29625 195.159.176.226 (8 May 2018 16:32:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 16:32:32 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12832-gllmg-musl=m.gmane.org@lists.openwall.com Tue May 08 18:32:28 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 1fG5XP-0007cZ-V9 for gllmg-musl@m.gmane.org; Tue, 08 May 2018 18:32:28 +0200 Original-Received: (qmail 27649 invoked by uid 550); 8 May 2018 16:34:36 -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 26603 invoked from network); 8 May 2018 16:34:36 -0000 Content-Disposition: inline In-Reply-To: <20180508162226.GA30163@voyager> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12816 Archived-At: On Tue, May 08, 2018 at 06:22:27PM +0200, Markus Wichmann wrote: > On Tue, May 08, 2018 at 02:44:17PM +0200, Thomas Petazzoni wrote: > > /home/thomas/projets/buildroot/output/host/lib/gcc/arm-buildroot-linux-musleabihf/6.4.0/libgcc.a(_dvmd_lnx.o): In function `__aeabi_idiv0': > > /home/thomas/projets/buildroot/output/build/host-gcc-final-6.4.0/build/arm-buildroot-linux-musleabihf/libgcc/../../../libgcc/config/arm/lib1funcs.S:1354: undefined reference to `raise' > [...] > > > > Does that ring any bell ? > > > > It would appear that your version of libgcc references libc. Now, with > static linking, the libraries must appear in the correct order to > satisfy all dependencies, but here you have a circular dependency between > libgcc and libc. Since all gcc compiled code depends on libgcc, and libc > is compiled with gcc, there are only two ways to break the cycle: > > 1. Remove the dependency. No idea how, not unless you basically inline > raise() into __aeabi_idiv0(). > > 2. Add libc again after the command line. gcc already does this if you pass -static. I suspect the issue is that Thomas is using a toolchain where gcc doesn't know it's static-linking, and ld only static-links because there's no libc.so present. This setup is highly fragile and afaik it's not intended by the gcc developers to work. I don't know if there's anything like --enable-default-static for gcc but that would be the right solution for a static-only toolchain I think. Rich