[kvm-unit-tests PATCH] arm64: Check for dynamic relocs with readelf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <morbo@xxxxxxxxxx>
---
 arm/Makefile.arm64 | 6 +++---
 configure          | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
index 6feac76f895f..42e18e771b3b 100644
--- a/arm/Makefile.arm64
+++ b/arm/Makefile.arm64
@@ -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
 
diff --git a/configure b/configure
index 86c3095a245a..23085da7dcc5 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.36.0.464.gb9c8b46e94-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux