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

Florian Weimer fweimer@redhat.com
Thu Jan 30 13:33:58 GMT 2025


* 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.

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