kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Ricardo Koller <ricarkol@google.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	oupton@google.com, jacobhxu@google.com, jingzhangos@google.com,
	pshier@google.com, rananta@google.com, reijiw@google.com
Subject: Re: [kvm-unit-tests PATCH] arm64: Link with -z notext
Date: Tue, 31 Aug 2021 12:31:03 +0200	[thread overview]
Message-ID: <20210831103103.mrb74fv6eml7hfiw@gator.home> (raw)
In-Reply-To: <20210819223047.2813268-1-ricarkol@google.com>

On Thu, Aug 19, 2021 at 03:30:47PM -0700, Ricardo Koller wrote:
> 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
>

Applied to arm/queue and merged to master.

Thanks,
drew 


      reply	other threads:[~2021-08-31 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 22:30 [kvm-unit-tests PATCH] arm64: Link with -z notext Ricardo Koller
2021-08-31 10:31 ` Andrew Jones [this message]

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=20210831103103.mrb74fv6eml7hfiw@gator.home \
    --to=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 \
    --cc=ricarkol@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).