From 08d59ced0da041c62510dee5f4aa71ddc28126d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:49:03 -0300 Subject: [PATCH] fix(goconserver): strip the cross-compiled binaries at link time For a native build rpm's brp-strip strips the Go binaries; for a cross build (--target-arch riscv64 on x86_64) the host strip cannot handle the foreign ELF and the rpm shipped unstripped 19 MB binaries. Pass -s -w to the Go linker for cross builds only, so the riscv64 rpm is stripped like the native ones; native builds are unchanged. --- goconserver/mockbuild.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/goconserver/mockbuild.pl b/goconserver/mockbuild.pl index 0d12461..5daae09 100644 --- a/goconserver/mockbuild.pl +++ b/goconserver/mockbuild.pl @@ -140,6 +140,8 @@ my $go_build_dir = "$work_dir/bin"; make_path($go_build_dir); my $ldflags = "-X main.Version=$version"; +# rpm's brp-strip on the host cannot strip a foreign-arch ELF, so let the Go linker do it. +$ldflags .= ' -s -w' if $cross; run("cd " . sh_quote($src_dir) . " && " . "go build -trimpath -buildvcs=false -ldflags " . sh_quote($ldflags) .