arm64: Check for dynamic relocs with readelf
PATCH 1/1 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.
--- arm/Makefile.arm64 | 6 +++--- configure | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
arm/Makefile.arm64 +3 -3
@@ -14,9 +14,9 @@ mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "") CFLAGS += $(mno_outline_atomics) define arch_elf_check = - $(if $(shell ! $(OBJDUMP) -R $(1) >&/dev/null && echo "nok"), - $(error $(shell $(OBJDUMP) -R $(1) 2>&1))) - $(if $(shell $(OBJDUMP) -R $(1) | grep R_ | grep -v R_AARCH64_RELATIVE), + $(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"), + $(error $(shell $(READELF) -rW $(1) 2>&1))) + $(if $(shell $(READELF) -rW $(1) | grep R_ | grep -v R_AARCH64_RELATIVE), $(error $(1) has unsupported reloc types)) endef
configure +2 -0
@@ -12,6 +12,7 @@ cflags= ld=ld objcopy=objcopy objdump=objdump +readelf=readelf ar=ar addr2line=addr2line arch=$(uname -m | sed -e 's/i.86/i386/;s/arm64/aarch64/;s/arm.*/arm/;s/ppc64.*/ppc64/')
@@ -372,6 +373,7 @@ CFLAGS=$cflags LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy OBJDUMP=$cross_prefix$objdump +READELF=$cross_prefix$readelf AR=$cross_prefix$ar ADDR2LINE=$cross_prefix$addr2line TEST_DIR=$testdir
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
Quoted 11 lines · Bill Wendling
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 objectThis 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.
Quoted 5 lines
Signed-off-by Bill Wendling <[email protected]>--- arm/Makefile.arm64 | 6 +++--- configure | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
Merged to https://gitlab.com/kvm-unit-tests/kvm-unit-tests.git master
Thanks,
drew
Quoted 41 lines
arm/Makefile.arm64 +3
-3@@ -14,9 +14,9 @@ mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "") CFLAGS += $(mno_outline_atomics) define arch_elf_check = - $(if $(shell ! $(OBJDUMP) -R $(1) >&/dev/null && echo "nok"), - $(error $(shell $(OBJDUMP) -R $(1) 2>&1))) - $(if $(shell $(OBJDUMP) -R $(1) | grep R_ | grep -v R_AARCH64_RELATIVE), + $(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"), + $(error $(shell $(READELF) -rW $(1) 2>&1))) + $(if $(shell $(READELF) -rW $(1) | grep R_ | grep -v R_AARCH64_RELATIVE), $(error $(1) has unsupported reloc types)) endefconfigure +2
-0@@ -12,6 +12,7 @@ cflags= ld=ld objcopy=objcopy objdump=objdump +readelf=readelf ar=ar addr2line=addr2line arch=$(uname -m | sed -e 's/i.86/i386/;s/arm64/aarch64/;s/arm.*/arm/;s/ppc64.*/ppc64/')@@ -372,6 +373,7 @@ CFLAGS=$cflags LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy OBJDUMP=$cross_prefix$objdump +READELF=$cross_prefix$readelf AR=$cross_prefix$ar ADDR2LINE=$cross_prefix$addr2line TEST_DIR=$testdirSignature · 1 line
2.36.0.464.gb9c8b46e94-goog
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm