objtool: Use target file class size instead of a compiled constant
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 14 Nov 2022 17:57:48 +0000 (23:27 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Nov 2022 08:00:16 +0000 (19:00 +1100)
commit86ea7f361537f825a699e86fdc9e49be19f128d1
tree522a15c0519d2abf2941ee9d48fe388959efa60b
parent0646c28b417b7fe307c9da72ca1c508e43b57dc0
objtool: Use target file class size instead of a compiled constant

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.

[Sathvika Vasireddy: Rename variable "size" to "addrsize" and function
"elf_class_size()" to "elf_class_addrsize()", and modify
create_mcount_loc_sections() function to follow reverse christmas tree
format to order local variable declarations.]

Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-11-sv@linux.ibm.com
tools/objtool/check.c
tools/objtool/elf.c
tools/objtool/include/objtool/elf.h