diff options
| author | ruki <[email protected]> | 2022-01-01 16:41:02 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-01 16:41:02 +0800 |
| commit | 9c4ea3fea86df68671b49b05e0dfabef99330db3 (patch) | |
| tree | 72d3a1074c8d6d056baab5cf1bccaf2bd48a218d | |
| parent | a1e6b5f22318f8384d0710484706f804abce9c79 (diff) | |
Update driver_modules.lua
| -rw-r--r-- | xmake/rules/platform/linux/driver/driver_modules.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xmake/rules/platform/linux/driver/driver_modules.lua b/xmake/rules/platform/linux/driver/driver_modules.lua index f5e5ecc69..a8e4636aa 100644 --- a/xmake/rules/platform/linux/driver/driver_modules.lua +++ b/xmake/rules/platform/linux/driver/driver_modules.lua @@ -157,11 +157,13 @@ module_exit(hello_exit); local ldflags = line:match("%-ld (.+) %-o ") or line:match("ld (.+) %-o ") if ldflags then local ko = ldflags:find("-T ", 1, true) - for _, ldflag in ipairs(ldflags:split("%s+")) do - if ko then - if ldflag:startswith("--build-id=") or ldflag:startswith("-T ") then - break + for _, ldflag in ipairs(os.argv(ldflags)) do + if ldflag:endswith(".lds") then + if not path.is_absolute(ldflag) then + ldflag = path.absolute(ldflag, sdkdir) end + end + if ko then -- e.g. aarch64-linux-gnu-ld -r -EL -maarch64elf --build-id=sha1 -T scripts/module.lds -o hello.ko hello.o hello.mod.o ldflags_ko = ldflags_ko or {} table.insert(ldflags_ko, ldflag) @@ -268,14 +270,12 @@ function link(target, opt) progress.show(opt.progress, "${color.build.object}linking.$(mode) %s", targetfile) -- get module scripts - local modpost, ldscriptfile + local modpost local linux_headers = target:data("linux.driver.linux_headers") if linux_headers then modpost = path.join(linux_headers.sdkdir, "scripts", "mod", "modpost") - ldscriptfile = path.join(linux_headers.sdkdir, "scripts", "module.lds") end assert(modpost and os.isfile(modpost), "scripts/mod/modpost not found!") - assert(ldscriptfile and os.isfile(ldscriptfile), "scripts/module.lds not found!") -- get ld local ld = target:tool("ld") @@ -331,7 +331,7 @@ function link(target, opt) table.join2(argv, ldflags_ko) end local targetfile_o = target:objectfile(targetfile) - table.join2(argv, "--build-id=sha1", "-T", ldscriptfile, "-o", targetfile, targetfile_o, targetfile_mod_o) + table.join2(argv, "-o", targetfile, targetfile_o, targetfile_mod_o) os.mkdir(path.directory(targetfile)) os.vrunv(ld, argv) |
