Emulation for @weak global variables is still left out but should be
analogous.
The test adaptations are mostly a revert of 3893840f. The testcase has
shown that @weak hasn't worked properly for ELF (linker apparently
prefers the version in the 1st object file, independent of whether it's
weak or not), because the functions are emitted in COMDATs.
clang emits COMDATs for templates and inline functions only, not for
regular functions.
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
Thereby deferring requirements wrt. object.d declarations (Object,
Throwable, TypeInfo, TypeInfo_Class, TypeInfo_Struct...) and paving the
way for a minimal druntime.
This also greatly reduces the `-vv` output for tiny code samples, e.g.,
reduced test cases.
Reverts this functional change introduced by
ldc-developers/ldc@3f38f971. I overlooked this because
`setLinkage({<linkage>, false}, <symbol>` does NOT clear the COMDAT if
previously set.
The unittests now with 2.077 seem to respect an outer `extern(C)` while
`extern(D)` was previously enforced.
Fixes failing unittests on 32-bit x86 (e.g., `rt.switch_`) due to LLVM
'optimizing' calls with different calling convention than the callee
definition's to an LLVM trap (in the module's unittest forwarder
function).
Tie the state to an LLVM module/object file instead of having a global
one. And finalize it once per LLVM module instead of once per D module
(previously, as part of ModuleInfo generation).
Fixes issue #2388.
Use the real LL type representing the TypeInfo (sub)class directly and
from the beginning, i.e., already for the declaration, instead of
building an extra LL struct type (firstly opaque, then finalized when
defining the TypeInfo via RTTIBuilder).
To get this to work in all cases, the dummy TypeInfo for opaque structs
is now a complete TypeInfo_Struct, with all 11/13 fields zero-
initialized. Previously, it was a special TypeInfo (no extra
TypeInfo_Struct fields) with TypeInfo_Struct vtable, something which DMD
also emits.
Also refactor the RTTIBuilder finalize() interface - e.g., don't set the
linkage there (had to be reverted for ModuleInfos) and only take the
global variable to be defined. Cast the field initializers if required,
e.g., null pointers to appropriately typed function pointers for
TypeInfo_Struct etc.
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.
This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).
Some other changes:
* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
gen/module{.h, .cpp} currently is a big kitchen sink for various things
related to emitting modules. This hopefully makes the distinction between
generating the ModuleInfo data and the code to register it with druntime
clearer.