[Issue 19304] New: [Reg 2.081.0] Linker arguments order changed in issue 15574 hinders using --whole-archive linker directive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 13 03:40:20 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19304

          Issue ID: 19304
           Summary: [Reg 2.081.0] Linker arguments order changed in issue
                    15574 hinders using --whole-archive linker directive
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: llucenic at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list