[PATCH 1/4] Makeconfig: Add libgcc directory to rtld-prefix search path

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Jan 30 16:26:30 GMT 2025



On 30/01/25 10:33, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>>> Not only that.  On many architectures, libgcc_s.so is a linker script in
>>> the same directory as libgcc.a.
>>>
>>> If we want to automatically follow what ldconfig does, I think we should
>>> teach ldconfig to print the information we need.  Then this gets solved
>>> after a couple of releases.
>>
>> I think this does not solve if you use a non-default compiler that has its
>> own libgcc_s.so, for instance if you build it with bmg. For the issue of
>> the extra libgcc_s.so dependency, I see the most straightforward fix just
>> to copy it on the builddir (maybe along with libstdc++.so so tests will
>> also use the library g++ linked against).
> 
> If we want to copy the file, we should use
> 
>   -print-file-name=libgcc_s.so.$(libgcc_s-version)
> 
> where $(libgcc_s-version) comes form shlib-versions (see
> sysdeps/hppa/shlib-versions for an example).  This way, we get the real
> object, and not the linker script.


We can also use '-print-file-name=libgcc_s.so.$(libgcc_s-version)' with
the original approach to add in on either the --library-path or RPATH.

I think we will need add a bit more machinery to handle the container
tests (since we will need an extra copy rule to handle non system
libraries).

> 
> I think this should workk in a Makefile:
> 
> libgcc_s-version = $(shell $(AWK) -F= '/^libgcc_s=/{print $2}' < $(common-objpfx)shlib-versions.v)
> 
> Not sure if there's a nicer way to get that version.
> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list