Commit graph

72 commits

Author SHA1 Message Date
Joakim
ee8a832c49 Add a handful of fixes for Android 2016-04-19 22:09:14 +05:30
Kai Nacke
5243b44ccd AArch32/64: gcc does not support -m32/-m64.
Currently we want to pass -m64 to gcc which aborts the compiler.
2016-03-01 22:51:16 +01:00
Martin
241dc9135f Fix error message formatting 2016-02-02 22:31:54 +01: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
David Nadlinger
880483b564 Merge pull request #1247 from nrTQgc/netbsd
NetBSD support (compiler parts)
2016-01-19 20:45:29 +01:00
Nick Tolstokulakov
556e3a691f netbsd changes 2016-01-18 18:33:46 +00:00
Kai Nacke
4e932cb8f1 Add missing libraries for OpenSolaris.
The libraries -lsocket and -lnsl were missing.
Both are required to compile a "Hello World" style program.
2016-01-17 09:49:07 +01:00
Johan Engelen
54e9a69b29 [Windows] Add diagnostics about missing ComSpec environment variable while setting up an MSVC environment during linking. If ComSpec is not defined, assume "cmd.exe". 2015-12-19 17:02:49 +01:00
David Nadlinger
57546e1723 driver: Add -static option for creating fully static binaries 2015-11-29 20:16:19 +01: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
Martin
7b28517a5c Windows: don't convert encoding when writing linker response file
LLVM assumes UTF-8 input, but our args mainly come from the LDC command
line (+ some from the config file and some implicit ASCII ones).

LDC doesn't use UTF-16 on Windows, so afaik, the command-line args are
encoded in the current codepage and so should just be written untouched
into the response file.
writeFileWithEncoding()'s default encoding is UTF-8, meaning no
conversion.

Also check for errors when trying to create and write the response file,
and refactor the executeAndWait() part.
2015-10-18 04:00:34 +02:00
Martin
eff81f9c46 Windows: also quote & escape args containing double quotes, but no space
And print a more detailed part of the command line if the tool fails.
2015-10-18 02:21:31 +02:00
Martin
b20148e2db Windows: use a temporary response file for the linker (issue #1160) 2015-10-18 00:42:21 +02:00
Martin
6dfbfe60e9 Windows: fix command line when invoking linker batch file
This command line sent to CreateProcess():

"C:\LDC\bin\amd64.bat" 1 2 "3" 4

is internally transformed to:

C:\Windows\system32\cmd.exe /c "C:\LDC\bin\amd64.bat" 1 2 "3" 4

Now guess what - cmd.exe treats the command string after /c or /k in a
very special way if it begins with double quotes and is followed by other
quoted args. In this example, it tries to invoke:

C:\LDC\bin\amd64.bat" 1 2 "3

Another example:

C:\Windows\system32\cmd.exe /c "C:\L D C\bin\amd64.bat" 1 2 "3" 4
=> C:\L

The fix seems to be enclosing the whole command with additional double
quotes (but no additional escaping of the command!) and using /s for
cmd.exe:

C:\Windows\system32\cmd.exe /s /c ""C:\L D C\bin\amd64.bat" 1 2 "3" 4"

So the command is quoted, but not escaped, i.e., no regular argument to
cmd.exe, so we can't use LLVM's executeAndWait() to launch the cmd.exe
process. :/

Additionally, LLVM's arg-quoting code is not public, so we can't use it
to quote & escape the regular args inside the command.

I therefore implemented a simple quoteArgs() variant which should
suffice for our use cases.
2015-10-18 00:42:20 +02:00
Rainer Schuetze
8b5cee7a7c issue #1161: return status if lib invocation 2015-10-17 15:27:37 +02:00
Martin
c480e9b41b MSVC: detect VS install dir properly and add batch file helper for x86 2015-10-01 01:57:38 +02:00
Martin
048b39297d MSVC: revise implicit linker flags 2015-09-27 21:44:24 +02:00
Martin
1670323ebb Refactor argv[0] management, related path searches etc. 2015-09-27 20:47:14 +02:00
Martin
93300cd331 MSVC: use a single batch file helper, for the linker only 2015-09-27 17:11:36 +02:00
Kai Nacke
c3a79cb867 Do not append extension if library filee name already has one.
This is the same behavior as dmd. Fixes issue #1084.
2015-09-17 23:25:50 +02:00
Kai Nacke
2a206453c0 Fix (part of) issue #1061.
An attempt to fix a test case results in breaking compiling with dub.
This PR reverts part of the former fix.

The changed test case is missing.
2015-09-09 16:06:04 +02:00
David Nadlinger
0922254dd1 Directly emit IR into same llvm::Module instead of using Linker
GitHub: Fixes #970.
2015-06-14 21:36:35 +02:00
Kai Nacke
f3ae6f6048 Regard -od if creating a static library.
If a static library is created then the driver now prepends the
path from -od option to the library name if that name is not
absolute. In case of Linux/Unix, automatic prepending of 'lib'
to the library name is removed.

This fixes failure of runnable/test13774.sh.
2015-05-30 14:20:55 +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
c2b6b87d06 mingw uses ar not lib for creating static libraries. 2014-12-08 08:18:31 +01:00
kai
df0d302d5b Fix MingW build with LLVM 3.5
Starting with LLVM 3.5 it is better/required to use Triple.isWindowsGNUEnvironment().
Reported by Daniel N.
2014-08-26 18:57:12 +02:00
kai
04f7eadaca Use gcc as linker on MingW 2014-08-23 20:23:53 +02:00
kai
95db57cba8 Fix another LLVM 3.6 change 2014-08-12 06:40:42 +02: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
9654a0249a improve linker setup for Win64 2014-07-01 20:02:24 +02:00
David Nadlinger
d8a7ae1841 Use --gc-sections on Linux.
This was painful.
2014-06-30 16:18:15 +02:00
kai
b7615f6a28 Merge branch 'master' into merge-2.065
Conflicts:
	dmd2/declaration.h
	dmd2/dsymbol.h
	dmd2/func.c
	gen/functions.cpp
	gen/toir.cpp
	runtime/druntime
2014-06-23 07:57:30 +02:00
kai
efa2beb149 llvm::error_code was replaced by std::error_code in LLVM 3.5 2014-06-23 07:31:17 +02:00
kai
f8a53ab3dc Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-03-12 18:27:43 +01:00
kai
2f2fa92df3 Fix includes for LLVM 3.5 2014-03-07 06:40:39 +01:00
Kai Nacke
fe39da53e3 Merge of 2.065.0-b3.
The new visitor class is used for IR generation. This removes some modifications from DMD source.
2014-02-10 08:47:25 +01:00
Kai Nacke
a831d4e11c Fix LLVM 3.4/3.5 build 2014-01-12 13:51:12 +01:00
Alexey Prokhin
6ef20b6123 Fixed incorrect static library path 2014-01-12 15:44:17 +04:00
kai
e6529cfd3d [experimental] Add sanitizer options to LDC.
Add some of the sanitizer passes to LDC. This is not complete (linking must be
done using clang and the right `-fsanitize=` option) and may not be useful at
all.

If it proves to be usefull then a lot of other options (e.g. blacklist) must be
added.
2013-11-05 13:03:52 +01:00
kai
cf88271ab9 Replace llvm::sys::Path with std::string.
In many cases this is straightforward. It makes the source LLVM 3.4 compatible without using #idef's.
2013-06-29 14:20:44 +02:00
kai
f1c71e4bac Make ldc compatible with LLVM 3.4
Development of LLVM 3.4 started with a cleanup of the path class (PathV1).
The changes here let ldc compile at least with rev. 184039 of LLVM.
2013-06-15 19:52:29 +02:00
David Nadlinger
2617db0395 Merge pull request #346 from klickverbot/m32m64
Only specify -m32/-m64 for archs where the variants exist.
2013-05-31 12:10:49 -07:00
kai
4343965106 Use /LARGEADDRESSAWARE:NO only for debug builds with LLVM 3.4.
Most of the LLVM bugs regarding relocations are fixed now.
2013-05-24 16:07:25 +02:00
David Nadlinger
23d82b9620 Only specify -m32/-m64 for archs where the variants exist. 2013-05-11 21:49:19 +02:00
kai
308919f371 Revert "Linker flag /LARGEADDRESSAWARE is not required with LLVM 3.3.".
There is still an issue left in LLVM. I need to investigate this further.
2013-04-20 14:07:30 +02:00
kai
d8aed3627e Linker flag /LARGEADDRESSAWARE is not required with LLVM 3.3.
With a recent commit support for the missing relocations was added.
This change removes the flag from the linker command line.
2013-04-15 07:08:46 +02:00
David Nadlinger
92899dff96 Link in ws2_32 by default on MinGW. 2013-02-14 18:14:49 +01:00