From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12815 Path: news.gmane.org!.POSTED!not-for-mail From: Markus Wichmann Newsgroups: gmane.linux.lib.musl.general Subject: Re: undefined reference to `raise' with musl static toolchain Date: Tue, 8 May 2018 18:22:27 +0200 Message-ID: <20180508162226.GA30163@voyager> References: <20180508144417.216cefa5@windsurf.home> 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 1525796439 10921 195.159.176.226 (8 May 2018 16:20:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 16:20:39 +0000 (UTC) User-Agent: Mutt/1.9.4 (2018-02-28) To: musl@lists.openwall.com Original-X-From: musl-return-12831-gllmg-musl=m.gmane.org@lists.openwall.com Tue May 08 18:20:35 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 1fG5Lt-0002f3-2J for gllmg-musl@m.gmane.org; Tue, 08 May 2018 18:20:33 +0200 Original-Received: (qmail 11656 invoked by uid 550); 8 May 2018 16:22:40 -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 11635 invoked from network); 8 May 2018 16:22:40 -0000 Content-Disposition: inline In-Reply-To: <20180508144417.216cefa5@windsurf.home> X-Provags-ID: V03:K1:kIbGNh+/9juXIgqqfzP2G8XsS6enI9mgeBN2/HG/oZsviW22EDl e9CDg4bIN+ph3vdKg59u6/9PuEmEsJo1fWxKv47JgxretcKixdisuVaykSArPu1+jkV2+9i HcxaUVZ6X4l17Quh3mQTibnUlYpah1EznykZHkROzees7nbz/YZRVD7ku9Ek5GaBYtB1CAf JlPga8zD3vzYu1Ee52qGg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ab5FSEfPioI=:a+aaWEv1Zw98qPgcHM4rrr VlukrigMAZFYbfp8IMv7xqtKXH8DUciR/I7o6IckzY9l5nuIUm3Og75yxg2OBU375K++xb8jp D6pCKvbi9DftYKIOMQxedogd5XTPDXK7gkCZ8V0ro4wbegEhislg1pKEsO2YFWXO2RSQH8Ptx 9S+Yhd/rDkcC538wTbJsrW1yTBXN749GfkosG9s7KKCAGfqI423u91/mCyJJGQGc4hAieUJ/i OEcG5aaCY8pRNVF5iI9obOwlWmdAabWg/bKHSIIOu1BSYb43suPh72wJyxR9QwslSYtCuRnbn 51V2dbI1UP/7V9YpneiKpw6k1tDCO89yYLhEz/9qzW+cRq3ByLWP7XVA5nlN/0qRG89HFGEKk 0MwRVYPLToUHImr1r4K8weUA3Vytl4L8IL0Gv/VoDTMa1ORF/bzKjrwaKIb6deLGVto+UWa/r xSlv5t6thk4US+hachzpK+xxEC6FRElfQKMBCStDmy/S8oIu8Y431tZv4upjd2JtD1s4/ZF66 k1nqFNvCR1rJiC51ahwfX2yJ0T+ERux27tbR+0LWEQIuZQyu2C4w5vEa1pPcjjZq0lLX8kj1I TmNJq2yvHli1Pdt95VL0aSZX+Ldv8o6ReUNtVlDfToEe1Samjsm0Qt3J01U2dkeXOP7m/d7Tn l1u2dbMgYUh7vBYpAlwJ+b5zsCJDx554AX9cqeJfHUxlsXn5M3LlmN1a3VnpFyx2No4cMaAG1 08Kkc5l7JE0Yx2WFfTdPqXMKdA+uYUX07A+JyQzFHQYSXsro+gTIR+aiFuI= Xref: news.gmane.org gmane.linux.lib.musl.general:12815 Archived-At: 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. I suspect, once spec files have been taken care of, that the linker command line will be something like ld -o a.out crt1.o crtbegin.o crti.o $YOUR_PRJ_OFILES crtend.o crtn.o -lc -lgcc That would need another "-lc" at the end. Patching the specfile should do it. Things like this somewhat highlight the uselessness of collect2, don't you think? I thought fixing things like this is entirely within its remit, but no, apparently not. Another distinct possibility is that your gcc is somehow broken, either through your action or maybe that version isn't good, but I tend to try and fix the simple problem first. And patching the spec file is simpler than debugging gcc. Ciao, Markus