Commit graph

54 commits

Author SHA1 Message Date
Martin Kinkelin
3e80c02a19
Merge pull request #3712 from kinke/sections_shared
druntime: Switch to rt.sections_elf_shared on Windows too
2021-05-21 21:38:47 +02:00
Martin Kinkelin
ee0d5fbe3c Windows: Default to dllexport with -shared, and enforce dllimport with -link-defaultlib-shared 2021-05-03 20:54:57 +02:00
Martin Kinkelin
49caa9e8a0 Windows: Dllimport aggregate globals too
Init symbols, TypeInfos (classes only) & vtables - unless defined in a
root module. For explicitly exported aggregates, or, with
`-fvisibility=public`, all aggregates.
2021-04-29 17:22:12 +02:00
Martin Kinkelin
8d71c8624a
-cleanup-obj: Put object files into temporary directory by default (#3660)
To prevent conflicts for concurrent LDC processes in the same
working dir, resolving #3643.

Re-use this for the temporary object files of -run by enforcing
-cleanup-obj in that case. Additionally enforcing -oq prevents
conflicting filenames in that dir and allows to get rid of previous
Module.makeObjectFilenameUnique().
2021-02-11 00:08:47 +01:00
Martin Kinkelin
fe5a1776ac Merge remote-tracking branch 'origin/master' into merge-2.095 2021-01-06 23:58:20 +01:00
Johan Engelen
29245c8255
Add --ftime-trace functionality. (#3624)
This uses LLVM's TimeProfiler functionality, such that LLVM's work is traced in the same profile (optimization and machine code gen).
Functionality is meant to be identical to Clang and LLD's --ftime-trace.
2020-12-28 17:05:04 +01:00
Martin Kinkelin
079858f3b2 Upgrade frontend & libs to early v2.095.0 (dlang/dmd@a4274b3c39) 2020-11-27 17:45:13 +01:00
Martin Kinkelin
145ce40b11 Extend -linkonce-templates by matching template emission scheme
I.e., *define* templated symbols in each referencing compilation unit
when using discardable linkonce_odr linkage, analogous to C++.

This makes each compilation unit self-sufficient wrt. templated symbols,
which also means increased opportunity for inlining and less need for
LTO. There should be no more undefined symbol issues caused by buggy
template culling.

The biggest advantage is that the optimizer can discard unused
linkonce_odr symbols early instead of optimizing and forwarding to the
assembler. So this is especially useful with -O to decrease compilation
times and can at least in some scenarios greatly outweigh the
(potentially very much) higher number of symbols defined by the glue
layer.

Libraries compiled with -linkonce-templates can generally not be linked
against dependent code compiled without -linkonce-templates; the other
way around works.
2020-11-13 02:41:11 +01:00
Martin Kinkelin
323e49e52a -cov=ctfe: Initialize _d_cover_data with CTFE coverage data
Fixing dmd-testsuite's runnable/ctfe_cov.d.
2020-09-25 00:52:42 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
9707bb1af8
WebAssembly: Switch from legacy linked-list ModuleInfo registry to __minfo section (#3348)
As LLD 9+ supports the magic __{start,stop}___minfo linker symbols for
wasm targets.
2020-03-07 22:57:56 +01:00
Jacob Carlborg
56d796d23b Fix undefined symbol __Dmodule_ref for Apple ARM 2020-01-19 20:57:23 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00
Johan Engelen
a72c318cb3 Add explicit casts to llvm::MaybeAlign for setAlignment to use the new LLVM trunk API (silences deprecation messages of old API) 2019-10-18 00:16:24 +02:00
Martin Kinkelin
030123410a Add support for LLVM 9.0.0
Including some of Nicholas' fixes in #3144.
2019-09-25 03:42:18 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
c7c3f56415
Merge pull request #2826 from Syniurge/debug-info-fixes
Debug info improvements (for GDB): printing global and imported symbols, non-member and member function calls
2018-10-16 14:53:47 +02:00
Elie Morisse
841146644b Debug info: emit llvm::DIModule and llvm::DIImportedEntity for modules and imports
Matches GDC's DWARF output and enables access to global and imported symbols from GDB.
2018-10-15 22:48:03 +02:00
Martin Kinkelin
055fa1be8b Work around Mac issue wrt. discarding llvm.global_{c,d}tors 2018-10-15 22:36:47 +02:00
Martin Kinkelin
2676101847 Simplify DSO registration with druntime
* The explicit reference to the ModuleInfo should be obsolete, it's
  added to the llvm.used array.
* Only keep a single pair of ldc.dso_{c,d}tor per DSO (pointing to a
  common ldc.register_dso() function) instead of a pair per linked-in D
  object file. This simplifies ldc.register_dso() and allows to get rid
  of the explicit ctor/dtor functions and the ldc.dso_initialized global.
2018-10-15 22:33:28 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin
f38a7972a5 Split up getOrCreateGlobal() in {declare,define}Global()
Making it obvious which of the two operations is performed, reducing
call args and making sure a global isn't defined multiple times via
`defineGlobal()`.

The only [intended] functional change is in gen/trycatchfinally.cpp,
where I inserted a check for an existing __cpp_type_info_ptr global when
emitting a catch for C++ exceptions.
2018-04-10 22:13:00 +02:00
Martin
c17b71c3fc Skip ModuleInfo emission if there's no ModuleInfo declaration
This is compatible with DMD.
2018-04-04 19:59:10 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
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).
2018-04-04 19:59:10 +02:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Johan Engelen
3ec79179b4 PGO: refactor such that there can be IR-based and frontend-based PGO. 2018-01-15 23:59:14 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Johan Engelen
f86e33f1d0
Remove LDC_WITH_PGO. (#2476)
It's no longer needed, all our builds have it set to true.
2017-12-29 23:54:32 +01:00
kinke
6d6167d83d MSVC: Emit ModuleInfo references into .minfo section (#2383)
Instead of the legacy linked list.
2017-10-25 00:15:40 +02:00
Johan Engelen
e34ac614f6 Move the call to the D-style code-coverage constructor (registration of code coverage for the current module) to the "ictor" constructors that are not included in cycle detection. (#2382)
Resolves issue #2177.
2017-10-25 00:14:28 +02:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +02:00
Martin
0b28925e9a Win32: Remove extra leading underscore from D symbol mangling
This is compatible with DMD.
2017-10-07 14:06:17 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Joakim
c0c4b7d6cb Switch Android onto the sectionELF style of module registry, following upstream, but leave out the dso_registry stuff that's unused on Android. 2017-06-25 09:06:46 +05:30
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
kinke
151e83dc6b Fix C++ warnings (#2140) 2017-05-26 13:45:15 +02:00
David Nadlinger
747f7a3dfa clang-format files touched in d01a91f7 [nfc]
Some housekeeping on files that recently saw large changes anyway.
2017-05-24 21:35:40 +01:00
Martin
d01a91f755 Allow multiple occurrences for almost all command-line flags
Except for `-sanitize` and `-cache-prune*`.
2017-05-23 20:53:57 +02:00
Martin
95c1d38e2e Integrate module gen/programs into driver/tool 2017-03-13 23:31:32 +01:00
Martin
dca21939e1 Merge 2.072.2 front-end
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
2017-01-29 15:48:03 +01:00
Ivan Butygin
a26bfc1223 Refactor code to hide direct IrFunction->func usage and add convenient functions (#1911) 2017-01-17 22:40:32 +01:00
Martin
29d52f0362 Sync command-line options and descriptions with DMD 2016-12-20 22:08:23 +01:00
LemonBoy
62a2252028 Implement the betterC switch like DMD does.
Namely, don't emit the ModuleInfo.
2016-11-25 17:40:35 +01:00
Johan Engelen
7deae74d89 Only emit llvm.used _once_ when compiling multiple D modules into one LLVM module. 2016-10-26 21:59:18 +09:00
Johan Engelen
eb0f97aaf1 ELF: Use magic linker symbol names for begin/end of .minfo. 2016-10-17 09:52:33 +02:00
David Nadlinger
bb2b648d8e Shared library support for OS X (#1705) 2016-10-15 16:17:39 +01:00