teak-llvm/clang/test/Driver/android-pie.c
Evgeniy Stepanov d48c0cd910 Don't use -pie in relocatable link.
Summary:
Android, in particular, got PIE enabled by default in r316606. It resulted in
relocatable links passing both -r and -pie to the linker, which is not allowed.

Reviewers: srhines

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D44229

llvm-svn: 327165
2018-03-09 19:35:16 +00:00

84 lines
3.7 KiB
C

// NO-PIE-NOT: "-pie"
// PIE: "-pie"
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-androideabi \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android14 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android16 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android14 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android16 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android14 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android16 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-android \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android24 \
// RUN: | FileCheck --check-prefix=PIE %s
// Override toolchain default setting.
// RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi14 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 -no-pie -pie --target=arm-linux-androideabi24 \
// RUN: | FileCheck --check-prefix=PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 -no-pie --target=arm-linux-androideabi24 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 -nopie --target=arm-linux-androideabi24 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// RUN: %clang %s -### -o %t.o 2>&1 -pie -no-pie --target=arm-linux-androideabi24 \
// RUN: | FileCheck --check-prefix=NO-PIE %s
// Static/shared/relocatable disable -pie
// RUN: %clang %s -### --target=aarch64-linux-android -static 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-STATIC
// CHECK-STATIC-NOT: "-pie"
// CHECK-STATIC: -static
// RUN: %clang %s -### --target=aarch64-linux-android -shared 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-SHARED
// CHECK-SHARED-NOT: "-pie"
// CHECK-SHARED: "-shared"
// RUN: %clang %s -### --target=aarch64-linux-android -r 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-RELOCATABLE
// CHECK-RELOCATABLE-NOT: "-pie"
// CHECK-RELOCATABLE: "-r"