From d7f427a7d23ab6fe7ab5a990b9704346f86d7a25 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 20 Oct 2025 10:19:01 +0100 Subject: [PATCH] util/xcompile: Fix compiler detection on newer Linux distros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to using `objdump -f`, which consistently prints the line "file format " across modern binutils versions, and extract the architecture format from that output. This restores correct toolchain detection on Ubuntu 25.10 and other systems with binutils ≥ 2.43, without breakng older versions. Before: DEBUG: obj_type: /tmp/temp.rrDQ8i.o: file format elf64-x86-64 DEBUG: obj_arch: After: DEBUG: obj_type: /tmp/temp.8GsK08.o: file format elf64-x86-64 architecture: i386:x86-64, flags 0x00000000: start address 0x0000000000000000 DEBUG: obj_arch: elf64-x86-64 Change-Id: Ic09304f9e81580bbe1c0bb4910c0cc534d3d2816 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/89643 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- util/xcompile/xcompile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 6443dd2a90..8f0d19a6a6 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -155,8 +155,8 @@ testas() { 2>/dev/null || return 1 # Check output content type. - local obj_type="$(LANG=C LC_ALL='' "${gccprefix}"objdump -p "$obj_file" 2>/dev/null)" - local obj_arch="$(expr "$obj_type" : '.*format \(.[a-z0-9-]*\)')" + local obj_type="$(LANG=C LC_ALL='' "${gccprefix}"objdump -f "$obj_file" 2>/dev/null)" + local obj_arch="$(printf '%s\n' "$obj_type" | sed -n 's/.*file format \([a-z0-9-]*\).*/\1/p')" [ "$obj_arch" = "$full_arch" ] || return 1 unset ASFLAGS LDFLAGS