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 21:22:53 +0200	[thread overview]
Message-ID: <20230921192253.GA39480@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAFP8O3JpkWTXnxYxa45uANNMQ34g2VUPnfj7-oWn3oq9egUb-A@mail.gmail.com>

On Thu, Sep 21, 2023 at 10:36:27AM -0700, Fangrui Song wrote:

> Well, only if the clever assembler doesn't support 32-bit absolute
> relocation for a 64-bit architecture.
> I don't know such an architecture. In addition, as long as the
> architecture intends to support DWARF32, it has to support 32-bit
> absolute relocations for a 64-bit architecture.

Ooh... my bad. For some reason I thought that absolute meant native word
size. But you already mentioned R_X86_64_32 (and I failed to check) and
that is indeed an absolute (S+A) relocation of 32bit (dword) size.

And apparently we also have R_X64_64_16 and R_X86_64_8, which would even
allow something like:

#define OBJTOOL_ANNOTATE(type)				\
	"999:\n\t"					\
	".pushsection .discard.objtool_annotate\n\t"	\
	".byte 999b\n\t"				\
	".byte " __stringify(type) "\n\t"		\
	".popsection\n\t"

And since we only read the relocation and don't care for the actual
result that would actually work just fine.

Anyway, thanks for bearing with me.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

  reply	other threads:[~2023-09-21 19:55 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 ` [PATCH] " Peter Zijlstra
2023-09-21  7:58   ` 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 [this message]
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=20230921192253.GA39480@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