diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2020-12-11 10:46:27 -0800 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2021-01-14 08:21:09 -0800 |
commit | 7ac204b545f263c7595a8b5ec3797ae9f9954f82 (patch) | |
tree | 30f8fa6ccf3da68844968f83751dd7f2a7a1ff66 /scripts/mod/sumversion.c | |
parent | 09a4e4d9c52a3c5e39e4f409b2c083ab13c6afc2 (diff) | |
download | linux-stable-7ac204b545f263c7595a8b5ec3797ae9f9954f82.tar.gz linux-stable-7ac204b545f263c7595a8b5ec3797ae9f9954f82.tar.bz2 linux-stable-7ac204b545f263c7595a8b5ec3797ae9f9954f82.zip |
modpost: lto: strip .lto from module names
With LTO, everything is compiled into LLVM bitcode, so we have to link
each module into native code before modpost. Kbuild uses the .lto.o
suffix for these files, which also ends up in module information. This
change strips the unnecessary .lto suffix from the module name.
Suggested-by: Bill Wendling <morbo@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20201211184633.3213045-11-samitolvanen@google.com
Diffstat (limited to 'scripts/mod/sumversion.c')
-rw-r--r-- | scripts/mod/sumversion.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index d587f40f1117..760e6baa7eda 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -391,10 +391,14 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) struct md4_ctx md; char *fname; char filelist[PATH_MAX + 1]; + int postfix_len = 1; + + if (strends(modname, ".lto.o")) + postfix_len = 5; /* objects for a module are listed in the first line of *.mod file. */ snprintf(filelist, sizeof(filelist), "%.*smod", - (int)strlen(modname) - 1, modname); + (int)strlen(modname) - postfix_len, modname); buf = read_text_file(filelist); |