public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Fangrui Song <maskray@google.com>
Cc: x86@kernel.org, Josh Poimboeuf <jpoimboe@kernel.org>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] x86/speculation, objtool: Use absolute relocations for annotations
Date: Thu, 21 Sep 2023 09:26:55 +0200	[thread overview]
Message-ID: <20230921072655.GA14803@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20230920001728.1439947-1-maskray@google.com>

On Tue, Sep 19, 2023 at 05:17:28PM -0700, Fangrui Song wrote:
> .discard.retpoline_safe sections do not have the SHF_ALLOC flag.  These
> sections referencing text sections' STT_SECTION symbols with PC-relative
> relocations like R_386_PC32 [0] is conceptually not suitable.  Newer
> LLD will report warnings for REL relocations even for relocatable links
> [1].
> 
>     ld.lld: warning: vmlinux.a(drivers/i2c/busses/i2c-i801.o):(.discard.retpoline_safe+0x120): has non-ABS relocation R_386_PC32 against symbol ''

What, why ?!? Please explain more.

> Switch to absolute relocations instead, which indicate link-time
> addresses.  In a relocatable link, these addresses are also output
> section offsets, used by checks in tools/objtool/check.c.  When linking
> vmlinux, these .discard.* sections will be discarded, therefore it is
> not a problem that R_X86_64_32 cannot represent a kernel address.
> 
> Alternatively, we could set the SHF_ALLOC flag for .discard.* sections,
> but I think non-SHF_ALLOC for sections to be discarded makes more sense.
> 
> Note: if we decide to never support REL architectures (e.g. arm, i386),

We have explicit support for REL (as opposed to RELA) architectures, so
I don't think we can do that.


  parent reply	other threads:[~2023-09-21 21:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20  0:17 [PATCH] x86/speculation, objtool: Use absolute relocations for annotations Fangrui Song
2023-09-21  7:12 ` [tip: objtool/core] " tip-bot2 for Fangrui Song
2023-09-21  7:27   ` Peter Zijlstra
2023-09-21  8:03     ` Ingo Molnar
2023-09-21  7:26 ` Peter Zijlstra [this message]
2023-09-21  7:58   ` [PATCH] " Fangrui Song
2023-09-21 15:35     ` Peter Zijlstra
2023-09-21 16:26       ` Fangrui Song
2023-09-21 17:19         ` Peter Zijlstra
2023-09-21 17:36           ` Fangrui Song
2023-09-21 19:22             ` Peter Zijlstra
2023-09-21 19:31               ` Peter Zijlstra
2023-09-21 20:07               ` Fangrui Song
2023-09-21 20:18                 ` Peter Zijlstra
2023-09-22  9:51 ` [tip: objtool/core] " tip-bot2 for Fangrui Song

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=20230921072655.GA14803@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maskray@google.com \
    --cc=ndesaulniers@google.com \
    --cc=x86@kernel.org \
    /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