Singleobj builds

kinke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Nov 1 13:47:32 PDT 2016


On Tuesday, 1 November 2016 at 14:01:53 UTC, Johan Engelen wrote:
> Hi all,
>   I just found this in mars.d:
> ```
>   version (IN_LLVM)
>   {
>     if (global.params.oneobj && modules.dim < 2)
>         global.params.oneobj = false;
> ```
>
> Is there a special reason why `oneobj` is set to false when we 
> only pass one D source file? For caching work, I want to know 
> whether we are building stuff into one object file, and 
> params.oneobj is apparently not what it says it is ;)
>
> Thanks,
>   Johan

`-singleobj`, i.e., `global.params.oneobj`, does imply a few 
special cases. E.g., the single resulting object is always 
specified before all other existing object files when linking. 
The object filename may also differ if an output filename has 
been specified. For these reasons, I chose to clear that flag if 
the user has only specified a single D module to be compiled (and 
no `-main`, which implicitly adds a special source module), where 
-singleobj wouldn't make a semantic difference anyway.

This also makes sure `ldmd2 a.o b.d` results in the linking order 
`a.o b.o`.


More information about the digitalmars-d-ldc mailing list