Skip to content

Commit

Permalink
improve link group and whole #4308
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 22, 2023
1 parent b83134f commit 788d4e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xmake/modules/core/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 788d4e5

Please sign in to comment.