mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: undefined reference to `raise' with musl static toolchain
Date: Tue, 8 May 2018 18:22:27 +0200	[thread overview]
Message-ID: <20180508162226.GA30163@voyager> (raw)
In-Reply-To: <20180508144417.216cefa5@windsurf.home>

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


  parent reply	other threads:[~2018-05-08 16:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 12:44 Thomas Petazzoni
2018-05-08 13:28 ` Alexander Monakov
2018-05-08 16:22 ` Markus Wichmann [this message]
2018-05-08 16:34   ` Rich Felker
2018-05-09  9:29     ` Thomas Petazzoni
2018-05-09 13:44       ` Thomas Petazzoni
2018-05-09 15:24         ` Szabolcs Nagy
2018-05-09 17:28           ` Rich Felker
2018-05-11 15:59           ` Thomas Petazzoni
2018-05-11 16:05             ` Rich Felker
2018-05-11 21:28               ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180508162226.GA30163@voyager \
    --to=nullplan@gmx.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).