Hi Khem Raj,
 
I think your patch may be useful for me, so with it I would remove libcc path detection from my script.
 
But it doesn't seem to work as I expect it to.
 
If I run configure with LIBCC variable specified, everything goes well:
 
    checking whether linker accepts -Wl,--sort-section,alignment... no
    checking whether linker accepts -Wl,--sort-common... no
    checking whether linker accepts -Wl,--gc-sections... no
    checking whether linker accepts -Wl,--hash-style=both... no
    checking whether linker accepts -Wl,--no-undefined... no
    checking whether linker accepts -Wl,--exclude-libs=ALL... no
    checking whether linker accepts -Wl,-Bsymbolic-functions... no
    using compiler runtime libraries: /path/to/llvm/lib/clang/5.0.0/lib/linux/libclang_rt.builtins-x86_64.a
 
But if I configure with no LIBCC specified, it detects runtime library, but fails linker test:
 
    checking whether linker accepts -Wl,--sort-section,alignment... no
    checking whether linker accepts -Wl,--sort-common... no
    checking whether linker accepts -Wl,--gc-sections... no
    checking whether linker accepts -Wl,--hash-style=both... no
    checking whether linker accepts -Wl,--no-undefined... no
    checking whether linker accepts -Wl,--exclude-libs=ALL... no
    checking whether linker accepts -Wl,-Bsymbolic-functions... no
    checking whether linker accepts /path/to/llvm/lib/clang/5.0.0/lib/linux/libclang_rt.builtins-x86_64.a... no
    checking whether linker accepts -lgcc... no
    checking whether linker accepts -lcompiler_rt... no
    checking whether linker accepts libpcc.a... no
    using compiler runtime libraries:
 
Do you know what may be wrong with my configuration?
 
Regards,
Dmitry


16.03.2017, 07:22, "Khem Raj" <raj.khem@gmail.com>:

This uses compiler to provide the path to its default runtime
library libgcc/compiler-rt, when using clang we can set

CC="clang --rtlib={compiler-rt|libgcc}" and it will find
the right compiler runtime when autodetecting it

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index c2db298c..0c670dd8 100755
--- a/configure
+++ b/configure
@@ -587,6 +587,8 @@ tryldflag LDFLAGS_AUTO -Wl,--exclude-libs=ALL
 tryldflag LDFLAGS_AUTO -Wl,-Bsymbolic-functions

 # Find compiler runtime library
+test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \
+ && tryldflag LIBCC "$try_libcc"
 test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
 test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt
 test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \

--
2.12.0