www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Breaking changes to command-line semantics

reply kinke <noone nowhere.com> writes:
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.
Oct 01 2016
parent reply Joakim <dlang joakim.fea.st> writes:
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.
Oct 03 2016
parent kink <noone nowhere.com> writes:
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.
Oct 04 2016