[kvm-unit-tests PATCH] arm64: Link with -z notext

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

 



Building the tests on arm64 fails when using LLD (the LLVM linker):

  ld.lld: error: can't create dynamic relocation R_AARCH64_ABS64 against
  local symbol in readonly segment; recompile object files with -fPIC or
  pass '-Wl,-z,notext' to allow text relocations in the output
  >>> defined in lib/libcflat.a(processor.o)
  >>> referenced by processor.c
  >>>               processor.o:(vector_names) in archive lib/libcflat.a

The reason is that LLD defaults to errors for text relocations. The GNU
LD defaults to let it go. In fact, the same error can be reproduced when
using GNU LD with the '-z text' arg (to error on text relocations):

  aarch64-linux-gnu-ld: read-only segment has dynamic relocations

Fix this link error by adding `-z notext` into the arm64 linker flags.

Signed-off-by: Ricardo Koller <ricarkol@xxxxxxxxxx>
---
 arm/Makefile.arm64 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
index dbc7524..e8a38d7 100644
--- a/arm/Makefile.arm64
+++ b/arm/Makefile.arm64
@@ -7,6 +7,7 @@ bits = 64
 ldarch = elf64-littleaarch64
 
 arch_LDFLAGS = -pie -n
+arch_LDFLAGS += -z notext
 CFLAGS += -mstrict-align
 
 mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
-- 
2.33.0.rc2.250.ged5fa647cd-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