Commit graph

93 commits

Author SHA1 Message Date
Martin Kinkelin
3beb68904f Avoid deprecations with LLVM 18 wrt. renamed llvm::StringRef::{starts,ends}with() 2024-03-28 16:42:51 +01:00
Johan Engelen
e0f9fa6e20
Add support for -ffat-lto-objects. (#4549) 2024-03-01 21:19:00 +01:00
Andrei Horodniceanu
d7f87811f6
support CC envvar to be in the form "command args..." (#4582)
In case CC is set try to split it by spaces into a command and
arguments. This is the same behaviour as in dmd.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2024-02-24 16:46:35 +01:00
Johan Engelen
2c2c550931
Fix LTO on newer macOS. (#4548)
The trouble was that the libLTO-ldc.dylib was not used by ld64, even though it is explicitly passed using -lto_library. Somehow the library renaming (adding "-ldc" postfix) is not working properly. I did not figure out how to fix it (the usual install-name-tool and resigning did not work), the only fix that worked is to not rename it at all.
This bug went unnoticed because at -O0, there is no LTO object file output at all; hence the -O3 addition to the thinlto testcase.
2023-12-27 16:31:05 +00:00
Johan Engelen
91d306894e
Add support for LLVM 17. (#4533) 2023-12-03 19:07:31 +01:00
Martin Kinkelin
a053480010 Misc. merge fixes (C++) 2023-11-06 00:33:57 +01:00
Martin Kinkelin
38ed66fa6a LLVM 16: Disable function specializations by default
In ldc2.conf for LDC itself, and in the linker cmdline for LTO plugins.
2023-08-13 19:15:47 +02:00
Martin Kinkelin
f6702cfbf5 Remove legacy llvm::make_unique 2023-07-29 02:09:35 +02:00
Martin Kinkelin
9ce57807c0 Drop support for LLVM 9 and LLVM 10 2023-07-29 01:12:43 +02:00
Martin Kinkelin
5b137768a0 Run C preprocessor 2023-06-07 12:06:25 +02:00
Martin Kinkelin
aa9eb33cb1 Be less conservative wrt. linker dead code elimination 2023-02-11 13:51:58 +01:00
Nicholas Wilson
23fa11d320
Fix deprecation warning with LLVM 16 (#4180) 2022-09-17 17:00:51 +08:00
Johan Engelen
3b9665bac6
Add LeakSanitizer support with -fsanitize=leak (#4005)
* Add LeakSanitizer support

* Windows and FreeBSD do not support LSan yet

* Test LLVM >= 10 only with LSan
2022-06-26 20:12:38 +00:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Martin Kinkelin
694edca0ac Generalize rt.dso_windows to rt.dso, for Posix too
Addressing #3786.
2022-01-13 17:00:23 +01:00
Martin Kinkelin
e125411e98 Linux: Don't default to ld.gold linker
I hope the issues with old bfd aren't really a thing anymore.

The main reason is that the user might have set LLD as default
`/usr/bin/ld` symlink, and LDC not using it by default isn't
intuitive. And LLD can be significantly faster than gold.
2021-10-23 19:58:59 +02:00
Johan Engelen
a5025bf83e
Add MSan compiler-rt library to LDC install and add it to linkerline for --fsanitize=memory (#3751)
* Add MSan compiler-rt library to LDC install and add it to linkerline for --fsanitize=memory

* MSan: Add support for `-fsanitize-memory-track-origins=`
2021-06-07 00:29:18 +02:00
Martin Kinkelin
282ade3e31 If the LLVM is shared, add its lib dir to the hardcoded list used for library lookups
When looking up the LTO linker plugin and compiler-rt libraries.
2021-02-20 14:49:47 +01:00
Martin Kinkelin
fd3784001c -link-internally: Switch to LLD's new Mach-O port v2 with LLVM 12
AFAIK, the old port wasn't usable with LDC anyway, so eagerly switch
to the new one; the guys think it's mature enough to be the default
for `ld64.lld`:

https://lists.llvm.org/pipermail/llvm-dev/2021-January/147665.html
2021-02-12 07:54:41 +01:00
Martin Kinkelin
79b226973f Darwin: Remove libdl as default platform lib
It's apparently not required to link with dl{open,close} and e.g.
not set in CMAKE_DL_LIBS for Darwin targets.
2021-02-10 03:27:43 +01:00
Martin Kinkelin
4134289978 Musl: Use libunwind for druntime backtraces 2021-01-16 12:12:34 +01:00
Martin Kinkelin
0ae530f966 Merge upstream stable (dlang/dmd@ebd5e81dc9) 2021-01-06 23:34:36 +01:00
Martin Kinkelin
96b9cde428 Add support for LLVM 11
One major change is the removal of llvm::CallSite, which I've replaced
by llvm::CallBase*.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
18ed3efe4d Extend -platformlib to Posix targets 2020-08-14 17:55:35 +02:00
Johan Engelen
1ba4128cce
Copy LLVM's ThreadSanitizer (TSan) library to LDC's libraries like we do for ASan, and set the correct linker flags (#3522)
* Copy LLVM's ThreadSanitizer (TSan) library to LDC's libraries like we do for ASan, and set the correct linker flags.

Requires at least LLVM 8 for executable TSan test cases and TSan execution is not supported on Windows.
2020-08-03 15:11:13 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
535160458d Fix naked DMD-style asm emission for non-Mac x86 Darwin targets 2020-06-26 20:07:19 +02:00
Martin Kinkelin
af1ed6d3e7 Android: Default to bfd linker for adjacent .tdata/.tbss sections
Hardcoded to simplify cross-compilation (no need to add `-linker=bfd` to
ldc2.conf).
2020-06-14 12:36:07 +02:00
Johan Engelen
1aa55f7879
Give user possibility to avoid passing -fuse-ld to cc with --linker=. (#3382) 2020-03-24 00:12:33 +01:00
Martin Kinkelin
2d86e49fba
Finalize support for LLVM 10 (#3323) 2020-02-14 17:53:40 +01:00
Fangrui Song
0a007a55f8
Fix StringRef conversion for LLVM 11 (777180a32b61070a10dd330b4f038bf24e916af1) (#3305) 2020-02-01 02:52:35 +01:00
Martin Kinkelin
ec1c37a5a4
Azure CI: Build LDC itself with full LTO, on Linux and Mac too (#3236) 2020-01-15 00:21:35 +01:00
myfreeweb
d13ae13308 Enable gc-sections on FreeBSD (#3106) 2019-08-24 14:19:04 +02:00
myfreeweb
73cf033dca Do not require gold plugin when linking with LLD (#3105)
LLD supports plugin-style flags, but the plugin itself might not exist.
2019-08-06 20:59:14 +02:00
Johan Engelen
a10988db83 Amend function name. 2019-01-19 21:41:33 +01:00
Johan Engelen
82dccbab23 CMake: from LLVM 7, also copy xray-basic, xray-fdr, and xray-profiling clang runtime libraries. 2019-01-17 01:22:17 +01:00
Johan Engelen
070fd639b4 Link with C++ stdlib when linking with XRay before LLVM 7. 2019-01-16 11:46:11 +01:00
Martin Kinkelin
c7b17368c3 Support external wasm-ld linker for WebAssembly targets
Overridable with `-linker`.
2018-12-23 17:26:12 +01:00
Joakim
8eee08b710 Android: don't use ld.gold by default yet. 2018-12-12 12:19:17 +05:30
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
b12f2eae8d Default to ld.gold on Linux in general, not just with -flto=thin 2018-10-15 22:36:47 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
aace02ae13 Work around LLD 7 segfault in wasm driver on Linux 2018-09-26 17:21:35 +02:00
Martin Kinkelin
281efb6655 Don't use OS/arch suffix for installed ldc-rt lib copies
LDC's concept is different lib dirs per target triple, so the extra
suffix isn't needed and only complicates matters.

The lib names are now streamlined across targets; they already were on
Windows.
2018-09-03 19:28:44 +02:00
Martin Kinkelin
a29d5fd53e Use config file's lib-dirs when searching for compiler-rt libs
In addition (and preferred over) the previous searched-for lib dir
(`<bin dir>/../lib<LIB_SUFFIX CMake var>`). [Incl. searching in some of
their subdirs, e.g., `clang/x.y.z/lib/<OS>`.]

I skipped that backwards-compatibility thingy for the builtins lib on
Windows (not crucial, only linked (if found) on Windows etc.).
2018-07-25 01:49:10 +02:00
Martin Kinkelin
ac070a386d Config file: Add lib-dirs array
And replace the default `-L-L<path>` LDC switches in the default config
accordingly.

The first advantage is for cross-compilation, where additional sections
should now mostly get away with overriding `lib-dirs` (and `rpath` if
need be) only; not just to specify the directory containing cross-
compiled druntime and Phobos, but also further dirs containing the C
libs. No need to override a whole `[post-]switches` array anymore just
to tweak the lib dirs.

The second advantage is that we can search these dirs for compiler-rt
libs instead of being limited to `<bin dir>/../lib<LIB_SUFFIX specified
in CMake command line>` or trying to guess distro-specific paths
=> easy-peasy for distros and users.
This isn't implemented yet.
2018-07-24 21:27:43 +02:00
Martin Kinkelin
27e4ac0304 Add -link-internally support for MinGW and WebAssembly targets 2018-07-09 20:25:32 +02:00
Johan Engelen
0c8c0e6a18 Fix build with LLVM trunk. (#2767) 2018-07-09 20:09:44 +02:00
Martin
9288418476 Default to gold linker for ThinLTO on Linux
To work around issue #2278 out-of-the-box. ld.bfd still doesn't work on
Ubuntu 18.04, and `update-alternatives --install /usr/bin/ld ld
/usr/bin/ld.gold 99` doesn't work anymore.
2018-05-12 16:38:55 +02:00