Commit Graph

79 Commits

Author SHA1 Message Date
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D975

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Tom Stellard 6674c703b6 R600: Handle -mcpu option v3
v2:
  - Add a test case

v3:
  - Use the -### clang option in the tests

llvm-svn: 178499
2013-04-01 20:56:53 +00:00
Thomas Schwinge 4e55526737 Rename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.
This is about the GNU Binutils' assembler and linker, so reflect that in the
name.

llvm-svn: 178272
2013-03-28 19:04:25 +00:00
Benjamin Kramer b164d67d07 Driver: Pass down the -march setting down to -cc1as on x86 too.
The assembler historically didn't make use of any target features, but this has
changed when support for old CPUs that don't support long nops was added.

llvm-svn: 175919
2013-02-22 20:55:17 +00:00
Eric Christopher d380400b17 Split out the command handling for split debug info, we're going
to want to propagate some information through the module into
the back end and so need to pass it through to codegen.

Also make the methods file static so we can use them in other places.

llvm-svn: 175916
2013-02-22 20:12:52 +00:00
Eric Christopher 248357f624 Remove the SplitDebug action and replace with a set of commands
in the compilation setup. Note that this doesn't currently
work for -no-integrated-as.

llvm-svn: 175813
2013-02-21 22:35:01 +00:00
Eric Christopher 2ba5fcb759 Driver and option support for -gsplit-dwarf. This is a part of
the DWARF5 split dwarf proposal.

llvm-svn: 174349
2013-02-05 07:29:57 +00:00
Chad Rosier dbf46a16c7 [driver] Don't try to generate diagnostic information for dsymutil crashes.
Part of rdar://13134273

llvm-svn: 174203
2013-02-01 18:30:26 +00:00
Chad Rosier 633dcdc52d [driver] Associate a JobAction with each result file. This enables the driver
to delete result files for only those commands that fail.
Part of rdar://12984531

llvm-svn: 173361
2013-01-24 19:14:47 +00:00
Eric Christopher 45f2e71571 Add support for passing the main file name down to the assembler
for location information.

Part of PR14624

llvm-svn: 170391
2012-12-18 00:31:10 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Bob Wilson decc03efe8 Reapply a subset of r167567 to clean up Darwin-specific code for invoking gcc.
Unlike my previous attempt at this, this patch leaves intact the check for
whether clang can handle the input file type, and for non-Darwin toolchains it
will invoke gcc for things it cannot handle. For Darwin toolchains, the
behavior reported in pr14338 still occurs with this patch, but that is a
definite improvement from what happens currently, where it just crashes with
an assertion failure.

llvm-svn: 168505
2012-11-23 06:14:39 +00:00
Nick Lewycky 5cc9ebb723 Revert r167567, restoring the ability of clang to run gcc in cases where it
can't handle the input file type. This resulted in PR14338.

llvm-svn: 168024
2012-11-15 05:36:36 +00:00
Bob Wilson 0c79f3cf3e Rip out a bunch of code for invoking gcc from clang.
llvm-svn: 167567
2012-11-08 01:03:34 +00:00
Rafael Espindola dcbf698dde getArchTypeForDarwinArchName is only used in the clang driver, copy it there.
I will remove it from llvm in the next commit.

llvm-svn: 167156
2012-10-31 18:51:07 +00:00
Bill Wendling 3b2000fcac During LTO, we call 'dsymutil' when we compile source files. This necessitates
clang specifying a temporary file that it later cleans up so that it can survive
the linking stage. However, when we compile object files during LTO we don't
call 'dsymutil'. That's done at a different stage (if at all). We rely upon the
linker to specify a unique name for the temporary file it generates.
<rdar://problem/12401423>

llvm-svn: 165028
2012-10-02 18:02:50 +00:00
Eli Friedman 9fa2885522 clang support for Bitrig (an OpenBSD fork); patch by David Hill.
llvm-svn: 161546
2012-08-08 23:57:20 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Hal Finkel 8eb5928514 Add PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.
This functionality is based on what is done on ARM, and enables selecting PPC CPUs
in a way compatible with gcc's driver. Also, mirroring gcc (and what is done on x86),
-mcpu=native support was added. This uses the host cpu detection from LLVM
(which will also soon be updated by refactoring code currently in backend).

In order for this to work, the target needs a list of valid CPUs -- we now accept all CPUs accepted by LLVM.
A few preprocessor defines for common CPU types have been added.

llvm-svn: 158334
2012-06-11 22:35:19 +00:00
Chad Rosier bee5a1df03 [driver] Don't try to generate diagnostic information for linker crashes.
rdar://10993648

llvm-svn: 152180
2012-03-07 00:30:40 +00:00
David Chisnall a9ed5d76b4 Fix copy-and-paste error in comment
llvm-svn: 150587
2012-02-15 16:25:46 +00:00
David Chisnall f571cde869 First pass at Solaris toolchain support. This version compiles and links hello
world on Solaris 11 for both x86 and x86-64 using the built-in assembler and
Solaris (not GNU) ld, however it currently relies on a hard-coded GCC location
to find crtbegin.o and crtend.o, as well as libgcc and libgcc_eh.  

llvm-svn: 150580
2012-02-15 13:39:01 +00:00
Jim Grosbach 576452b830 Have the driver pass CPU and target feature information to cc1as.
When creating the MCSubtargetInfo, the assembler driver uses the CPU and
feature string to construct a more accurate model of what instructions
are and are not legal.

rdar://10840476

llvm-svn: 150273
2012-02-10 20:37:10 +00:00
Joerg Sonnenberger d64c60e534 Remove the ToolTriple logic in NetBSD, which was completely broken by
the recent refactoring. All interesting NetBSD release have a GNU as
version on i386 that supports --32, so don't bother with the conditional
setting of it.

llvm-svn: 149087
2012-01-26 22:27:52 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Tony Linthicum 76329bf83f Hexagon backend support
llvm-svn: 146413
2011-12-12 21:14:55 +00:00
Peter Collingbourne 9b515cb0ec Add the depfile as a result file so that it is deleted if we crash,
and prevent the diagnostic preprocessor run from writing a depfile.

llvm-svn: 143846
2011-11-06 00:40:05 +00:00
Eric Christopher 551ef45e85 Add support for a verifier to the driver. Currently only verifies debug
output on darwin so is hard coded there.

As a note this will need a little bit of refactoring in the class
hierarchy to separate it out for different verifiers based on input type.

Fixes rdar://8256258.

llvm-svn: 138343
2011-08-23 17:56:55 +00:00
Chad Rosier bc5ea3d4b9 [driver] Clang doesn't support -mkernel/-fapple-kext for i386, so it's
automatically invoking llvm-gcc's cc1plus, which doesn't support all options
supported by Clang.  Therefore, filter out unsupported options.
rdar://9964354

llvm-svn: 137842
2011-08-17 18:24:55 +00:00
Joerg Sonnenberger 4eb724ffdf Fix typo. From Damjan Marion.
llvm-svn: 133511
2011-06-21 08:45:08 +00:00
Joerg Sonnenberger 637603a7cc Make the triple an explicit argument of FindTargetProgramPath.
Preserve the original triple in the NetBSD toolchain when using -m32 or
-m64 and the resulting effective target is different from the triple it
started with. This allows -m32 to use the same assembler/linking in
cross-compiling mode and avoids confusion about passing down target
specific flags in that case like --32.

llvm-svn: 131404
2011-05-16 13:35:02 +00:00
Daniel Dunbar c9388c11f1 Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.
llvm-svn: 127815
2011-03-17 17:10:06 +00:00
Benjamin Kramer 24f1d3e60a Add NetBSD target support. Patch by Joerg Sonnenberger.
llvm-svn: 124736
2011-02-02 18:59:27 +00:00
Bruno Cardoso Lopes e7f211c89f Add support for soft/hard float options to the Sparc target
llvm-svn: 118514
2010-11-09 17:21:19 +00:00
Rafael Espindola c8f008f649 Use ld directly on linux. Changes from the previous try:
*) Try to detect as much as possible from the system itself, not the distro.
   This should make it easier to port to a new distro and more likely to
   work on a unknown one.
*) The distro enum now doesn't include the arch. Just use the existing
   host detection support in LLVM.
*) Correctly handle --sysroot.

A small regression is that now clang will pass bitcode file to the linker.
This is necessary for the gold plugin support to work.

It might be better to detect this at configure/cmake time, but doing it in
c++ first is a lot easier.

llvm-svn: 118382
2010-11-07 20:14:31 +00:00
Rafael Espindola b2cbd85be8 Revert while I debug test failures :-(
llvm-svn: 118150
2010-11-03 04:43:56 +00:00
Rafael Espindola c5dfb607f5 Switch clang to run ld directly on linux. I tested this on all the linux
distros listed by running

gcc main.o -o main
g++ main.o -o main
gcc main.o -o main -static
g++ main.o -o main -static
gcc f.o -o f.so -shared
g++ f.o -o f.so -shared

and comparing the ld line with the one created by clang. I also added
-m32/m64 in distros that support it.

While I tested many distros, there will always be more. If you are hit by this
it should be somewhat easy to add your distro. If you are in a hurry, do
revert this, but please inform how to detect you distro and the ld command
lines produced by the above gcc invocations. Most distros have some patches
on gcc :-(

llvm-svn: 118149
2010-11-03 04:37:51 +00:00
Daniel Dunbar ccbc45262b Driver/Darwin: Make the compilation object available in AddLinkArgs.
llvm-svn: 113549
2010-09-09 21:51:05 +00:00
Michael J. Spencer b186bc3c4b Visual Studio tools used on win32 hosts when targeting win32.
llvm-svn: 111748
2010-08-21 21:55:07 +00:00
Rafael Espindola 92b0093112 Run the assembler instead of gcc on Linux.
llvm-svn: 110635
2010-08-10 00:25:48 +00:00
Daniel Dunbar 7fbaf53470 Driver: Add Compilation::addCommand and switch tools to using it, now that we
don't have to deal with nested jobs.

llvm-svn: 110015
2010-08-02 02:38:28 +00:00
Daniel Dunbar bffefc015e Driver: Eliminate now unnecessary tool hooks for whether they accept piped input/output.
llvm-svn: 110012
2010-08-02 02:38:18 +00:00
Chris Lattner 3e2ee147d0 add driver support for minix, patch by Kees van Reeuwijk
from PR7583

llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Daniel Dunbar 8829962030 Driver: Add an explicit dsymutil action.
llvm-svn: 105474
2010-06-04 18:28:36 +00:00
Daniel Dunbar 1cb532ca28 Driver: Add Tool::ShortName, intended to be a human readable name for the tool.
llvm-svn: 104416
2010-05-22 00:37:18 +00:00
Daniel Dunbar 4f5e79c67d Driver: Add a tool definition for the Clang integrated assembler.
llvm-svn: 104280
2010-05-20 21:30:13 +00:00
Duncan Sands af260b9945 VISIBILITY_HIDDEN was renamed LLVM_LIBRARY_VISIBILITY.
llvm-svn: 103494
2010-05-11 20:16:05 +00:00
Daniel Dunbar 3d45e17d15 Driver: Add a Tool::hasGoodDiagnostics hook, and use it to simplify logic for
deciding when we need to emit an extra "command failed" diagnostic.
 - This also fixes the case where we were emitting that extra diagnostics, even
   when using clang w/ the integrated assembler, which has good diagnostics.

llvm-svn: 100529
2010-04-06 17:07:49 +00:00
Eric Christopher 0b26a616eb Add in some more MIPS command line options.
Patch by Oleksandr Tymoshenko!

llvm-svn: 97544
2010-03-02 02:41:08 +00:00
Daniel Dunbar c434394d18 Driver: Add -[no-]integrated-as for clang.
- Requires backend support, which only exists for i386--darwin currently.

No 'as' required:
--
ddunbar@ozzy:tmp$ cat t.c
int main() { return 42; }
ddunbar@ozzy:tmp$ clang -m32 -integrated-as t.c


ddunbar@ozzy:tmp$ ./a.out; echo $?
42
ddunbar@ozzy:tmp$
--

The random extra whitespace is how you know its working! :)

llvm-svn: 95194
2010-02-03 03:07:56 +00:00