Re: [PATCH v5 02/10] objtool: Handle different entry size of rodata

From: Josh Poimboeuf
Date: Wed Dec 11 2024 - 13:37:27 EST


On Wed, Dec 11, 2024 at 11:11:28AM +0800, Tiezhu Yang wrote:
> unsigned int arch_reloc_size(struct reloc *reloc)
> {
> switch (reloc_type(reloc)) {
> case R_X86_64_32:
> case R_X86_64_PC32:
> case R_X86_64_PLT32:
> return 4;
> default:
> return 8;
> }

Looks good to me, you can add R_X86_64_32S as well.

> For ppc, like this:
>
> unsigned int arch_reloc_size(struct reloc *reloc)
> {
> switch (reloc_type(reloc)) {
> case R_PPC_REL32:
> case R_PPC64_REL32:
> return 4;
> default:
> return 8;
> }

Also:

R_PPC_ADDR32
R_PPC_UADDR32
R_PPC_PLT32
R_PPC_PLTREL32

And the ppc64 counterparts have the same values, so not necessary to add
them.

--
Josh