Re: [PATCH v4 01/10] objtool: Handle various symbol types of rodata
From: Tiezhu Yang
Date: Wed Nov 27 2024 - 01:39:24 EST
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.
Thanks,
Tiezhu