hanchenye-llvm-project/clang
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
..
INPUTS For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this is 2012-04-04 06:24:32 +00:00
bindings/python [clang.py] Implement Cursor.objc_type_encoding 2012-03-10 22:23:27 +00:00
docs [Lex] Add support for 'user specified system frameworks' (see test case). 2012-04-05 17:10:06 +00:00
examples clang-interpreter/Makefile: [PR12313] Update USEDLIBS to add clangEdit. 2012-03-21 06:25:42 +00:00
include Teach Clang about PIE compilations. This is the first step of PR12380. 2012-04-08 16:40:35 +00:00
lib Teach Clang about PIE compilations. This is the first step of PR12380. 2012-04-08 16:40:35 +00:00
runtime build/compiler-rt: Stop forcing off -integrated-as for compiler-rt builds. 2012-03-05 20:19:03 +00:00
test Teach Clang about PIE compilations. This is the first step of PR12380. 2012-04-08 16:40:35 +00:00
tools [Cygwin] Work around to flush stdout in a thread, or stdout in threads won't be flushed at exit. 2012-04-07 06:59:28 +00:00
unittests clangFrontend depends on clangEdit. 2012-04-04 12:25:11 +00:00
utils Remove the vestiges of the C backend. 2012-03-23 05:51:52 +00:00
www Forward-declared enumerations are now complete, except for an interaction 2012-03-26 20:31:41 +00:00
.gitignore
CMakeLists.txt CMake: install libclang.dll to $CMAKE_INSTALL_PREFIX/bin. 2012-02-25 16:46:50 +00:00
INSTALL.txt
LICENSE.TXT
Makefile
ModuleInfo.txt
NOTES.txt Add a note about a missing optimization in the case of virtual 2012-03-30 04:25:03 +00:00
README.txt commit access verified, revert change 2012-03-06 22:55:51 +00:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/