Also adds the CMake infrastructure to compile and link the D source files.
The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
This PR replaces the few uses of global.params.is<OS> with
global.params.targetTriple.isOS<OS>(). This avoids adding a new
boolean for each supported OS.
It also defines all xBSD-type OS as using the dso-registry.
On OS X, the OS in Triple should be macosx, not darwin. This is not
comprehensive like clang which has a bunch of darwin to other OS
translation rules, but since only Darwin target currently supported is
OS X, this does the job.
This brings us in line with what GCC and Clang do, and as soon
as proper libunwind/DWARF-based backtraces are implemented, it
will be obsolete (right now they are broken anyway).
There is a LLVM 3.7 command line option named color. This option is
only available if ldc is linked against shared LLVM libraries.
Because the LDC color option uses a FlagParser simple renaming does
not work. The solution is now:
- Rename LLVM option `color` to `llvm-color` and hide this option
- Dynamically create the LDC option `color`
This finally enables building with shared LLVM libraries.
Causing a painfully slow version of the standard library (there are
some contracts in druntime that cause O(1) hash table operations to
become O(N)!) to be linked is definitely not what people expect -g
to do. Having a debug version of teh standard library with all the
assertions available is still valuable, but is used infrequently
enough that hiding it behind an extra command line option is
adequate.
I thought long and hard about approaches that avoid having to add
yet another command line flag, but except for ditching -debuglib
altogether and having people manually override -defaultlib, there
is no way of figuring out the user's intent from the other flags.
GitHub: Closes#417.
If a target file name is given (`-of`) and a library is created then
`-singleObj` is implied. This results in behaviour not compatible
with dmd. This commit checks for this situation and does not set
`-singleObj`. This fixes issue #978.
Adds a new command line option -mabi= and uses the value to compute
the ABI to use. Adds the ABI to linker and assembler invocation, too.
Allows consistent invocation of the whole tool chain.
LP64 defines a C environment with 64bit pointers and char/short/int/long
are 8/16/32/64bit. char/short/int/long have defined sizes in D. We need
to look only at the pointer size.
There are now 64bit environments with 32bit pointers. Examples are
x32 in Intel and N32 on MIPS64. For these environments D_LP64 should
not defined but the global.param.is64bit is still true. The definition
of size_t is also affected. If only 32bit are addressable then size_t
should also be a 32bit type. (This is not required by C standard but
common practize.)
The net result is that not only the definition of D_LP64 must be changed
but also DtoSize_t().
A function attribute use-soft-float with values true or false is used instead.
This commi only ensures that LDC compiles with LLVM 3.7. The possible semantic
change needs to be evaluated.