Commit graph

72 commits

Author SHA1 Message Date
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
Kai Nacke
ffc07566b1 LLVM 3.9: DataLayout.getLargestLegalIntTypeSize() was renamed.
Fixes a compile error with LLVM 3.9. Original by Rainer.
2016-05-19 22:56:33 +02:00
Dan Olson
13cef8a9a8 Override LLVM default relocation model for ARM
Sets ARM default relocation model to PIC for Darwin & Android and static
for rest.  This is needed because LLVM picks default relocation model of
DynamicNoPIC for non-Darwin targets, which generates bad code at -O0.
Clang source code even states that DynamicNoPIC isn't valid on any OS
but Darwin.
2016-02-06 01:22:01 -08:00
Kai Nacke
8df1f7ec1a Add more support for xBSD type OS.
Use the same code for FreeBSD, NetBSD, OpenBSD and DragonFly BSD.
2016-01-22 22:10:33 +01:00
Kai Nacke
8a26fcf52b Support Gentoo CHOST triple
The Gentoo CHOST triple differs from the normalized triple used by
LLVM. See https://wiki.gentoo.org/wiki/CHOST for details.

This results in a failure to detect the used float ABI. The vendor
field can be hardfloat or softfloat in order to indicate the float
ABI. This is the only way to specify the hardfloat ABI because the
C library value gnueabihf is not supported.

This commit adds a check for vendor names hardfloat and softfloat.
2016-01-16 21:39:31 +01:00
Dan Olson
49ba2910b0 OS X - default OS to macosx instead of darwin
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.
2015-11-12 10:52:05 -08:00
David Nadlinger
51afced357 Also clang-tidy driver/ 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Kai Nacke
2cdbe58d86 Default enable attribute cx16 (-mattr=+cx16).
This enables code generation for cmpxchg16b instruction which is
not available on very old 64bit CPUs.

The user can change this be choosing a different cpu (`-mcpu=...`)
or by explicitly disabling the attribute (`-mattr=-cx16`).
2015-09-10 21:03:21 +02:00
Martin
2cf1a07f35 Fix LLVM 3.7 build 2015-08-08 17:08:41 +02:00
Kai Nacke
bbe3c279f1 LLVM 3.8: Access to data layout from llvm::TargetMachine has changed.
This changes only a small fraction of the code.
2015-08-07 11:54:38 +02:00
Kai Nacke
f67186592a LLVM 3.7: NoFramePointerElim is now an attribute.
Temporary workaround to enable Travis-CI.
2015-06-04 15:07:02 +02:00
Kai Nacke
2d9e66de66 Fix assertion in getABI(). 2015-05-25 16:20:48 +02:00
Kai Nacke
2331889669 MIPS: Implement ABI handling.
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.
2015-05-24 18:11:24 +02:00
Kai Nacke
afe6051ead LLVM 3.7: Fix MIPS ABI definition.
Detection of EABI is still missing.
2015-05-16 18:56:59 +02:00
Kai Nacke
82a76cf3f8 LLVM 3.7: TargetOptions.UseSoftFloat is gone.
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.
2015-05-12 18:11:30 +02:00
Kai Nacke
cc9a810a69 LLVM: TargetRegistry: iterator was replaced by iterator_range. 2015-05-12 17:51:48 +02:00
Dan Olson
f554c322a8 Lookup default float-abi for thumb same as arm
Was always defaulting thumb to soft, now uses same rules for arm.  The
end result is that thumbv7-apple-ios now defaults to softfp correctly.

(cherry picked from commit e0cf8e85c2e42f382742c326f8963b8bf779df8c)
2015-02-28 23:57:38 -08:00
Dan Olson
3c9da62ea3 Set version ARM_SoftFP
Set versions ARM_SoftFP & D_HardFloat instead of ARM_SoftFloat &
D_SoftFloat for option -mfloat-abi=softfp (function calls use soft float
ABI but using hardware floating point instruction).

(cherry picked from commit 5a19080e04cc775fe94ea2ef74c850b26bb8a469)
2015-02-28 23:53:30 -08:00
Andreas Hollandt
8af29baeda fix #667 flags list used as string
enable function and data sections
fix incorrect library search paths
2014-07-17 00:11:08 +02:00
Andreas Hollandt
956f1ff528 adapt to API change 2014-07-01 18:34:36 +02:00
David Nadlinger
d8a7ae1841 Use --gc-sections on Linux.
This was painful.
2014-06-30 16:18:15 +02:00
Kai Nacke
92c06dede0 Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-05-10 21:38:37 +02:00
kai
841f874e04 Fix LLVM 3.5 API change 2014-05-07 07:18:37 +02:00
kai
456924116b Merge branch 'merge-2.064' into merge-2.065 2014-04-05 22:37:27 +02:00