Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 20 Feb 2018 21:12:56 -0500
From: Rich Felker <>
Subject: Re: ./configure compiler-rt patch

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.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.