[PATCH] Add PIC-level support to Clang.

Reid Kleckner rnk at google.com
Mon Nov 17 11:59:06 PST 2014


================
Comment at: lib/CodeGen/BackendUtil.cpp:428
@@ +427,3 @@
+  switch (LangOpts.PICLevel) {
+  default: break;
+  case 1: PL = llvm::PICLevel::Small; break;
----------------
rafael wrote:
> Don't you want to produce an error if -pic-level is not 1 or 2?
It's too easy for the user to try to do something like `clang -cc1 -pic-level 3 t.c` and crash the compiler with assert or llvm_unreachable. We should either clamp the level to [0-2] or issue a diagnostic in lib/Frontend/CompilerInvocation.cpp.

http://reviews.llvm.org/D5400






More information about the llvm-commits mailing list