llvm-project/clang/lib/Driver
Chandler Carruth c0c0455f55 Teach Clang about PIE compilations. This is the first step of PR12380.
First, this patch cleans up the parsing of the PIC and PIE family of
options in the driver. The existing logic failed to claim arguments all
over the place resulting in kludges that marked the options as unused.
Instead actually walk all of the arguments and claim them properly.

We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the
last one on the commandline. Previously there were lots of ordering bugs
that could creep in due to the nature of the parsing. Let me know if
folks would like weird things such as "-fPIE -fno-pic" to turn on PIE,
but disable full PIC. This doesn't make any sense to me, but we could in
theory support it.

Options that seem to have intentional "trump" status (-static, -mkernel,
etc) continue to do so and are commented as such.

Next, a -pie-level flag is threaded into the frontend, rigged to
a language option, and handled preprocessor, setting up the appropriate
defines. We'll now have the correct defines when compiling with -fpie.

The one place outside of the preprocessor that was inspecting the PIC
level (as opposed to the relocation model, which is set and handled
separately, yay!) is in the GNU ObjC runtime. I changed it to exactly
preserve existing behavior. If folks want to change its behavior in the
face of PIE, they can do that in a separate patch.

Essentially the only functionality changed here is the preprocessor
defines and bug-fixes to the argument management.

Tests have been updated and extended to test all of this a bit more
thoroughly.

llvm-svn: 154291
2012-04-08 16:40:35 +00:00
..
Action.cpp Add new code migrator support for migrating existing Objective-C code to use 2012-03-06 20:06:33 +00:00
Arg.cpp Basic: import SmallString<> into clang namespace 2012-02-05 02:13:05 +00:00
ArgList.cpp [driver] Parse diagnostic args in the driver. 2012-03-13 20:09:56 +00:00
CC1AsOptions.cpp Pack struct better. 2011-10-22 15:40:28 +00:00
CC1Options.cpp Pack struct better. 2011-10-22 15:40:28 +00:00
CMakeLists.txt Delete the driver's HostInfo class. This abstraction just never really 2012-01-25 11:01:57 +00:00
Compilation.cpp Add the depfile as a result file so that it is deleted if we crash, 2011-11-06 00:40:05 +00:00
Driver.cpp [driver] In general, the driver claims redundant args and uses the last arg. 2012-04-07 00:01:31 +00:00
DriverOptions.cpp Pack struct better. 2011-10-22 15:40:28 +00:00
InputInfo.h Driver: Eliminate special InputInfo kind for pipes, it is now unused. 2010-08-02 02:38:21 +00:00
Job.cpp Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:48:34 +00:00
Makefile BUILD_ARCHIVE is the default for libraries, no need to set it. 2010-07-18 00:14:47 +00:00
OptTable.cpp More missing header inclusions from llvm_unreachable migration. 2011-09-23 05:57:42 +00:00
Option.cpp Remove unnecessary default cases in switches over enums. 2012-01-17 02:30:50 +00:00
Phases.cpp Removing a bunch of dead returns/breaks after llvm_unreachables. 2011-09-23 20:26:49 +00:00
Tool.cpp Remove stray emacs mode markers in all these files that was causing emacs to 2010-12-31 17:31:54 +00:00
ToolChain.cpp ARM backend knows about cortex-m4. The front end should too. 2012-03-29 19:53:34 +00:00
ToolChains.cpp Fix using Clang as a cross compiler installed on a host machine and not 2012-04-06 16:32:06 +00:00
ToolChains.h Use VersionTuple to manage macosx versions in the driver. No functionality change. 2012-03-10 20:55:36 +00:00
Tools.cpp Teach Clang about PIE compilations. This is the first step of PR12380. 2012-04-08 16:40:35 +00:00
Tools.h [driver] Don't try to generate diagnostic information for linker crashes. 2012-03-07 00:30:40 +00:00
Types.cpp Use -rewrite-legacy-objc as clang argument for translating 2012-04-02 15:59:19 +00:00
WindowsToolChain.cpp [msvc] Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat. 2012-03-13 00:02:21 +00:00