What's the difference between DMD's `-preview` and `-transition`?
Mike Franklin
slavo5150 at yahoo.com
Tue Aug 20 05:33:44 UTC 2019
I'm planning a PR to fix
https://issues.dlang.org/show_bug.cgi?id=6952.
The problem, as documented in issue report, is that DMD currently
prepends `-Xlinker` to any `-L` command-line arguments (e.g `dmd
-L-static` invokes gcc as `gcc -Xlinker -static`). This means
that it is impossible to pass certain gcc-specific arguments such
as `-static`, `-nodefaultlibs`, `-nostartfiles`, etc. directly to
`gcc`. We need to be able to invoke gcc as `gcc -static`, not
`gcc -Xlinker - static`).
By modifying the current behavior to no longer prepend `-Xlinker`
to `-L` command-line arguments, users will be able pass arguments
directly to gcc (e.g. `dmd -L-static`) or simulate the current
behavior by explicitly appending `-Xlinker` themselves (e.g. `dmd
-L-Xlinker -L-T=script.ld`). Both classes of users will have
what they need.
Unfortunately, changing the current behavior could break build
scripts that rely on `-Xlinker` being prepended to any `-L`
command-line argument, so I need some way for users to opt-in to
the new behavior while allowing a path forward to, someday,
deprecate the current behavior.
For the scenario described above, should I add a
`-preview=fixLinkerInvocation` or a
`-transition=fixLinkerInvocation` option?
Thanks for the help.
Mike
More information about the Digitalmars-d
mailing list