Thread overview
Breaking changes to command-line semantics
Oct 01, 2016
kinke
Oct 04, 2016
Joakim
Oct 04, 2016
kink
October 01, 2016
Hi all,

LDC lately streamlined its main() and output filenames with DMD, leading
to a few breaking changes to command-line semantics.

* `-singleobj` (emitting all source files into a single object file) is
  now enforced when building an executable or a shared library (not for
  static libraries though).
  LDMD already behaved like that, but LDC directly didn't.

* If not using `-of` explicitly, the name of the produced object/library/
  executable is now inferred from the first source filename (or first
  object filename for non-singleobj builds if it precedes the first source
  file in the command-line).
  It used to be based on the module declaration of the first source file.
  Static libraries with inferred filename are now created in the `-od`
  directory.

* `-op` (preserve source paths for object files) now works as expected.
  It used to be enforced when building static and dynamic libraries and
  was otherwise ignored.

* Windows targets now support .res and .def files in the command-line.
  They are forwarded appropriately to the MS linker.

* The object files order for the linker now corresponds to the command-
  line order of source and object files.
  The previous order was all existing object files in command-line order,
  then all new object files in reversed command-line order.
  For singleobj builds, the single new object file is always the first
  one, preceding all existing object files.
October 04, 2016
On Saturday, 1 October 2016 at 17:14:53 UTC, kinke wrote:
> Hi all,
>
> LDC lately streamlined its main() and output filenames with DMD, leading
> to a few breaking changes to command-line semantics.
---
> * The object files order for the linker now corresponds to the command-
>   line order of source and object files.
>   The previous order was all existing object files in command-line order,
>   then all new object files in reversed command-line order.
>   For singleobj builds, the single new object file is always the first
>   one, preceding all existing object files.

Looks good, I especially need the last one about ordering for Android, because the linker needs the object file with main() to be first, as that's the way it brackets the emulated TLS data on Android properly.
October 04, 2016
On Tuesday, 4 October 2016 at 06:21:17 UTC, Joakim wrote:
> Looks good, I especially need the last one about ordering for Android, because the linker needs the object file with main() to be first, as that's the way it brackets the emulated TLS data on Android properly.

Hi Joakim,

then `-main` will be a problem, since it's implemented (in DDMD's mars.d) by appending the fake main module as last file. It'll therefore be the last object file for the linker.