summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-18 21:31:40 +0800
committerGitHub <[email protected]>2024-09-18 21:31:40 +0800
commit3693321efa174749eb3c255a4ded0d78f8fb4aac (patch)
tree88d4f6acab45783c5887978d214a5df14cbab4d4
parenteec1d907ee7f667b924d72231c7fc8fec4b6e439 (diff)
Update gcc.lua
-rw-r--r--xmake/modules/core/tools/gcc.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 668e279ee..c04d06e8a 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -368,8 +368,11 @@ function nf_linkgroup(self, linkgroup, opt)
table.insert(prefix_flags, "-Wl,-Bstatic")
table.insert(suffix_flags, 1, "-Wl,-Bdynamic")
end
- if not as_needed then
- -- https://github.com/xmake-io/xmake/issues/5621
+ -- https://github.com/xmake-io/xmake/issues/5621
+ if as_needed then
+ table.insert(prefix_flags, "-Wl,--as-needed")
+ table.insert(suffix_flags, 1, "-Wl,--no-as-needed")
+ elseif as_needed == false then
table.insert(prefix_flags, "-Wl,--no-as-needed")
table.insert(suffix_flags, 1, "-Wl,--as-needed")
end