right now, the perl ebuild only sets -Doptimize="${CFLAGS}". While this causes CFLAGS to be respected during compilation, perls runs conftests as > $cc $ccflags $ldflags ... The issue here is that LDFLAGS may depend on specific CFLAGS. I noticed this because enabling -pie in LDFLAGS requires -fPIE in CFLAGS This will cause errors like ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output defined in /var/tmp/portage/dev-lang/perl-5.34.0/temp/try-8b2fb9.o referenced by try.c /var/tmp/portage/dev-lang/perl-5.34.0/temp/try-8b2fb9.o:(main) We haven't run into this with gcc because gcc automatically sets -fPIE, and we haven't run into this with ld.bfd because that automatically sets -z,notext - only the combination of clang + ld.lld with -fPIE in CFLAGS and -pie in LDFLAGS triggers this.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c14fc41a02097c315b7f99849af169029477771f commit c14fc41a02097c315b7f99849af169029477771f Author: Andreas K. Hüttel <dilfridge@gentoo.org> AuthorDate: 2021-10-23 16:16:58 +0000 Commit: Andreas K. Hüttel <dilfridge@gentoo.org> CommitDate: 2021-10-23 16:17:12 +0000 dev-lang/perl: Various experimental improvements * do not duplicate configure flags * set -Dccflags="${CFLAGS}" * hardwire SINGLE_SLOT for simplification Bug: https://bugs.gentoo.org/694046 Bug: https://bugs.gentoo.org/806619 Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> dev-lang/perl/perl-5.34.0-r4.ebuild | 812 ++++++++++++++++++++++++++++++++++++ 1 file changed, 812 insertions(+)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b0050c7770f26eba5b5e704bc67ffcf82af2052 commit 4b0050c7770f26eba5b5e704bc67ffcf82af2052 Author: Andreas K. Hüttel <dilfridge@gentoo.org> AuthorDate: 2021-10-26 16:23:02 +0000 Commit: Andreas K. Hüttel <dilfridge@gentoo.org> CommitDate: 2021-10-26 16:23:02 +0000 dev-lang/perl: Re-keyword -r5 * Set -Dccflags="${CFLAGS}", bug 806619 * Drop duplicate configure flags, bug 694046 * Hardcode SINGLE_SLOT for simplification Closes: https://bugs.gentoo.org/694046 Closes: https://bugs.gentoo.org/806619 Bug: https://bugs.gentoo.org/261375 Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> dev-lang/perl/perl-5.34.0-r5.ebuild | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)