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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241127005711.de2ml367dw32ncg3@jpoimboe>
Date: Tue, 26 Nov 2024 16:57:11 -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 03/10] objtool: Handle different entry size of rodata

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.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ