bug#27866: Handle clang's internal libraries when finding compiler's internal libraries

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.gnu.libtool.bugs
Message-ID <20180119221619.GM7217@vapier>
On 28 Jul 2017 13:36, Manoj Gupta wrote:
> This is Manoj working on ChromeOS. I am facing a problem trying to build it
> with clang with its own internal library (compiler-rt) since some packages
> like mesa fail to build. The root cause is clang uses an absolute path to
> link its internal libraries which libtool does not recognize.
> 
> e.g. clang++ -rtlib=compiler-rt main.cpp -v shows use of
> /usr/lib64/clang/5.0.0/lib/linux/libclang_rt.builtins-x86_64.a
> 
> Libtool currently relies on "-lname" pattern to find the internal
> libraries. And this does not work if some code is compiled using +
> compiler-rt.
> The issue was discovered in building mesa graphics library which uses
> -nostdlib flag  and relies on libtool to pass the additionally required
> compiler internal libraries.
> 
> I have a sample fix below for fixing this for clang.
> 
> +--- a/m4/libtool.m4
> ++++ b/m4/libtool.m4
> +@@ -7531,7 +7544,7 @@
> +   for p in `eval "$output_verbose_link_cmd"`; do
> +     case $prev$p in
> +
> +-    -L* | -R* | -l*)
> ++    -L* | -R* | -l* | *clang_rt*.a)
> +        # Some compilers place space between "-{L,R}" and the path.
> +        # Remove the space.
> +        if test x-L = "$p" ||
> +

i don't think hardcoding any specific library is correct, especially with
an expansive glob like this.

i wonder if leveraging libext would be a bad idea here.
    -L* | -R* | -l* | *.${libext})
-mike

_______________________________________________
Bug-libtool mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-libtool
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAlpibjMACgkQQWM7n+g3
9YFyQQ/8Cug7ZUs1wlhJ3XdGsH06shOjM18iyNKNX3CHsN7A0F41H2G/7/3qAaCt
3WumkJH+NMXGD+MtQVLNzpXpJWB9loz9PQ7MuPyV11v78h1AP13aSTj9HarY1d41
OjF+wSQzIDuCT9QfNejI/p2C3NKUhr4KA1FJ8QxL4OrrMCLhJ9ySZzKYhnPK1Op9
EIr103h322lHIJ95GFq3gMo/7d3cdqUEixZ2YufgnVsiVbjoanrsAPZ7QKgZ6p76
CgOq2wl0YeML+WXR6rjqyBiC1FvBdA7/oEhu4p2Xc1npbpbpOmQPZ9+KW2xRrngd
jCm9WZe/oJGAM+Z2ru7p+AZhCdS08ewpPI4EiorH1ktHSrGgN4xq0YCMYvhhuPiO
0bXGnOOhIo53HcvLlXNMDTEcUrsldrpM7W40SToiUvUrghAiRbs12d+r4cElqqbT
dd9MxBs9yFVtFc+Y8omF+6C+sFoIekq52BjGoKlYHU+CntaMf5UL56HP9yOSYFd/
SFS+cgVP6fLcy10dSa/yuWh4RaSXnZvRMFR6TGmbsqucFij/q2YePcOaN0iytRYQ
XRwUfFoEd1kEeeev8qT829jaL89B3uenGaVDq8hH6/kkhNBbiNR4djJ7ss5Tfz9v
qoPDxWUr3CWJRgbdLwMvXh/aVZDTJ5h0QX3WKMAo3n60/HygZik=
=GRQx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.