Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -2142,6 +2142,12 @@ // what the input type is. if (Args.hasArg(OPT_fobjc_arc)) Res.getLangOpts()->ObjCAutoRefCount = 1; + // PIClevel and PIELevel are needed during code generation and this should be + // set regardless of the input type. + Res.getLangOpts()->PICLevel = getLastArgIntValue(Args, OPT_pic_level, + 0, Diags); + Res.getLangOpts()->PIELevel = getLastArgIntValue(Args, OPT_pie_level, + 0, Diags); parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), Diags, Res.getLangOpts()->Sanitize); } else {