[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241209203544.axetpzva7vg3hsc5@jpoimboe>
Date: Mon, 9 Dec 2024 12:35:44 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Huacai Chen <chenhuacai@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 03/10] objtool: Handle PC relative relocation type
On Sat, Dec 07, 2024 at 09:59:08AM +0800, Tiezhu Yang wrote:
> +unsigned long arch_adjust_offset(struct reloc *reloc, struct reloc *table)
> +{
> + switch (reloc_type(reloc)) {
> + case R_LARCH_32_PCREL:
> + case R_LARCH_64_PCREL:
> + if (reloc->sym->type == STT_SECTION)
> + return reloc->sym->offset + reloc_addend(reloc) -
> + (reloc_offset(reloc) - reloc_offset(table));
How does this even work? i.e., why does the reloc offset (basically the
jump table index) have anything to do with calculating the location of
the instruction it's referencing?
> + else
> + return reloc->sym->offset;
This also seems odd. Why is the addend being ignored? Shouldn't it
point to the instruction's offset?
--
Josh
Powered by blists - more mailing lists