Commit graph

98 commits

Author SHA1 Message Date
Johan Engelen
91d306894e
Add support for LLVM 17. (#4533) 2023-12-03 19:07:31 +01:00
Johan Engelen
93b9babe80
macos: Explicitly set the macOS version in the triple to avoid linker warnings and support LTO (#4534)
Obey MACOSX_DEPLOYMENT_TARGET, and if it is not set, then default to host OS version.
2023-11-28 23:13:09 +01:00
Gleb Popov
9928895c54
Upstream FreeBSD-specific patches (#4515)
* CMake: Populate C_SYSTEM_LIBS for FreeBSD

* druntime: Update FreeBSD versions

* driver: Use PIC relocation model on FreeBSD
2023-10-22 15:11:17 +02:00
liushuyu
a49db8e5d3
Add initial support for LoongArch64 (#4500) 2023-10-05 12:36:01 +02:00
Martin Kinkelin
a2c63b6fea [slightly revise] 2023-08-25 16:39:13 +02:00
Andreas Schwab
cb33ca6ddc Default to rv64gc for hosted riscv64 target
Also select the correct ABI by default matching the enabled features
(double, float or no floating point).

Fixes #4375
2023-08-24 15:38:38 +02:00
Ikey Doherty
90a82f59e0
driver/targetmachine: Fix aarch64 support for LLVM >= 1600
This isn't *the* most ideal approach and in future we may want
to select specific fallbacks other than "generic".

Signed-off-by: Ikey Doherty <ikey@serpentos.com>
2023-06-03 22:07:08 +01:00
Martin Kinkelin
aa9b2783bb
Merge pull request #4320 from kinke/dead_strip
Be less conservative wrt. linker dead code elimination
2023-02-22 16:10:19 +01:00
Zachary Yedidia
7f2498b6cd
Allow RISC-V ABI to be configured by mabi (#4322) 2023-02-14 21:46:10 +00:00
Martin Kinkelin
aa9eb33cb1 Be less conservative wrt. linker dead code elimination 2023-02-11 13:51:58 +01:00
Johan Engelen
501c6577fa
macOS debuginfo: add support for using atos to get file:line info in backtraces. (#4291)
* macOS debuginfo: add support for using `atos` to get file:line info in backtraces.
Resolves issue #3864

* Return to LLVM default of emitting __debug_line section in __DWARF segment as a debug section (not regular)

* Re-enable test now that issue #3280 is fixed.

* Allow full path names in exception file:line debug output.

* Allow full path names in exception file:line debug output.

* Add changelog entry
2022-12-28 13:13:34 +01:00
Nicholas Wilson
19e7024377
Fix some more deprecations with LLVM 16 (#4185) 2022-09-18 08:00:30 +08:00
Ast-x64
299285e53d driver/targetmachine.cpp: Add comment for feature '+d' 2022-06-29 17:29:39 +08:00
Ast-x64
40ec6da71f RISCV64: Initial support
This adds support for riscv64gc with default LP64D ABI.
2022-06-28 22:37:21 +08:00
Martin Kinkelin
490bdcb0dd
Handle 'invalid' default LLVM target triples (#3972)
By normalizing them, to resolve issues like #3971.
2022-04-29 01:47:19 +02: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
Nicholas Wilson
4349388563
Prepare for LLVM15: Headers, attributes (#3936)
`llvm::AttrBuilder` was changed to require an LLVMContext in its constructor, and can no longer be copied.

declare `DEBIG_TYPE` after includes for the GC2Stack pass as `llvm/Support/GenericDomTreeConstruction.h `(included from `llvm/IR/Dominators.h` `#define`s and `#undef`s it.

`llvm::DIBuilder::createExpression` now takes an `ArrayRef<uint64_t>` instead of `int64_t`. EmitLocalVariable has similarly changed
2022-03-11 16:38:49 +01:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01: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
Hiroki Noda
0f1257fbca Remove RISCV_LLVM_DEV 2020-06-05 18:09:24 +09:00
Hiroki Noda
5b03a9e936 [RISCV] getTargetCPU should returns generic-rvXX, not generic 2020-06-05 08:31:06 +09:00
Martin Kinkelin
3e859c904b
Android: Default to cortex-a8 CPU for ARMv7-A (#3439)
Hardcoded instead of pre-setting ldc2.conf for the prebuilt Android
packages, and thus simplifying cross-compilation (e.g., issue #3437).

Also use `core2` instead of `x86-64` for Android x86_64.
2020-06-01 16:37:02 +02:00
Hiroki Noda
6190cd8ff2
Remove bitrig support (#3445)
Bitrig is now defunct OpenBSD fork. It released 1.0 in 2014 and hasn't
had another release since.
I'm not sure if LDC officially supports it, just delete an occurence of
bitrig from the source.
2020-05-28 23:01:44 +02:00
Fangrui Song
0a007a55f8
Fix StringRef conversion for LLVM 11 (777180a32b61070a10dd330b4f038bf24e916af1) (#3305) 2020-02-01 02:52:35 +01:00
Martin Kinkelin
78af39a5c7 Fix minor potential issues wrt. CLI parsing of -m32/-m64
Ignore it if the default triple (as opposed to the host) has the desired
bitness already. So only relevant if the default triple doesn't match
the host. I think that should render LDC-specific NO_ARCH_VARIANT in
dmd-testsuite's Makefile obsolete (if set, d_do_test won't add -m32/-m64
by default).

Also fix the config file section lookup in case both -m32 and -m64 are
specified.
2020-01-21 23:37:46 +01:00
myfreeweb
d13ae13308 Enable gc-sections on FreeBSD (#3106) 2019-08-24 14:19:04 +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
c81a0c94e5
Only enforce SSSE3 (with -O) for LLVM 7.x (#3045)
Looks like that regression has been fixed for LLVM 8.
2019-04-03 20:26:30 +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
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
d02dc5c7d3
Android: Prevent LLVM 7+ defaulting to incompatible emutls (#2863) 2018-10-06 21:20:07 +02:00
Martin Kinkelin
36216047f0 Work around LLVM 7 bug - require SSSE3 CPU for optimized x86[_64] code 2018-09-26 17:21:35 +02:00
Martin Kinkelin
f2cea55af1 [macOS] Add hidden option -preserve-dwarf-line-section
If built with LDC-LLVM v6.0.1+, and defaulting to true like DMD.
2018-07-04 02:40:08 +02:00
Martin
2970ba0e2c Revert "LLVM 6+: Default to Dwarf debuginfos v3"
This reverts commit 18cf4196f6.
2018-05-11 14:43:33 +02:00
Martin Kinkelin
0cd14bf80e
Predefine version D_HardFloat instead of D_SoftFloat for -float-abi=softfp (#2678)
Matching the D_HardFloat semantics: 'the target hardware has a floating
point unit'.
2018-05-11 14:39:12 +02:00
Martin
4f4ad49e58 LLVM 6: Adapt to LLVM CodeModel cmdline option now exposed as llvm::Optional 2018-04-15 03:38:16 +02:00
Martin
18cf4196f6 LLVM 6+: Default to Dwarf debuginfos v3
At least on Linux it appears to default to v4 or newer, which druntime's
rt.backtrace.dwarf doesn't handle yet.

This fixes tests/codegen/exception_stack_trace.d on Linux.
2018-03-25 18:22:08 +02:00
kinke
ae9d43c167 Use LLVM headers for shared codegen command-line options (#2148)
I.e., llvm/CodeGen/CommandFlags.h which in turn includes
llvm/MC/MCTargetOptionsCommandFlags.h.

This gets rid of a few duplicates on our side and includes about 35
(depending on LLVM version) new command-line options. LLVM provides a
helper function to set up the TargetOptions according to (most of) these
options.
Newer LLVM versions may add new options and we'll automatically inherit
them, including setting up the TargetOptions accordingly.

I did my best (TM) to remove a few unused/undesirable options and hide all
remaining new ones except for `-fp-contract`. The lists will need to be
tweaked from time to time.
2017-09-20 01:04:43 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Nicholas Wilson
ae6ff33fc1 [dcomptue] codegen (#2126)
* code generation

* simplify logic

* apply clang-format

* Undo completely inane choice by clang-format

* Guard the use of the command line args.
2017-05-24 08:55:32 +08:00
Johan Engelen
ed3afed77a UseSoftFloat was removed from the TargetOptions in LLVM3.7. It's replacement (I believe) is the "+soft-float" target feature (in the target feature string). Inside LLVM, the "use-soft-float" attribute is upgraded to the "+soft-float" feature, so we can do that ourselves when creating the target machine.
(at the point where we add the attributes to the function, we have no access to whether our TargetMachine was created with FloatABI:SoftFP or not)
2016-10-28 17:19:26 +09:00
Martin
4da394d9d0 Let LLVM figure out default CPU for ARM/AArch64 2016-10-09 02:08:08 +02:00
David Nadlinger
6f98b63996 driver: Remove some elses for ifs with return statements [nfc]
Also some very minor deduplication.
2016-09-03 00:52:03 +01:00
David Nadlinger
11572489d5 clang-format again some files touched in the next commits [nfc] 2016-09-03 00:52:00 +01:00
Matthias Klumpp
d949688216 Default to PIC code on Linux
Modern Linux distributions have their toolchain generate PIC code for
additional security features (like ASLR).
Since there is no (sane) way to detect whether the toolchain defaults to
PIC code, we simply default to PIC code on all Linux
distributions to avoid linking issues on these OSes.

The relocation model can be switched back to non-PIC code manually at
any time.
2016-08-02 20:55:54 +02:00
Martin
9404a1ab43 Use i686 instead of i386 for -march=x86 2016-05-27 16:06:31 +02:00
Martin
789c0935d8 [x86_64] -m32: Use i686 architecture instead of i386
`get32BitArchVariant()` for x86_64 seems to return i386 which is
inconsistent with i686 (Pentium Pro+) for a native 32-bit build.
2016-05-26 15:41:52 +02:00
Kai Nacke
de296b90ec LLVM 3.9: llvm::Reloc::Default was removed.
The value is now optional as there is nothing like a default relocation.
2016-05-20 21:17:20 +02:00