mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v1 4/6] objtool/LoongArch: Enable orc to be built
Date: Tue, 25 Jul 2023 13:56:09 +0200	[thread overview]
Message-ID: <20230725115609.GD3765278@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1690272910-11869-5-git-send-email-yangtiezhu@loongson.cn>

On Tue, Jul 25, 2023 at 04:15:08PM +0800, Tiezhu Yang wrote:

> +void arch_write_orc(struct elf *elf, struct orc_entry *orc)
> +{
> +	orc->ra_offset = bswap_if_needed(elf, orc->ra_offset);
> +}

This hardly 'writes' anything, all it does is a bswap.

> diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
> index 1eff7e0a..6975056 100644
> --- a/tools/objtool/orc_gen.c
> +++ b/tools/objtool/orc_gen.c
> @@ -14,6 +14,8 @@
>  #include <objtool/warn.h>
>  #include <objtool/endianness.h>
>  
> +void __weak arch_write_orc(struct elf *elf, struct orc_entry *orc) {}

And for that you need a weak function? What's wrong with an inline if
anything?

>  static int write_orc_entry(struct elf *elf, struct section *orc_sec,
>  			   struct section *ip_sec, unsigned int idx,
>  			   struct section *insn_sec, unsigned long insn_off,
> @@ -26,6 +28,7 @@ static int write_orc_entry(struct elf *elf, struct section *orc_sec,
>  	memcpy(orc, o, sizeof(*orc));
>  	orc->sp_offset = bswap_if_needed(elf, orc->sp_offset);
>  	orc->bp_offset = bswap_if_needed(elf, orc->bp_offset);
> +	arch_write_orc(elf, orc);

Why can't this simply be:

	orc->ra_offset = bswap_if_needed(elf, orc->ra_offset);

AFAICT this won't actually do anything for x86 and I don't think Power
got around to doing ORC yet.

>  
>  	/* populate reloc for ip */
>  	if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx,

Again, not much explaination for why you did things

  parent reply	other threads:[~2023-07-25 11:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  8:15 [PATCH v1 0/6] Add objtool and orc support for LoongArch Tiezhu Yang
2023-07-25  8:15 ` [PATCH v1 1/6] objtool/LoongArch: Enable objtool to be built Tiezhu Yang
2023-07-25  8:15 ` [PATCH v1 2/6] objtool/LoongArch: Implement instruction decoder Tiezhu Yang
2023-07-25  8:15 ` [PATCH v1 3/6] objtool/x86: Separate arch-specific and generic parts Tiezhu Yang
2023-07-25  8:15 ` [PATCH v1 4/6] objtool/LoongArch: Enable orc to be built Tiezhu Yang
2023-07-25 11:51   ` Peter Zijlstra
2023-07-27 10:58     ` Tiezhu Yang
2023-07-25 11:56   ` Peter Zijlstra [this message]
2023-07-28  1:31     ` Tiezhu Yang
2023-07-25  8:15 ` [PATCH v1 5/6] objtool: Add skipped member in struct reloc Tiezhu Yang
2023-07-25 11:59   ` Peter Zijlstra
2023-08-03 11:36     ` Tiezhu Yang
2023-08-03 12:11       ` Peter Zijlstra
2023-08-09 11:51         ` Xi Ruoyao
2023-08-09 11:58           ` Xi Ruoyao
2023-07-25  8:15 ` [PATCH v1 6/6] LoongArch: Add ORC unwinder support Tiezhu Yang
2023-07-25 12:01 ` [PATCH v1 0/6] Add objtool and orc support for LoongArch Peter Zijlstra
2023-08-09  9:55   ` Tiezhu Yang

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=20230725115609.GD3765278@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chenhuacai@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=yangtiezhu@loongson.cn \
    /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

all inboxes | Powered by JetHome®