summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-21 20:16:56 +0800
committerruki <[email protected]>2024-09-21 20:16:56 +0800
commit2c2b0f08e4f4f3b65a153f06d49f4728c3f77615 (patch)
tree4b1ca2a0771ce1d17a807e43b930cfa991d027b4
parent9563841bfc304874cc9d308b1e29bd6cde76631a (diff)
add special language linker flags for package
-rw-r--r--xmake/core/tool/builder.lua11
-rw-r--r--xmake/core/tool/linker.lua2
2 files changed, 11 insertions, 2 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 54652326d..2bf4efc1f 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -222,8 +222,17 @@ end
-- add flags from the target packages
function builder:_add_flags_from_targetpkgs(flags, target)
+ local kind = self:kind()
for _, flagkind in ipairs(self:_flagkinds()) do
- local result = target:get_from(flagkind, "package::*")
+ -- attempt to add special lanugage flags from package first, e.g. gcldflags, dcarflags
+ -- @see https://github.com/xmake-io/xmake-repo/issues/5255
+ local result
+ if kind:endswith("ld") or kind:endswith("sh") then
+ result = target:get_from(kind .. "flags", "package::*")
+ end
+ if not result then
+ result = target:get_from(flagkind, "package::*")
+ end
if result then
for _, values in ipairs(table.wrap(result)) do
table.join2(flags, self:_mapflags(values, flagkind, target))
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index 070c90a9f..2094d40a5 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -63,7 +63,7 @@ function linker:_add_flags_from_linker(flags)
local toolkind = self:kind()
for _, flagkind in ipairs(self:_flagkinds()) do
-- attempt to add special lanugage flags first, e.g. gcldflags, dcarflags
- table.join2(flags, self:get(toolkind .. 'flags') or self:get(flagkind))
+ table.join2(flags, self:get(toolkind .. "flags") or self:get(flagkind))
end
end