[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241127185303.q6okbtrkfdrlmcrn@jpoimboe>
Date: Wed, 27 Nov 2024 10:53:03 -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 v4 01/10] objtool: Handle various symbol types of rodata
On Wed, Nov 27, 2024 at 02:39:13PM +0800, Tiezhu Yang wrote:
> On 11/27/2024 08:52 AM, Josh Poimboeuf wrote:
> > On Tue, Nov 26, 2024 at 06:41:29PM +0800, Tiezhu Yang wrote:
> > > On 11/26/2024 02:44 PM, Josh Poimboeuf wrote:
> > > > On Fri, Nov 22, 2024 at 12:49:56PM +0800, Tiezhu Yang wrote:
> > > > > @@ -2094,12 +2095,19 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
> > > >
> > > > 'prev_offset' needs to be updated as well.
> > >
> > > I am not sure I understand your comment correctly, I can not see
> > > what should to do about 'prev_offset'.
> >
> > Further down the function there is
> >
> > prev_offset = reloc_offset(reloc);
> >
> > which needs to be changed to
> >
> > prev_offset = offset;
> >
> > as part of the patch.
>
> If I understand correctly, reloc_offset(reloc) is different with
> reloc->sym->offset + reloc_addend(reloc), tested on x86 and readelf
> shows that their values are different, reloc_offset(reloc) is the
> first column of .rela.rodata, reloc->sym->offset is the second to
> last column of .rela.rodata, reloc_addend(reloc) is the last column
> of .rela.rodata.
>
> If do the above change as you suggested, there will be some objtool
> warnings on x86. I think it should be:
>
> prev_offset = reloc_offset(reloc);
>
> rather than:
>
> prev_offset = offset;
>
> That is to say, no need to change "prev_offset".
> Could you please check it again, please let me know if I am wrong.
Sorry, I was confused by the fact there are two different meanings for
"offset": one for where the relocation is written, and one for the
symbol it refers to.
How about instead of 'offset', call it 'sym_offset'?
--
Josh
Powered by blists - more mailing lists