lkml.org 
[lkml]   [2022]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 4/4] objtool/powerpc: Add --mcount specific implementation
Christophe Leroy wrote:
>
>
> Le 16/06/2022 à 15:57, Peter Zijlstra a écrit :
>> On Thu, Jun 16, 2022 at 01:40:34PM +0000, Christophe Leroy wrote:
>>> sizeof(u64) is always 8 by definition.
>>>
>>> So if size is 8 we are working on a binary file for a 64 bits target, if
>>> not it means we are working for a 32 bits target.
>>
>> Cross-builds invalidate this I think. Best to look at something like:
>>
>> elf->ehdr.e_ident[EI_CLASS] == ELFCLASS32
>>
>>
>
> Yes that's what it does indirectly:
>
> int size = elf_class_size(elf);
>
>
> With
>
> static inline int elf_class_size(struct elf *elf)
> {
> if (elf->ehdr.e_ident[EI_CLASS] == ELFCLASS32)
> return sizeof(u32);
> else
> return sizeof(u64);
> }

Ok, those come from the below patch:
https://lore.kernel.org/all/c4b06b5b314183d85615765a5ce421a057674bd8.1653398233.git.christophe.leroy@csgroup.eu/T/#u

I guess it would have been clearer if 'size' was named differently:
'addr_size' perhaps?


- Naveen

\
 
 \ /
  Last update: 2022-06-17 16:07    [W:0.236 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site