diff options
| author | ruki <[email protected]> | 2023-10-22 18:50:28 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-10-22 18:50:28 +0800 |
| commit | 788d4e5929e89c3d0faaee311d3aa8b60bbb419a (patch) | |
| tree | af09b63e42cdc6dec579e1ca0139cea1d66d160c /xmake/modules/core/tools | |
| parent | b83134f6e6b6ec08c8fa82d1f70b161cb9f7df95 (diff) | |
improve link group and whole #4308
Diffstat (limited to 'xmake/modules/core/tools')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 6ccf50266..c0b2acf46 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -313,11 +313,13 @@ function nf_linkgroup(self, linkgroup, target) local flags = {} if not self: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 + if group and whole then + -- https://github.com/xmake-io/xmake/issues/4308 + table.join2(flags, "-Wl,--whole-archive", "-Wl,--start-group", linkflags, "-Wl,--end-group", "-Wl,--no-whole-archive") + elseif group then + table.join2(flags, "-Wl,--start-group", linkflags, "-Wl,--end-group") + elseif whole then table.join2(flags, "-Wl,--whole-archive", linkflags, "-Wl,--no-whole-archive") end local static = target:extraconf("linkgroups", linkgroup, "static") |
