Set __PIC__ (more) correctly.
 - Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68584 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 2843848..cca2e2c 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -620,6 +620,11 @@
          llvm::cl::desc("Optimization level"),
          llvm::cl::init(0));
 
+static llvm::cl::opt<unsigned>
+PICLevel("pic-level", llvm::cl::Prefix,
+         llvm::cl::desc("Value for __PIC__"),
+         llvm::cl::init(0));
+
 // FIXME: add:
 //   -fdollars-in-identifiers
 static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
@@ -769,6 +774,9 @@
   // -Os implies -O2
   if (Options.OptimizeSize || OptLevel)
     Options.Optimize = 1;
+
+  assert(PICLevel <= 2 && "Invalid value for -pic-level");
+  Options.PICLevel = PICLevel;
 }
 
 static llvm::cl::opt<bool>