kpatch/kpatch-build
Song Liu c608fafd72 Fix sympos for gcc-14
When building a livepatch, we assume symbols from "readelf -s" is the
same as the order observed in kallsyms. We calculate sympos of a symbol
based on this order (readelf -s). However, with gcc-14, "readelf -s"
may present the symbols in a different order. For example:

With gcc 13:

32951: ffff8000802edf20   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
33497: ffff8000802fb798   236 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
47034: ffff80008044b250   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
51466: ffff8000804be260   236 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
51483: ffff8000804bf6a8   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
52287: ffff8000804cb098   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
54066: ffff800080518e38   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
58217: ffff800080575bb0   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
72912: ffff8000806c5dc0   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
73719: ffff8000806eccd0   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0

With gcc 14:

 9557: ffff800080312f28   236 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
16599: ffff8000806eb060   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
17305: ffff800080711d30   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
63960: ffff800080305540   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
74577: ffff800080466030   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
78568: ffff8000804dc3e0   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
79372: ffff8000804e81c0   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
81016: ffff800080537380   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0
84685: ffff800080595428   172 FUNC    LOCAL  DEFAULT    2 zero_user_segments.constprop.0

Fix this by calculating sympos in another for_each_obj_symbol loop.

Signed-off-by: Song Liu <song@kernel.org>
2025-03-03 15:35:51 -08:00
..
gcc-plugins gcc-plugin: update gcc-common.h for gcc-13 2023-03-16 22:05:43 -07:00
insn insn: get it to compile in create-diff-object 2014-05-30 15:19:57 -05:00
create-diff-object.c use dynamic prefix offset instead of hardcoding 2024-12-11 21:55:01 +00:00
create-klp-module.c create-diff-object: rename "dynrela" -> "klp_reloc" 2022-12-01 14:00:09 -08:00
create-kpatch-module.c kpatch-build: add missing include for musl 2025-01-21 19:57:39 +01:00
kpatch-build Merge pull request #1418 from joe-lawrence/shellcheck-oct-2024 2024-10-10 17:33:06 -04:00
kpatch-cc kpatch-build: ignore init/version-timestamp.o 2023-01-16 09:33:55 -05:00
kpatch-elf.c use dynamic prefix offset instead of hardcoding 2024-12-11 21:55:01 +00:00
kpatch-elf.h create-diff-object: Create __patchable_function_entries sections 2024-12-03 09:26:10 -05:00
kpatch-intermediate.h lookup: rename 'pos' to 'sympos' 2020-04-06 15:18:58 -05:00
kpatch.h kpatch-build: add exit status enum 2018-06-15 07:11:48 -04:00
list.h Fix undefined behavior problem when using list_foreach_entry 2023-08-10 00:22:53 +00:00
log.h create-diff-object: use errx() instead of err() 2022-11-30 12:58:31 -08:00
lookup.c Fix sympos for gcc-14 2025-03-03 15:35:51 -08:00
lookup.h Switch to per-file lookup table pointers. 2021-08-17 09:37:44 +02:00
Makefile Merge pull request #1420 from georgejguo/master 2024-10-23 12:44:10 -04:00