[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75f6e90b-4d04-5627-395e-58982a84d7c1@loongson.cn>
Date: Tue, 26 Nov 2024 18:41:29 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Josh Poimboeuf <jpoimboe@...nel.org>
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 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,
>> if (prev_offset && reloc_offset(reloc) != prev_offset + 8)
>> break;
>>
>> + if (reloc->sym->type == STT_SECTION) {
>> + /* Addend field in the relocation entry associated with the symbol */
>> + offset = reloc_addend(reloc);
>> + } else {
>> + /* The address of the symbol in the relocation entry */
>> + offset = reloc->sym->offset;
>
> The comments don't seem helpful.
Will remove it.
>
> In the case of STT_SECTION, sym->offset is always zero. Therefore the
> if-else can be converted to a simple unconditional statement:
>
> offset = reloc->sym->offset + reloc_addend(reloc);
OK, let me test it.
>
> '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'.
>
>> @@ -2137,6 +2145,7 @@ static struct reloc *find_jump_table(struct objtool_file *file,
>> {
>> struct reloc *table_reloc;
>> struct instruction *dest_insn, *orig_insn = insn;
>> + unsigned long offset;
>>
>> /*
>> * Backward search using the @first_jump_src links, these help avoid
>> @@ -2160,7 +2169,16 @@ static struct reloc *find_jump_table(struct objtool_file *file,
>> table_reloc = arch_find_switch_table(file, insn);
>> if (!table_reloc)
>> continue;
>> - dest_insn = find_insn(file, table_reloc->sym->sec, reloc_addend(table_reloc));
>> +
>> + if (table_reloc->sym->type == STT_SECTION) {
>> + /* Addend field in the relocation entry associated with the symbol */
>> + offset = reloc_addend(table_reloc);
>> + } else {
>> + /* The address of the symbol in the relocation entry */
>> + offset = table_reloc->sym->offset;
>> + }
>
> Same comment here.
OK, will do it.
Thanks,
Tiezhu
Powered by blists - more mailing lists