Skip to content

Commit 8037598

Browse files
joemarioH. Peter Anvin
authored andcommitted
lto: Handle LTO common symbols in module loader
Here is the workaround I made for having the kernel not reject modules built with -flto. The clean solution would be to get the compiler to not emit the symbol. Or if it has to emit the symbol, then emit it as initialized data but put it into a comdat/linkonce section. Minor tweaks by AK over Joe's patch. Cc: Rusty Russell <[email protected]> Signed-off-by: Andi Kleen <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: H. Peter Anvin <[email protected]>
1 parent ef1b893 commit 8037598

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,10 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
19481948

19491949
switch (sym[i].st_shndx) {
19501950
case SHN_COMMON:
1951+
/* Ignore common symbols */
1952+
if (!strncmp(name, "__gnu_lto", 9))
1953+
break;
1954+
19511955
/* We compiled with -fno-common. These are not
19521956
supposed to happen. */
19531957
pr_debug("Common symbol: %s\n", name);

0 commit comments

Comments
 (0)