www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17390] New: Pass flags to linker driver without -Xlinker

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

          Issue ID: 17390
           Summary: Pass flags to linker driver without -Xlinker
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: adrian matoga.info

There's an open PR to LDC [1] to allow passing options to the linker driver
without -Xlinker on non-Windows platforms.
This is required e.g. for flags like --sysroot=path [2] or flags from
pkg-config [3] to work as expected.

The PR [1] adds option '-Xcc OPT', which passes OPT directly to the linker
driver (e.g. gcc or clang) without prepending it with -Xlinker. The global
order of flags passed via '-Xcc' and '-L' is preserved, and libraries requested
via pragma(lib) are appended after those flags.

The choice of '-Xcc' was motivated by clang's convention [4].

A similar feature would probably be useful also for DMD users. Since '-Xcc'
doesn't look consistent with current use of '-X' in DMD, DMD probably should
use a different switch for it.

W.r.t. order of linker (or linker driver) flags, there're a few related DMD
issues [5].

[1] https://github.com/ldc-developers/ldc/pull/2104
[2] https://github.com/ldc-developers/ldc/issues/2093
[3] https://github.com/ldc-developers/ldc/issues/1700
[4] https://github.com/ldc-developers/ldc/issues/2093#issuecomment-299707520
[5] https://issues.dlang.org/show_bug.cgi?id=15574
[6] https://issues.dlang.org/show_bug.cgi?id=15531
[7] https://issues.dlang.org/show_bug.cgi?id=7044

--
May 10 2017