Re: [PATCH] Makerules/Makeconfig: Add rtlddir-build for the libc.so loader reference
"Andreas K. Huettel" <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Organization | Gentoo Linux |
| Message-ID | <[email protected]> |
Am Sonntag, 12. Juli 2026, 07:20:53 Japanische Normalzeit schrieb Tiago Dinis: > From: Tiago Dinis <[email protected]> > > The libc.so linker script generated by "make install" references the > dynamic linker via an AS_NEEDED entry so the linker can resolve it > while building against libc. Previously this used \$(rtlddir), which > is also the path compiled into ld-linux as its self-identification > string (-DRTLD in elf/Makefile) and used for the PT_INTERP of glibc's > own binaries (installed-rtld-LDFLAGS in Makeconfig). > > These two uses legitimately differ when glibc is built to run on a > different environment with a different filesystem structure than the > build system: the loader is installed under the build tree, but the > resulting binaries must reference it via the runtime path of the > target environment. Setting \$(rtlddir) to that runtime path makes > libc.so point at a loader that is not present at build time, breaking > linking against libc and later consumers such as binutils. > > Introduce \$(rtlddir-build), defaulting to \$(rtlddir), and use it for > the libc.so AS_NEEDED entry so it tracks where the loader is actually > installed. \$(rtlddir) keeps driving the runtime path > (self-identification and PT_INTERP). This is a no-op for the default > configuration, where rtlddir-build == rtlddir == slibdir. > Not urgent, after release (if it gets RB) > Reviewed-by: (none yet) > --- > Makeconfig | 9 +++++++++ > Makerules | 2 +- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/Makeconfig b/Makeconfig > index e7dbd9fb..135a98b6 100644 > --- a/Makeconfig > +++ b/Makeconfig > @@ -165,6 +165,15 @@ rtlddir = $(slibdir) > endif > inst_rtlddir = $(install_root)$(rtlddir) > > +# Directory referenced by the libc.so linker script (AS_NEEDED entry) for > +# the dynamic linker at build time. This points at the location where the > +# loader is actually installed so the linker can resolve it while building > +# against libc. It defaults to rtlddir (where it differs, the loader is > +# installed in rtlddir-build but identified/loaded at runtime via rtlddir). > +ifndef rtlddir-build > +rtlddir-build = $(rtlddir) > +endif > + > # Prefix to put on files installed in $(libdir). For libraries `libNAME.a', > # the prefix is spliced between `lib' and the name, so the linker switch > # `-l$(libprefix)NAME' finds the library; for other files the prefix is > diff --git a/Makerules b/Makerules > index 6bef57ec..61b24131 100644 > --- a/Makerules > +++ b/Makerules > @@ -1024,7 +1024,7 @@ $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ > cat $<; \ > echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ > '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ > - ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \ > + ' AS_NEEDED (' $(rtlddir-build)/$(rtld-installed-name) ') )' \ > ) > [email protected] > mv -f [email protected] $@ > > -- PD Dr. Andreas K. Hüttel [email protected] Gentoo Linux developer (council, comrel, toolchain, base-system, perl, libreoffice) https://wiki.gentoo.org/wiki/User:Dilfridge
signature.asc
(application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEE/Rnm0xsZLuTcY+rT3CsWIV7VQSoFAmpXb10bFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJENwrFiFe1UEqJ1IP/jMtfybVMpUQPrfAlMet cJhlCaFcVp7QuNWxGMg9S6UH8CdxVNCt/Ojl/5G1V9Yq971GfqeF133p1mrXFZql SP8ir5kgEpgRfkwC/DG229LFG7baCB9VLMmJc9vq+MLO4hAqiHdU0S9sYPr9m7+v EC0X1g2Y5Nzshuc3fNt2730odSLE+ePsKoOsmbZToiwPp0WXEnJyjFkO+GLoH5C3 25A0pHWlBqgqS+XJbloKjoSNNT2mHUVsdsnJQ/NJgYHfugWzOk7uZ9e7QbOR+a3L ziRWdS7qkPMh05Q7vXtTiNKTCampOG1WCPK8GTxjTnI9TeFI3Y33tE5Xmdn3w3Kn Pu/fBbqm+F7h4QY36br4mtD4k/gaiXT3bhzIa/tpm9Hiv1B2RnAoQyreObe8jFTq FYR/pWyX2ylGRDWihqWCFsG4QEsBY9go3PnMo9/gT3JgZV+Vk/b6Bh7n9CfhZa8B ijTx9mbhQ2ux4Cu9ll9tVXE1jSzbWT6J69bJ4d0m1cRBrRss7xgMnNiDOYw4x89n 8riHPC3fcgRgSGmzx9X3U3K7NXm5MaV86r0Bdt3ejzHe09V2PhnovohAQvILcGt8 Zi3T40lOOd4FyrSUd4Z/xGZwAdFQrOHJQ5Wed3yL3hm+uwoxq/W87dHQOBmRqS95 Wjg3Xp2WddgFlk9lknx4+Dhw =KOUO -----END PGP SIGNATURE-----