2 Commits

Author SHA1 Message Date
Nathan Chancellor
e6f64a043b ANDROID: generate_initcall_order.pl: Use two dash long options for llvm-nm
Commit 96e9bc424475 ("[llvm-nm] Remove one-dash long options except
-arch") in LLVM removed the one dash long options, which causes this
script to fail and initcalls not to get ordered properly, which
manifests as kernels crashing durin boot.

Use the two dash long options as the LLVM commit mentions that the
documentation and help text have always shown them over the one dash
long versions. This is not an issue with the mainline LTO series as it
used two dash long options.

Change-Id: Iaef9f96af1d75b54eabc4bba38d2a3a58c3c2209
Fixes: 93185a9155 ("ANDROID: init: ensure initcall ordering with LTO")
Link: 96e9bc4244
Link: https://github.com/ClangBuiltLinux/continuous-integration2/runs/3129736977?check_suite_focus=true
Link: https://github.com/ClangBuiltLinux/continuous-integration2/runs/3129775494?check_suite_focus=true
Link: https://github.com/ClangBuiltLinux/continuous-integration2/runs/3129863440?check_suite_focus=true
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2021-07-21 20:39:33 -07:00
Sami Tolvanen
93185a9155 ANDROID: init: ensure initcall ordering with LTO
With LTO, the compiler doesn't necessarily obey link order for
initcalls, and the initcall variable needs to be globally unique
to avoid naming collisions.

In order to preserve the correct order, we add each variable
into its own section and generate a linker script (in
scripts/link-vmlinux.sh) to ensure the order remains correct.  We
also add a __COUNTER__ prefix to the name, so we can retain the
order of initcalls within each compilation unit, and __LINE__ to
make the names more unique.

Bug: 145210207
Change-Id: Iddda881a52b7942781713b188d810b6100159a2b
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2019-11-27 12:37:20 -08:00