From 6376c33feffa4ce2eea0fa3e580313c10f1f4a27 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Thu, 8 May 2025 16:17:52 +0000 Subject: [PATCH] [pacman] 7.0.0-9: Remove -fno-plt on unsupported architectures LLVM doesn't support -fno-plt on RISC-V and LoongArch and starts emitting a warning if it's supplied on unsupported targets since LLVM 20, causing various errors when configuring packages. Let's remove the flag on riscv64 and loongarch64. As we have started moving to LLVM 20, the problem must be mitigated by stripping -fno-plt away from CFLAGS/LDFLAGS on riscv64 and loongarch64. Link: https://github.com/llvm/llvm-project/pull/124081 Reference: https://github.com/eweOS/packages/issues/3594#issuecomment-2863596036 --- PKGBUILD | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index ba25b3e63..b25696a5f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgbase=pacman pkgname=(libalpm pacman repo-tools) pkgver=7.0.0 -pkgrel=8 +pkgrel=9 arch=(x86_64 aarch64 riscv64 loongarch64) url=https://www.archlinux.org/pacman/ license=(GPL) @@ -78,11 +78,19 @@ prepare(){ build() { - makepkg_cflags="-Os -pipe -fno-plt" + # Temporarily workaround LLVM behaviour changes on -fno-plt + # https://github.com/eweOS/packages/issues/3594#issuecomment-2863596036 + case $CARCH in + riscv64|loongarch64) + export CFLAGS="${CFLAGS/-fno-plt/}" + export LDFLAGS="${LDFLAGS/-fno-plt/}" ;; + esac + + makepkg_cflags="-Os -pipe" # TODO: riscv64 case $CARCH in - x86_64) makepkg_cflags+=" -march=x86-64 -fstack-clash-protection -fcf-protection" ;; - aarch64) makepkg_cflags+=" -march=armv8-a" ;; + x86_64) makepkg_cflags+=" -fno-plt -march=x86-64 -fstack-clash-protection -fcf-protection" ;; + aarch64) makepkg_cflags+=" -fno-plt -march=armv8-a" ;; riscv64) makepkg_cflags+=" -march=rv64gc" ;; loongarch64) makepkg_cflags+=" -march=la464" ;; esac