Skip to content

Commit 445e5ae

Browse files
bwendlingAndrew Jones
authored and
Andrew Jones
committed
arm64: Check for dynamic relocs with readelf
Clang's version of objdump doesn't recognize "setftest.elf" as a dynamic object and produces an error stating such. $ llvm-objdump -R ./arm/selftest.elf arm/selftest.elf: file format elf64-littleaarch64 llvm-objdump: error: './arm/selftest.elf': not a dynamic object This causes the ARM64 "arch_elf_check" check to fail. Using "readelf -rW" is a better option way to get the same information and produces the same information in both binutils and LLVM. Signed-off-by: Bill Wendling <[email protected]> Signed-off-by: Andrew Jones <[email protected]>
1 parent c7d6c7f commit 445e5ae

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

arm/Makefile.arm64

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
1414
CFLAGS += $(mno_outline_atomics)
1515

1616
define arch_elf_check =
17-
$(if $(shell ! $(OBJDUMP) -R $(1) >&/dev/null && echo "nok"),
18-
$(error $(shell $(OBJDUMP) -R $(1) 2>&1)))
19-
$(if $(shell $(OBJDUMP) -R $(1) | grep R_ | grep -v R_AARCH64_RELATIVE),
17+
$(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"),
18+
$(error $(shell $(READELF) -rW $(1) 2>&1)))
19+
$(if $(shell $(READELF) -rW $(1) | grep R_ | grep -v R_AARCH64_RELATIVE),
2020
$(error $(1) has unsupported reloc types))
2121
endef
2222

configure

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cflags=
1212
ld=ld
1313
objcopy=objcopy
1414
objdump=objdump
15+
readelf=readelf
1516
ar=ar
1617
addr2line=addr2line
1718
arch=$(uname -m | sed -e 's/i.86/i386/;s/arm64/aarch64/;s/arm.*/arm/;s/ppc64.*/ppc64/')
@@ -372,6 +373,7 @@ CFLAGS=$cflags
372373
LD=$cross_prefix$ld
373374
OBJCOPY=$cross_prefix$objcopy
374375
OBJDUMP=$cross_prefix$objdump
376+
READELF=$cross_prefix$readelf
375377
AR=$cross_prefix$ar
376378
ADDR2LINE=$cross_prefix$addr2line
377379
TEST_DIR=$testdir

0 commit comments

Comments
 (0)