summaryrefslogtreecommitdiff
path: root/system/gcc/APKBUILD
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-07-06 20:31:50 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-07 10:08:21 -0500
commit9852d13a3263e0d163e6cb180d6c3edbd54e5858 (patch)
treef1cb2f6fe077edc6fab9253c3b38b4b01cd68b8f /system/gcc/APKBUILD
parent4ad8c480ac1a4bffce94b41e5d4d0579b7dddddf (diff)
downloadpackages-9852d13a3263e0d163e6cb180d6c3edbd54e5858.tar.gz
packages-9852d13a3263e0d163e6cb180d6c3edbd54e5858.tar.bz2
packages-9852d13a3263e0d163e6cb180d6c3edbd54e5858.tar.xz
packages-9852d13a3263e0d163e6cb180d6c3edbd54e5858.zip
system/gcc: Add sanitizer support
Based-ish on Chimera's patches, but a bit more thorough. * 32-bit ports don't have liblsan or libtsan. * We can't dep on utmps-dev for utmpx, so hard-code size. The size is the same on all six arches per my testing.
Diffstat (limited to 'system/gcc/APKBUILD')
-rw-r--r--system/gcc/APKBUILD34
1 files changed, 31 insertions, 3 deletions
diff --git a/system/gcc/APKBUILD b/system/gcc/APKBUILD
index 38372feb0..b349cf43d 100644
--- a/system/gcc/APKBUILD
+++ b/system/gcc/APKBUILD
@@ -32,6 +32,7 @@ LIBGOMP=true
LIBGCC=true
LIBATOMIC=true
LIBITM=true
+LIBSANITIZER=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
@@ -48,6 +49,7 @@ if [ "$CHOST" != "$CTARGET" ]; then
LIBGOMP=false
LIBATOMIC=false
LIBITM=false
+ LIBSANITIZER=false
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
@@ -109,6 +111,7 @@ esac
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
+$LIBSANITIZER && subpackages="$subpackages libsanitizer::$CTARGET_ARCH"
if $LIBGOMP; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
@@ -176,11 +179,12 @@ source="https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
336-gccgo-mmap64.patch
341-gccgo-libucontext-stack.patch
342-gccgo-reflect-underscore.patch
+ libgo-musl-1.2.3.patch
add-classic_table-support.patch
gcc-5.4.0-locale.patch
- libgo-musl-1.2.3.patch
+ sanitation.patch
match-split.patch
insn-split.patch
@@ -245,7 +249,6 @@ build() {
case "$CTARGET_LIBC" in
musl)
- _libc_configure="--disable-libsanitizer"
_symvers="--disable-symvers"
export libat_cv_have_ifunc=no
export ac_cv_type_off64_t=no
@@ -263,6 +266,7 @@ build() {
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
+ $LIBSANITIZER || _bootstrap_configure="$_bootstrap_configure --disable-libsanitizer"
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
@@ -500,6 +504,29 @@ libquadmath() {
mv "$pkgdir"/usr/lib/libquadmath.so.* "$subpkgdir"/usr/lib/
}
+libsanitizer() {
+ pkgdesc="Runtime code linting libraries for GCC"
+ depends=
+
+ # https://github.com/google/sanitizers/issues/794
+ # https://reviews.llvm.org/D28609 ("ported to GCC")
+ case $CTARGET_ARCH in
+ pmmx|x86|i528|armel|armhf|armv7|m68k|mips32|mips32el|ppc)
+ sanitizer_extras="";;
+ *)
+ sanitizer_extras="lsan tsan";;
+ esac
+
+ mkdir -p "$subpkgdir"/usr/lib
+ for san in asan sanitizer ubsan ${sanitizer_extras}; do
+ mv "$pkgdir"/usr/lib/lib${san}* "$subpkgdir"/usr/lib/
+ done
+
+ mkdir -p "$subpkgdir"/$_gcclibdir/include
+ mv "$pkgdir"/$_gcclibdir/include/sanitizer \
+ "$subpkgdir"/$_gcclibdir/include/
+}
+
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
@@ -576,8 +603,9 @@ dc03c7b660f0142aa16e78e4e50581c883f6632f4794131f1131e0dc8fd500ba5d6a0046a36dc621
5ead34140ff01e2918554c9c3f8378fe02cdf41f5b965053c126238dc157a1e2558d58465395b750e85b1d7167c4fc79d8a7f34894146507d7366d79a69d4ee7 336-gccgo-mmap64.patch
3cbe5e879902a73121b22d903be605c7100e607864b0e305d6825a4083502fbe94be9a4166fb833b28e5d18cd7548f317719e28e3579194ea3e1b626450c943b 341-gccgo-libucontext-stack.patch
76d141a9e245595eab66cc4ddbfda57330790e04960de5d1c4e1e97efb52291d18087840f7494c0310afc3f093e1fad8c6070928f489c97201f32782f67559fd 342-gccgo-reflect-underscore.patch
+fa59b0fb081d97f8f63506b8793699588a95c602b5d468140eb1e80456597e52e1cc45dc0b234ac8e60e2b0cd606d94d111c8b0ae64c0a2be1bc1b8a184ceb93 libgo-musl-1.2.3.patch
1860593584f629d24d5b6db14b0a3412e9f93449b663aaa4981301a0923db0159314905e694f27366fbfef72dce06636ab6df86862b7e9e9564847e03bee82c1 add-classic_table-support.patch
a09b3181002798d1b17b8374eba6bec18e67d4d4f30677311c330b599e231e97cf02c1b9b79c0829952f5027016e01146743b665b19558ed2693c60a567823fb gcc-5.4.0-locale.patch
-fa59b0fb081d97f8f63506b8793699588a95c602b5d468140eb1e80456597e52e1cc45dc0b234ac8e60e2b0cd606d94d111c8b0ae64c0a2be1bc1b8a184ceb93 libgo-musl-1.2.3.patch
+dba5fdaf253a44f4239151cff8bcfc676264f2fac535d05f82ac7d7e965e272b724067a364521da1eeca3cff1d499f6e1eafa483ff3b3c2ede9fcd90be368e36 sanitation.patch
ff6159633f04d26eadc79895dc24ccb46671a04fdc728cbbac86964a14ce17e2e51cd7668947dfe06b9168bb9b8575a80955012e5f51295ea02f4f3169e07541 match-split.patch
ee626cbe4bdda5b868980c86ca066d33167d06517db676e43d0719c4ad7d11e99b3a0151927f15c93ab89f6c76dd12bd48d402d25771fa3fd175273248824eda insn-split.patch"