lkml.org 
[lkml]   [2022]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 10/16] objtool: Use target file class size instead of a compiled constant
On Mon, Aug 29, 2022 at 11:22:17AM +0530, Sathvika Vasireddy wrote:
> From: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> In order to allow using objtool on cross-built kernels,
> determine size of long from elf data instead of using
> sizeof(long) at build time.
>
> For the time being this covers only mcount.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
> tools/objtool/check.c | 16 +++++++++-------
> tools/objtool/elf.c | 8 ++++++--
> tools/objtool/include/objtool/elf.h | 8 ++++++++
> 3 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index a948b2551520..0ecf41ee73f0 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -851,9 +851,9 @@ static int create_ibt_endbr_seal_sections(struct objtool_file *file)
> static int create_mcount_loc_sections(struct objtool_file *file)
> {
> struct section *sec;
> - unsigned long *loc;
> struct instruction *insn;
> int idx;
> + int addrsize = elf_class_addrsize(file->elf);

If there is a respin, please make this a reverse-x-mas-tree thingy.

>
> sec = find_section_by_name(file->elf, "__mcount_loc");
> if (sec) {
> @@ -869,23 +869,25 @@ static int create_mcount_loc_sections(struct objtool_file *file)

> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -1124,6 +1124,7 @@ static struct section *elf_create_rela_reloc_section(struct elf *elf, struct sec
> {
> char *relocname;
> struct section *sec;
> + int addrsize = elf_class_addrsize(elf);
>

idem.

\
 
 \ /
  Last update: 2022-09-01 21:25    [W:0.522 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site