summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/link.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-22 22:38:54 +0800
committerruki <[email protected]>2021-02-22 22:38:54 +0800
commit3a579c246f983da7a91bc870a8395a6227ac93c7 (patch)
tree11b74074a26f86e4e6ee20c8fbbe53f48e8a5d20 /xmake/modules/core/tools/link.lua
parentf78a823f3cc8f1b1d71bbd8882a1881c99834aa6 (diff)
add manifest rule
Diffstat (limited to 'xmake/modules/core/tools/link.lua')
-rw-r--r--xmake/modules/core/tools/link.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index 9a70de9ce..3994bbab4 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -58,16 +58,19 @@ function get(self, name)
end
-- make the strip flag
-function nf_strip(self, level)
+function nf_strip(self, level, target)
-- @note we explicitly strip some useless code, because `/debug` may keep them
-- @see https://github.com/xmake-io/xmake/issues/907
- --
- local maps =
- {
- debug = "/opt:ref /opt:icf"
- , all = "/opt:ref /opt:icf /ltcg" -- we enable /ltcg for optimize/smallest:/Gl
- }
- return maps[level]
+ if level == "all" then
+ -- we enable /ltcg for optimize/smallest:/Gl
+ local flags = {"/opt:ref", "/opt:icf"}
+ if target and target:get("optimize") == "smallest" then
+ table.insert(flags, "/ltcg")
+ end
+ return flags
+ elseif level == "debug" then
+ return {"/opt:ref", "/opt:icf"}
+ end
end
-- make the symbol flag