mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: ./configure compiler-rt patch
Date: Tue, 20 Feb 2018 21:12:56 -0500	[thread overview]
Message-ID: <20180221021256.GB1436@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAG6b3EoqqOoOeDifcNbO88GH-GTp0heUFCbkXtJS8a+G4TdqcQ@mail.gmail.com>

On Tue, Feb 13, 2018 at 03:53:39PM +0100, Matúš Olekšák wrote:
> Hi,
> I have complete LLVM toolchain and I discovered that, detection of
> compiler-rt is not working in ./configure. Because it is looking for
> dynamic library compiler_rt but it doesn't exist. Instead it should ask
> compiler about libgcc-file-name to get correct filename. I attached patch
> to fix this issue.

> --- a/configure
> +++ b/configure
> @@ -597,7 +597,8 @@
>  
>  # Find compiler runtime library
>  test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
> -test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt
> +test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \
> +                 && tryldflag LIBCC "$try_libcc"
>  test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \
>                   && tryldflag LIBCC "$try_libcc"
>  printf "using compiler runtime libraries: %s\n" "$LIBCC"

Sorry for the slow response. I think this probably okay, but if I
remember right, there has been discussion of this before and might be
more subtlety to doing it optimally. The nice property of the -lgcc
case (and the -lcompiler_rt case if it worked, but it doesn't) is that
it's immune to changes in compiler version; upgrading gcc without
rerunning configure won't cause it to fail.

It might be optimal to try the basename produced by
-print-libgcc-file-name, stripping the "lib" and ".a" parts and using
it with -l, to see if that works. But it might not actually work for
anything other than gcc. I know it doesn't (or at least didn't in the
past) work for pcc.

Note that -print-libgcc-file-name does work with pcc, at least modern
versions, so I think we could remove the pcc-specific check too at
some point.

Rich


  reply	other threads:[~2018-02-21  2:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 14:53 Matúš Olekšák
2018-02-21  2:12 ` Rich Felker [this message]
2018-02-21 10:30   ` Shiz
2018-02-21 10:58     ` Dmitry Golovin
  -- strict thread matches above, loose matches on Subject: below --
2018-02-06 21:16 Matúš Olekšák

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=20180221021256.GB1436@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).