diff options
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 7 |
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 |
