From c4015d3291e3d58741287b72026c15ce48eaf93c Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Fri, 21 Aug 2015 04:14:55 +0000 Subject: Stop treating -static as overriding -fPIC: they are distinct. For some reason, clang had been treating a command like: clang -static -fPIC foo.c as if it should be compiled without the PIC relocation model. This was incorrect: -static should be affecting only the linking model, and -fPIC only the compilation. This new behavior also matches GCC. This is a follow-up from a review comment on r245447. Differential Revision: http://reviews.llvm.org/D12208 llvm-svn: 245667 --- clang/lib/Driver/Tools.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'clang/lib/Driver') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 237a244fb98..ba5dad5466f 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3021,12 +3021,10 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &Triple, if (PIC && ToolChain.getTriple().isOSDarwin()) IsPICLevelTwo |= ToolChain.isPICDefault(); - // Note that these flags are trump-cards. Regardless of the order w.r.t. the - // PIC or PIE options above, if these show up, PIC is disabled. + // This kernel flags are a trump-card: they will disable PIC/PIE + // generation, independent of the argument order. if (KernelOrKext && (!Triple.isiOS() || Triple.isOSVersionLT(6))) PIC = PIE = false; - if (Args.hasArg(options::OPT_static)) - PIC = PIE = false; if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) { // This is a very special mode. It trumps the other modes, almost no one -- cgit v1.2.3