From: Ricardo Koller <ricarkol@google.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
drjones@redhat.com
Cc: oupton@google.com, jacobhxu@google.com, jingzhangos@google.com,
pshier@google.com, rananta@google.com, reijiw@google.com,
Ricardo Koller <ricarkol@google.com>
Subject: [kvm-unit-tests PATCH] arm64: Link with -z notext
Date: Thu, 19 Aug 2021 15:30:47 -0700 [thread overview]
Message-ID: <20210819223047.2813268-1-ricarkol@google.com> (raw)
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@google.com>
---
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
next reply other threads:[~2021-08-19 22:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 22:30 Ricardo Koller [this message]
2021-08-31 10:31 ` [kvm-unit-tests PATCH] arm64: Link with -z notext Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210819223047.2813268-1-ricarkol@google.com \
--to=ricarkol@google.com \
--cc=drjones@redhat.com \
--cc=jacobhxu@google.com \
--cc=jingzhangos@google.com \
--cc=kvm@vger.kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=pshier@google.com \
--cc=rananta@google.com \
--cc=reijiw@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).