From 0074d38bee15c25d3f91d4f16f223ed0dca3f33f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 4 Mar 2013 01:27:49 +0000 Subject: [PATCH] Beef up the testing of our 'ld' invocation on linux to cover static linking. About to fix a bug here and there was no good test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176427 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../x86_64-unknown-linux/4.6.0/crtbeginT.o | 0 test/Driver/linux-ld.c | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbeginT.o diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbeginT.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbeginT.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 06be358860..e798942de8 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -18,12 +18,55 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-LD-64 %s // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-64: "--eh-frame-hdr" +// CHECK-LD-64: "-m" "elf_x86_64" +// CHECK-LD-64: "-dynamic-linker" // CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." // CHECK-LD-64: "-L[[SYSROOT]]/lib" // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib" +// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" +// CHECK-LD-64: "-lc" +// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: -static-libgcc \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC-LIBGCC %s +// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-64-STATIC-LIBGCC: "--eh-frame-hdr" +// CHECK-LD-64-STATIC-LIBGCC: "-m" "elf_x86_64" +// CHECK-LD-64-STATIC-LIBGCC: "-dynamic-linker" +// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" +// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" +// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." +// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/lib" +// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib" +// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh" +// CHECK-LD-64-STATIC-LIBGCC: "-lc" +// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: -static \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s +// CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-64-STATIC-NOT: "--eh-frame-hdr" +// CHECK-LD-64-STATIC: "-m" "elf_x86_64" +// CHECK-LD-64-STATIC-NOT: "-dynamic-linker" +// CHECK-LD-64-STATIC: "-static" +// CHECK-LD-64-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbeginT.o" +// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" +// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." +// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/lib" +// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib" +// CHECK-LD-64-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -m32 \ -- 2.40.0