public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sam Edwards <cfsworks@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 3/3] clang: Link with --no-pie instead of --apply-dynamic-relocs
Date: Mon, 15 May 2023 20:08:59 -0600	[thread overview]
Message-ID: <9eb1232a-fef8-3afd-5113-50ae2bcddfcc@gmail.com> (raw)
In-Reply-To: <20230514152845.GR2398826@bill-the-cat>

On 5/14/23 09:28, Tom Rini wrote:

Hi Tom!

> How extensively have you tested this change?

I tested it in building for the arm/sunxi target. U-Boot does not build 
at all (on Clang+LLD) in its current state:

ld.lld: error: section type mismatch for .gnu.version_r
 >>> <internal>:(.gnu.version_r): SHT_GNU_verneed
 >>> output section .gnu: SHT_GNU_versym

However, I don't think I've reasoned correctly that --no-pie is the 
correct flag to pass, since I do see in arch/arm/config.mk:

# needed for relocation
LDFLAGS_u-boot += -pie

...and by passing --no-pie, I am just turning that right back off, 
getting a non-relocatable binary. So I should (and do) withdraw this 
patch, and will work to understand the situation better before retrying.

It does seem that the present rule in the ARM target is to make a binary 
that assumes a .text base but includes some .rel.dyn relocations to make 
it optionally relocatable, so whatever flag we pass to LLD should 
preserve that behavior without bringing in unwanted sections (versym 
sections, .dynsym, .dynstr, ...)

> We don't install ld.lld in
> our container environment right now (but should..) and from some local
> testing I forget if we need to pass further make logic in to have ld.lld
> be used instead.

To support both LTO and non-LTO cases, I pass:
LTO_FINAL_LDFLAGS=-fuse-ld=lld LD=ld.lld

Cheers,
Sam

  reply	other threads:[~2023-05-16 11:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 23:01 [PATCH 1/3] makefile: Fix symbol typo in binary_size_check Sam Edwards
2023-05-12 23:01 ` [PATCH 2/3] makefile: Consider "no relocs" to be "no unexpected relocs" Sam Edwards
2023-05-12 23:01 ` [PATCH 3/3] clang: Link with --no-pie instead of --apply-dynamic-relocs Sam Edwards
2023-05-14 15:28   ` Tom Rini
2023-05-16  2:08     ` Sam Edwards [this message]
2023-05-14 15:28 ` [PATCH 1/3] makefile: Fix symbol typo in binary_size_check Tom Rini

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=9eb1232a-fef8-3afd-5113-50ae2bcddfcc@gmail.com \
    --to=cfsworks@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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