util/xcompile: Fix compiler detection on newer Linux distros
Switch to using `objdump -f`, which consistently prints the line
"file format <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 <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89643
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
parent
82d90b1f21
commit
d7f427a7d2
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue