Merge pull request #1396 from LORgames/ssurtees/linkgroupsFix

Fixed bug with linkgroups only working on Premake projects
This commit is contained in:
starkos 2020-02-12 20:28:50 -05:00 committed by GitHub
commit 80b8c1fedf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -467,11 +467,6 @@
end end
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 -- The "-l" flag is fine for system libraries
local links = config.getlinks(cfg, "system", "fullpath") local links = config.getlinks(cfg, "system", "fullpath")
local static_syslibs = {"-Wl,-Bstatic"} local static_syslibs = {"-Wl,-Bstatic"}
@ -511,6 +506,11 @@
end end
move(shared_syslibs, result) 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 return result
end end

View File

@ -504,6 +504,24 @@
end 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". -- When linking object files, leave off the "-l".
-- --