All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
	Chen Zhongjin <chenzhongjin@huawei.com>,
	"jpoimboe@redhat.com" <jpoimboe@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"mbenes@suse.cz" <mbenes@suse.cz>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	Sathvika Vasireddy <sv@linux.ibm.com>,
	Sathvika Vasireddy <sv@linux.vnet.ibm.com>
Subject: Re: [RFC PATCH 4/4] objtool/powerpc: Add --mcount specific implementation
Date: Fri, 17 Jun 2022 19:34:48 +0530	[thread overview]
Message-ID: <1655474054.lvnbqfz64f.naveen@linux.ibm.com> (raw)
In-Reply-To: <d095fe9d-e713-def1-6096-540c0d0da298@csgroup.eu>

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

WARNING: multiple messages have this Message-ID (diff)
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
	Chen Zhongjin <chenzhongjin@huawei.com>,
	Sathvika Vasireddy <sv@linux.vnet.ibm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	Sathvika Vasireddy <sv@linux.ibm.com>,
	"jpoimboe@redhat.com" <jpoimboe@redhat.com>,
	"mbenes@suse.cz" <mbenes@suse.cz>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [RFC PATCH 4/4] objtool/powerpc: Add --mcount specific implementation
Date: Fri, 17 Jun 2022 19:34:48 +0530	[thread overview]
Message-ID: <1655474054.lvnbqfz64f.naveen@linux.ibm.com> (raw)
In-Reply-To: <d095fe9d-e713-def1-6096-540c0d0da298@csgroup.eu>

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

  reply	other threads:[~2022-06-17 14:05 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 17:55 [RFC PATCH 0/4] objtool: Enable and implement --mcount option on powerpc Sathvika Vasireddy
2022-05-23 17:55 ` Sathvika Vasireddy
2022-05-23 17:55 ` [RFC PATCH 1/4] objtool: Add --mnop as an option to --mcount Sathvika Vasireddy
2022-05-23 17:55   ` Sathvika Vasireddy
2022-05-24  8:54   ` Christophe Leroy
2022-05-24  8:54     ` Christophe Leroy
2022-05-24 10:15     ` Naveen N. Rao
2022-05-24 10:15       ` Naveen N. Rao
2022-05-24 10:20       ` Christophe Leroy
2022-05-24 10:20         ` Christophe Leroy
2022-05-24 10:31         ` Naveen N. Rao
2022-05-24 10:31           ` Naveen N. Rao
2022-05-25 11:36           ` Peter Zijlstra
2022-05-25 11:36             ` Peter Zijlstra
2022-05-26 11:51             ` Naveen N. Rao
2022-05-26 11:51               ` Naveen N. Rao
2022-05-23 17:55 ` [RFC PATCH 2/4] objtool: Enable objtool to run only on files with ftrace enabled Sathvika Vasireddy
2022-05-23 17:55   ` Sathvika Vasireddy
2022-05-24  8:57   ` Christophe Leroy
2022-05-24  8:57     ` Christophe Leroy
2022-05-24 10:53     ` Sathvika Vasireddy
2022-05-24 10:53       ` Sathvika Vasireddy
2022-05-24 13:28       ` Christophe Leroy
2022-05-24 13:28         ` Christophe Leroy
2022-05-23 17:55 ` [RFC PATCH 3/4] objtool/powerpc: Enable objtool to be built on ppc Sathvika Vasireddy
2022-05-23 17:55   ` Sathvika Vasireddy
2022-05-24  9:13   ` Christophe Leroy
2022-05-24  9:13     ` Christophe Leroy
2022-05-23 17:55 ` [RFC PATCH 4/4] objtool/powerpc: Add --mcount specific implementation Sathvika Vasireddy
2022-05-23 17:55   ` Sathvika Vasireddy
2022-05-24  9:35   ` Christophe Leroy
2022-05-24  9:35     ` Christophe Leroy
2022-05-24 11:00     ` Sathvika Vasireddy
2022-05-24 11:00       ` Sathvika Vasireddy
2022-05-24 13:33       ` Christophe Leroy
2022-05-24 13:33         ` Christophe Leroy
2022-05-25 17:27         ` Christophe Leroy
2022-05-31  6:20           ` Christophe Leroy
2022-05-31  6:20             ` Christophe Leroy
2022-06-16 13:34             ` Naveen N. Rao
2022-06-16 13:34               ` Naveen N. Rao
2022-06-16 13:40               ` Christophe Leroy
2022-06-16 13:40                 ` Christophe Leroy
2022-06-16 13:57                 ` Peter Zijlstra
2022-06-16 13:57                   ` Peter Zijlstra
2022-06-16 14:06                   ` Christophe Leroy
2022-06-16 14:06                     ` Christophe Leroy
2022-06-17 14:04                     ` Naveen N. Rao [this message]
2022-06-17 14:04                       ` Naveen N. Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1655474054.lvnbqfz64f.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=chenzhongjin@huawei.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sv@linux.ibm.com \
    --cc=sv@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.