diff options
| author | ruki <[email protected]> | 2023-09-30 15:21:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-30 15:21:45 +0800 |
| commit | 874bbc55860ab798072f7dba9a53fd6e3895c6f9 (patch) | |
| tree | 0e41b7a86f35a24e32e6d8d95cbd2a94c53d7ccb | |
| parent | c19eb9cdad616568851a9e9f9e31832938cae8ed (diff) | |
add -Bstatic for linkgroup
| -rw-r--r-- | tests/projects/c++/linkorders/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/tests/projects/c++/linkorders/xmake.lua b/tests/projects/c++/linkorders/xmake.lua index 755e75f51..80c0300d7 100644 --- a/tests/projects/c++/linkorders/xmake.lua +++ b/tests/projects/c++/linkorders/xmake.lua @@ -6,6 +6,7 @@ target("bar") set_kind("shared") add_files("src/foo.cpp") add_linkgroups("m", "pthread", {whole = true}) + add_linkgroups("dl", {static = true}) target("foo") set_kind("static") diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 0c13552e9..f87eb24ea 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -320,6 +320,10 @@ function nf_linkgroup(self, linkgroup, target) if whole then table.join2(flags, "-Wl,--whole-archive", linkflags, "-Wl,--no-whole-archive") end + local static = target:extraconf("linkgroups", linkgroup, "static") + if static then + table.join2(flags, "-Wl,-Bstatic", linkflags, "-Wl,-Bdynamic") + end end if #flags == 0 then flags = linkflags |
