Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug with linkgroups only working on Premake projects #1396

Merged
merged 1 commit into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,6 @@
end
end

if not nogroups and #result > 1 and (cfg.linkgroups == p.ON) then
table.insert(result, 1, "-Wl,--start-group")
table.insert(result, "-Wl,--end-group")
end

-- The "-l" flag is fine for system libraries
local links = config.getlinks(cfg, "system", "fullpath")
local static_syslibs = {"-Wl,-Bstatic"}
Expand Down Expand Up @@ -511,6 +506,11 @@
end
move(shared_syslibs, result)

if not nogroups and #result > 1 and (cfg.linkgroups == p.ON) then
table.insert(result, 1, "-Wl,--start-group")
table.insert(result, "-Wl,--end-group")
end

return result
end

Expand Down
18 changes: 18 additions & 0 deletions tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,24 @@
end


--
-- Test that sibling and external links are grouped when required
--

function suite.linkgroups_onSiblingAndExternalLibrary()
links { "MyProject2", "ExternalProj" }
linkgroups "On"

test.createproject(wks)
system "Linux"
kind "StaticLib"
targetdir "lib"

prepare()
test.isequal({ "-Wl,--start-group", "lib/libMyProject2.a", "-lExternalProj", "-Wl,--end-group" }, gcc.getlinks(cfg))
end


--
-- When linking object files, leave off the "-l".
--
Expand Down