summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
Diffstat (limited to 'xmake')
-rw-r--r--xmake/modules/core/tools/gcc.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 7cff1d48d..0c13552e9 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -306,20 +306,24 @@ end
-- make the link group flag
function nf_linkgroup(self, linkgroup, target)
- local flags = {}
+ local linkflags = {}
for _, lib in ipairs(linkgroup) do
- table.insert(flags, nf_link(self, lib))
+ table.insert(linkflags, nf_link(self, lib))
end
+ local flags = {}
if not target:is_plat("macosx", "windows", "mingw") then
+ local group = target:extraconf("linkgroups", linkgroup, "group")
+ if group then
+ table.join2(flags, "-Wl,--start-group", linkflags, "-Wl,--end-group")
+ end
local whole = target:extraconf("linkgroups", linkgroup, "whole")
if whole then
- table.insert(flags, 1, "-Wl,--whole-archive")
- table.insert(flags, "-Wl,--no-whole-archive")
- else
- table.insert(flags, 1, "-Wl,--start-group")
- table.insert(flags, "-Wl,--end-group")
+ table.join2(flags, "-Wl,--whole-archive", linkflags, "-Wl,--no-whole-archive")
end
end
+ if #flags == 0 then
+ flags = linkflags
+ end
return flags
end