commit:     9c2e28f75caf3d9ada6f570e70500e00c2d6cd5d
Author:     George Burgess IV <gbiv <AT> google <DOT> com>
AuthorDate: Mon Oct 30 16:25:14 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 15 03:17:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c2e28f7

dev-libs/gmp: add -fno-sanitize-address-globals-dead-stripping

Clang recently defaulted `-fsanitize-address-globals-dead-stripping` to
'on' for ELF: https://reviews.llvm.org/D152604. This breaks gmp's
configure checks, as it detects that rodata sections should be declared
with:
```
.rodata.foo,"aG",@progbits,foo,comdat
```

instead of:
```
.rodata,"a",@progbits
```

Since Clang uses LLVM-specific assembler extensions to make this ASAN
symbol GCing work, disable the feature for this package.

Signed-off-by: George Burgess IV <gbiv <AT> google.com>
Closes: https://github.com/gentoo/gentoo/pull/33592
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/gmp/{gmp-6.3.0.ebuild => gmp-6.3.0-r1.ebuild} | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dev-libs/gmp/gmp-6.3.0.ebuild b/dev-libs/gmp/gmp-6.3.0-r1.ebuild
similarity index 93%
rename from dev-libs/gmp/gmp-6.3.0.ebuild
rename to dev-libs/gmp/gmp-6.3.0-r1.ebuild
index 2cb6293940af..ee4311e99aaa 100644
--- a/dev-libs/gmp/gmp-6.3.0.ebuild
+++ b/dev-libs/gmp/gmp-6.3.0-r1.ebuild
@@ -163,6 +163,14 @@ multilib_src_configure() {
                export ac_cv_host="${gmp_host}"
        fi
 
+       # Clang with -fsanitize=address may emit weird section names in its asm,
+       # which causes gmp's configure checks to select a broken way of
+       # specifying `.rodata`. Disable this feature, which was introduced in
+       # Clang 15 (and defaulted to on in Clang 18).
+       if tc-is-clang && [[ "$(clang-major-version)" -ge 15 ]]; then
+               append-cxxflags "-fno-sanitize-address-globals-dead-stripping"
+       fi
+
        ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
 }
 

Reply via email to