diff options
| author | ruki <[email protected]> | 2023-09-28 22:56:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-28 22:56:17 +0800 |
| commit | 2aa8a4a793f3a7281487d6bc8334f975fa6bd26d (patch) | |
| tree | b9ecd6a5d7bfab13cf702b97a8a14c4164f2dc66 /xmake/modules/core/tools/gcc.lua | |
| parent | 6ffb48dd54c6d2d4e6168fac56943481d58e29c4 (diff) | |
add whole groups
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 93525848f..864e894e5 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -304,6 +304,25 @@ function nf_syslink(self, lib) return nf_link(self, lib) end +-- make the link group flag +function nf_linkgroups(self, libs, target) + local flags = {} + for _, lib in ipairs(libs) do + table.insert(flags, nf_link(self, lib)) + end + if not target:is_plat("macosx", "windows", "mingw") then + local whole = target:extraconf("linkgroups", libs, "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") + end + end + return {flags} +end + -- make the linkdir flag function nf_linkdir(self, dir) return {"-L" .. path.translate(dir)} |
