diff --git a/arch/_common.sh b/arch/_common.sh index 657ef47..1fb2c65 100644 --- a/arch/_common.sh +++ b/arch/_common.sh @@ -22,6 +22,7 @@ CFLAGS_COMMON_WEIRD=() CXXFLAGS_GCC_OPTI=("-fdeclone-ctor-dtor") CXXFLAGS_COMMON_WEIRD=() CXXFLAGS_COMMON_PERMISSIVE=("-fpermissive") +CXXFLAGS_COMMON_NOPERMISSIVE=("-fno-permissive") # Preprocesser Flags. CPPFLAGS_COMMON=("-D_GLIBCXX_ASSERTIONS") # OBJC Flags. @@ -29,6 +30,7 @@ OBJCFLAGS_COMMON_WEIRD=() # OBJCXX Flags. OBJCXXFLAGS_COMMON_WEIRD=() OBJCXXFLAGS_COMMON_PERMISSIVE=('-fpermissive') +OBJCXXFLAGS_COMMON_NOPERMISSIVE=('-fno-permissive') # RUST Flags. RUSTFLAGS_COMMON=() RUSTFLAGS_COMMON_OPTI=('-Ccodegen-units=1' '-Copt-level=3' '-Cdebuginfo=line-tables-only' '-Cforce-frame-pointers=yes') diff --git a/arch/_common_switches.sh b/arch/_common_switches.sh index 3143c89..35060f4 100644 --- a/arch/_common_switches.sh +++ b/arch/_common_switches.sh @@ -5,7 +5,7 @@ if ((AB_FLAGS_SSP)); then CFLAGS_COMMON+=('-fstack-protector-strong' '--param=ss if ((AB_FLAGS_SCP)); then CFLAGS_GCC_COMMON+=('-fstack-clash-protection'); fi if ((AB_FLAGS_RRO)); then LDFLAGS_COMMON+=('-Wl,-z,relro'); fi if ((AB_FLAGS_NOW)); then LDFLAGS_COMMON+=('-Wl,-z,now'); fi -if ((AB_FLAGS_FTF)); then CPPFLAGS_COMMON+=('-U_FORTIFY_SOURCE' '-D_FORTIFY_SOURCE=3'); fi +if ((AB_FLAGS_FTF)); then CPPFLAGS_COMMON+=('-U_FORTIFY_SOURCE' '-D_FORTIFY_SOURCE=3' '-O2'); fi if ((AB_FLAGS_SPECS)); then CFLAGS_GCC_OPTI+=('-specs=/usr/lib/gcc/specs/hardened-cc1'); fi if ((AB_FLAGS_O3)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/O3}"; fi if ((AB_FLAGS_OS)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/Os}"; fi diff --git a/arch/amd64.sh b/arch/amd64.sh index d2edc3e..2b77e46 100644 --- a/arch/amd64.sh +++ b/arch/amd64.sh @@ -9,6 +9,7 @@ HWCAPS=('x86-64-v2' 'x86-64-v3' 'x86-64-v4') # Default -march and μarch specific tuning. # No need to reference CFLAGS_COMMON_ARCH_BASE, it will be concatenated. CFLAGS_COMMON_ARCH=('-march=x86-64' '-mtune=znver4' '-msse2' '-mno-omit-leaf-frame-pointer') +LDFLAGS_COMMON_ARCH=('-Wl,-z,pack-relative-relocs') RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=x86-64') # HWCAPS subtargets in x86-64 are based on the microarchitecture levels diff --git a/arch/arm64.sh b/arch/arm64.sh index fefa2b7..a6e6020 100644 --- a/arch/arm64.sh +++ b/arch/arm64.sh @@ -2,5 +2,6 @@ ##arch/arm64.sh: Build definitions for arm64. ##@copyright GPL-2.0+ CFLAGS_COMMON_ARCH=('-march=armv8-a' '-mtune=generic' '-mno-omit-leaf-frame-pointer') +LDFLAGS_COMMON_ARCH=('-Wl,-z,pack-relative-relocs') RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=generic') # LDFLAGS_COMMON_CROSS=('-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/var/ab/cross-root/arm64/usr/lib -L/var/ab/cross-root/arm64/usr/lib ') diff --git a/arch/loongarch64.sh b/arch/loongarch64.sh index eb77c41..e0c6cc5 100644 --- a/arch/loongarch64.sh +++ b/arch/loongarch64.sh @@ -33,4 +33,5 @@ else CFLAGS_COMMON_ARCH+=('-march=loongarch64' '-mtune=la464') fi +LDFLAGS_COMMON_ARCH=('-Wl,-z,pack-relative-relocs') RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=generic-la64' '-Ctarget-feature=+lsx,+d' '-Clink-arg=-mabi=lp64d') diff --git a/arch/ppc64el.sh b/arch/ppc64el.sh index 2cf039a..11442b7 100644 --- a/arch/ppc64el.sh +++ b/arch/ppc64el.sh @@ -2,6 +2,7 @@ ##arch/ppc64el.sh: Build definitions for ppc64el. ##@copyright GPL-2.0+ CFLAGS_COMMON_ARCH_BASE=('-msecure-plt' '-mabi=ieeelongdouble') +LDFLAGS_COMMON_ARCH=('-Wl,-z,pack-relative-relocs') CFLAGS_COMMON_ARCH=('-mcpu=power8' '-mtune=power10' '-mvsx') RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=pwr8' '-Ctarget-feature=+vsx,+altivec,+secure-plt' '-Clink-arg=-mabi=ieeelongdouble') diff --git a/arch/riscv64.sh b/arch/riscv64.sh index 8c08286..f6b0642 100644 --- a/arch/riscv64.sh +++ b/arch/riscv64.sh @@ -6,6 +6,10 @@ if ! bool "$USECLANG" && [ "$(echo __GNUC__ | $CC -E -xc - | tail -n 1)" -ge 14 ]; then CFLAGS_COMMON_ARCH=('-mno-omit-leaf-frame-pointer') fi +# `-mno-fence-tso` is only available on GCC >= 15 +if ! bool "$USECLANG" && [ "$(echo __GNUC__ | $CC -E -xc - | tail -n 1)" -ge 15 ]; then + CFLAGS_COMMON_ARCH+=('-mno-fence-tso') +fi LDFLAGS_CLANG_ARCH=('-fuse-ld=lld' '-Wl,-mllvm=-mattr=+rva20u64') LDFLAGS_COMMON_CROSS=('-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link' '-Wl,/var/ab/cross-root/riscv64/usr/lib' '-L/var/ab/cross-root/riscv64/usr/lib') RUSTFLAGS_COMMON_ARCH=("-Clink-arg=-mabi=lp64d") diff --git a/proc/12-arch-flags.sh b/proc/12-arch-flags.sh index cc703c0..59f1ba0 100644 --- a/proc/12-arch-flags.sh +++ b/proc/12-arch-flags.sh @@ -4,7 +4,7 @@ ab_arch_setflags() { - local AB_FLAGS_FEATURES=(LTO PERMISSIVE) + local AB_FLAGS_FEATURES=(LTO NOPERMISSIVE) local AB_FLAGS_TYPES=('' _OPTI _ARCH_BASE _ARCH) local flagtypes=(LDFLAGS CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS RUSTFLAGS) local features=('') diff --git a/proc/53-spiral.sh b/proc/53-spiral.sh index 688ff16..aad787b 100644 --- a/proc/53-spiral.sh +++ b/proc/53-spiral.sh @@ -4,8 +4,8 @@ if bool "$ABSPIRAL"; then __ABSPIRAL_PROVIDES=() - if [[ "${#__AB_SONAMES[@]}" != 0 ]]; then - abspiral_from_sonames "${__AB_SONAMES[@]}" + if [[ "${#__AB_SONAMES[@]}" != 0 ]] || [[ "${#__AB_SONAMES_MANUADD[@]}" != 0 ]]; then + abspiral_from_sonames "${__AB_SONAMES[@]}" "${__AB_SONAMES_MANUADD[@]}" for SPIRAL_PROV in "${__ABSPIRAL_PROVIDES_SONAMES[@]}"; do # Ignore architecture notation for duplication detection if [[ "${SPIRAL_PROV%%:*}" = "$PKGNAME" ]]; then