lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <450eb29d-f1ad-d9b3-4bb7-965ef5a45250@loongson.cn>
Date: Wed, 27 Nov 2024 14:59:45 +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 03/10] objtool: Handle different entry size of rodata



On 11/27/2024 08:57 AM, Josh Poimboeuf wrote:
> On Tue, Nov 26, 2024 at 09:22:22PM +0800, Tiezhu Yang wrote:
>>> OK, if I understand your comment correctly, this should be an
>>> arch-specific function defined in
>>> tools/objtool/arch/*/include/arch/elf.h, otherwise it also needs to
>>> check ehdr.e_machine
>>> in tools/objtool/include/objtool/elf.h.
>>
>> There are only macro definitions in
>> tools/objtool/arch/*/include/arch/elf.h,
>> so I think it is better to add reloc_size() in
>> tools/objtool/include/objtool/elf.h,
>> like this:
>>
>> static inline unsigned int reloc_size(struct elf *elf, struct reloc *reloc)
>> {
>>         if (elf->ehdr.e_machine == EM_X86_64) {
>>                 switch (reloc_type(reloc)) {
>>                 case R_X86_64_32:
>>                 case R_X86_64_PC32:
>>                         return 4;
>>                 case R_X86_64_64:
>>                 case R_X86_64_PC64:
>>                         return 8;
>>                 default:
>>                         ERROR("unknown X86_64 reloc type");
>>                 }
>>         } else if (elf->ehdr.e_machine == EM_LOONGARCH) {
>>                 switch (reloc_type(reloc)) {
>>                 case R_LARCH_32:
>>                 case R_LARCH_32_PCREL:
>>                         return 4;
>>                 case R_LARCH_64:
>>                 case R_LARCH_64_PCREL:
>>                         return 8;
>>                 default:
>>                         ERROR("unknown LoongArch reloc type");
>>                 }
>>         } else {
>>                 return 8;
>>         }
>> }
>
> How about tools/objtool/arch/loongarch/decode.c?  Then we don't need to
> check e_machine.

OK, makes sense, will do it.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ