diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh index da320151e7c3..4e3360c6e5ea 100755 --- a/scripts/gen_autoksyms.sh +++ b/scripts/gen_autoksyms.sh @@ -36,7 +36,28 @@ if [ -n "$CONFIG_LTO_CLANG" ]; then needed_symbols="$needed_symbols _mcount" # stack protector symbols needed_symbols="$needed_symbols __stack_chk_fail __stack_chk_guard" -fi + if [ -n "CONFIG_LD_DEAD_CODE_DATA_ELIMINATION" ] && [ -n "CONFIG_TRIM_UNUSED_KSYMS" ]; then + # ex_handler_XXX symbols + needed_symbols="$needed_symbols ex_handler_uaccess ex_handler_clear_fs ex_handler_fprestore ex_handler_rdmsr_unsafe ex_handler_wrmsr_unsafe" + # __fentry__ symbol + needed_symbols="$needed_symbols __fentry__" + # __get_user_XXX and __put_user_XXX symbols + needed_symbols="$needed_symbols __get_user_1 __get_user_2 __get_user_4 __get_user_8" + needed_symbols="$needed_symbols __put_user_1 __put_user_2 __put_user_4 __put_user_8" + needed_symbols="$needed_symbols __get_user_nocheck_1 __get_user_nocheck_2 __get_user_nocheck_4 __get_user_nocheck_8" + needed_symbols="$needed_symbols __put_user_nocheck_1 __put_user_nocheck_2 __put_user_nocheck_4 __put_user_nocheck_8" + # __sw_hweight32 and __sw_hweight64 symbols + needed_symbols="$needed_symbols __sw_hweight32 __sw_hweight64" + # __x86_indirect_thunk_r11 symbol + needed_symbols="$needed_symbols __x86_indirect_thunk_r11" + # __x86_retpoline_rax and __x86_retpoline_rsi symbols + needed_symbols="$needed_symbols __x86_retpoline_rax __x86_retpoline_rsi" + fi # CONFIG_LD_DEAD_CODE_DATA_ELIMINATION && CONFIG_TRIM_UNUSED_KSYMS + if [ -n "$CONFIG_CFI_CLANG" ]; then + # __ubsan_handle_cfi_check_fail_abort symbol + needed_symbols="$needed_symbols __ubsan_handle_cfi_check_fail_abort" + fi # CONFIG_CFI_CLANG +fi # CONFIG_LTO_CLANG ksym_wl= if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then