Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -3121,8 +3121,9 @@ const ArgList &Args) { // FIXME: why does this code...and so much everywhere else, use both // ToolChain.getTriple() and Triple? - bool PIE = ToolChain.isPIEDefault(); - bool PIC = PIE || ToolChain.isPICDefault(); + bool isStatic = Args.hasArg(options::OPT_static); + bool PIE = ToolChain.isPIEDefault() && !isStatic; + bool PIC = PIE || (ToolChain.isPICDefault() && !isStatic); bool IsPICLevelTwo = PIC; bool KernelOrKext = Index: test/Driver/pic.c =================================================================== --- test/Driver/pic.c +++ test/Driver/pic.c @@ -217,7 +217,7 @@ // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // // On OpenBSD, PIE is enabled by default, but can be disabled. // RUN: %clang -c %s -target amd64-pc-openbsd -### 2>&1 \