Skip to content

Commit e99332e

Browse files
committed
gcc-10: mark more functions __init to avoid section mismatch warnings
It seems that for whatever reason, gcc-10 ends up not inlining a couple of functions that used to be inlined before. Even if they only have one single callsite - it looks like gcc may have decided that the code was unlikely, and not worth inlining. The code generation difference is harmless, but caused a few new section mismatch errors, since the (now no longer inlined) function wasn't in the __init section, but called other init functions: Section mismatch in reference from the function kexec_free_initrd() to the function .init.text:free_initrd_mem() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memremap() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap() So add the appropriate __init annotation to make modpost not complain. In both cases there were trivially just a single callsite from another __init function. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2e28f3b commit e99332e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/firmware/efi/tpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
int efi_tpm_final_log_size;
1717
EXPORT_SYMBOL(efi_tpm_final_log_size);
1818

19-
static int tpm2_calc_event_log_size(void *data, int count, void *size_info)
19+
static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info)
2020
{
2121
struct tcg_pcr_event2_head *header;
2222
int event_size, size = 0;

init/initramfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end)
542542
}
543543

544544
#ifdef CONFIG_KEXEC_CORE
545-
static bool kexec_free_initrd(void)
545+
static bool __init kexec_free_initrd(void)
546546
{
547547
unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
548548
unsigned long crashk_end = (unsigned long)__va(crashk_res.end);

0 commit comments

Comments
 (0)