Bug 19304 – [Reg 2.081.0] Linker arguments order changed in issue 15574 hinders using --whole-archive linker directive

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-10-13T03:40:20Z
Last change time
2018-10-26T22:00:25Z
Keywords
link-failure
Assigned to
No Owner
Creator
Ludovit Lucenic

Comments

Comment #0 by llucenic — 2018-10-13T03:40:20Z
As I mentioned in my comment to the commit fixing issue 15574: https://github.com/dlang/dmd/commit/fbaeeaee1cac009d9f7157b7d63ea22dee1d3b0e#commitcomment-30878590 the change of linker arguments order merged there by that commit disallows the use of --whole-archive linker directive effectively from version 2.081.0 of DMD. The changed order of arguments causes linker error: > /usr/local/bin/ld: error: ext/arinas/bin/libarinas.a(core.o): multiple definition of '_D6arinas4core12__ModuleInfoZ' > /usr/local/bin/ld: ext/arinas/.dub/build/library-debug-linux.posix-x86_64-dmd_2082-9AC63FE218354D87B48C0AED4255478E/libarinas.a(core.o): previous definition here I assume the original implementation positioned the (in dub.sdl defined lflags "--whole-archive" "ext/arinas/bin/libarinas.a" "--no-whole-archive") directive before the *.a libraries built as dub project's dependecies on the linker command line. I am not aware of any means how to pass this directive on to the linker being placed before static libraries other than changing the dmd/link.d code for branches 2.081 and 2.082. I have fixed the code of DMD for my specific purpose assuming also not interfering with the original intention of the fix for issue 15574. I am going to propose my change on github as PR for review to ensure my understanding of the touched code is correct.
Comment #1 by github-bugzilla — 2018-10-26T22:00:24Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4407069051197b6af2df3699b3c5a1488fe45eab Fix issue 19304 - [Reg 2.081.0] Linker arguments order changed in issue 15574 hinders using --whole-archive linker directive Proposed change enables again using --whole-archive linker directive. Please review that it also does not ruin the intention of Fix for issue 15574. https://github.com/dlang/dmd/commit/fd37b6e3658cae54fc850eabe44797e1b5312166 Merge pull request #8828 from llucenic/patch-1 Fix issue 19304 - [Reg 2.081.0] Linker arguments order changed in issue 15574 hinders using --whole-archive linker directive merged-on-behalf-of: Petar Kirov <[email protected]>