diff options
| author | ruki <[email protected]> | 2026-04-24 18:09:39 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-24 18:09:39 +0800 |
| commit | cdcdab32d46df50ebd30efcacf0e3209b411cde2 (patch) | |
| tree | e12e0d9766ed68f6df68d43350f8fade46624a85 | |
| parent | d38704f9fbaa1e80d609817c3e2bc18ac985e341 (diff) | |
| parent | bb1374cf5a353a151c233cb7568d6d5c5de4519d (diff) | |
Merge pull request #7501 from ririyeye/fix/5721-linux-module-modpost
fix linux module intermediate filenames
| -rw-r--r-- | xmake/rules/platform/linux/module/driver_modules.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmake/rules/platform/linux/module/driver_modules.lua b/xmake/rules/platform/linux/module/driver_modules.lua index 0e23a0100..5c9d833a5 100644 --- a/xmake/rules/platform/linux/module/driver_modules.lua +++ b/xmake/rules/platform/linux/module/driver_modules.lua @@ -361,14 +361,15 @@ function link(target, opt) if ldflags_o then table.join2(argv, ldflags_o) end - local targetfile_o = target:objectfile(targetfile) + local targetfile_base = path.join(path.directory(target:objectfile(targetfile)), target:basename()) + local targetfile_o = targetfile_base .. ".o" table.join2(argv, "-o", targetfile_o) table.join2(argv, objectfiles) os.mkdir(path.directory(targetfile_o)) os.vrunv(ld, argv) -- generate target.mod - local targetfile_mod = targetfile_o:gsub("%.o$", ".mod") + local targetfile_mod = targetfile_base .. ".mod" io.writefile(targetfile_mod, table.concat(objectfiles, "\n") .. "\n\n") -- generate .sourcename.o.cmd @@ -399,8 +400,8 @@ function link(target, opt) os.vrunv(modpost, argv) -- compile target.mod.c - local targetfile_mod_c = targetfile_o:gsub("%.o$", ".mod.c") - local targetfile_mod_o = targetfile_o:gsub("%.o$", ".mod.o") + local targetfile_mod_c = targetfile_base .. ".mod.c" + local targetfile_mod_o = targetfile_base .. ".mod.o" local compinst = target:compiler("cc") target:fileconfig_set(targetfile_mod_c, {defines = "KBUILD_BASENAME=\"" .. path.basename(targetfile_mod_c) .. "\""}) if option.get("verbose") then @@ -425,7 +426,6 @@ function link(target, opt) if ldflags_ko then table.join2(argv, ldflags_ko) end - local targetfile_o = target:objectfile(targetfile) table.join2(argv, "-o", targetfile, targetfile_o, targetfile_mod_o) if modulecommon_objectfile then table.insert(argv, modulecommon_objectfile) |
