FROMLIST: 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. Bug: 145210207 Change-Id: I25b97a586f273b1b8d1f153b71e567136b0016ec Link: https://lore.kernel.org/lkml/20201211184633.3213045-11-samitolvanen@google.com/ Suggested-by: Bill Wendling <morbo@google.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user