summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/funique-sections.c13
-rw-r--r--clang/test/Driver/function-sections.c12
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGen/funique-sections.c b/clang/test/CodeGen/funique-sections.c
new file mode 100644
index 00000000000..1473fe57db0
--- /dev/null
+++ b/clang/test/CodeGen/funique-sections.c
@@ -0,0 +1,13 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang_cc1 -triple x86_64-pc-linux -S -ffunction-sections -fdata-sections -fno-unique-section-names -o - < %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux -S -ffunction-sections -fdata-sections -o - < %s | FileCheck %s --check-prefix=UNIQUE
+
+const int hello = 123;
+void world() {}
+
+// CHECK: .section .text,"ax",@progbits,unique
+// CHECK: .section .rodata,"a",@progbits,unique
+
+// UNIQUE: .section .text.world,"ax",@progbits
+// UNIQUE: .section .rodata.hello,"a",@progbits
diff --git a/clang/test/Driver/function-sections.c b/clang/test/Driver/function-sections.c
index fe6d303e3ec..ba065b1367a 100644
--- a/clang/test/Driver/function-sections.c
+++ b/clang/test/Driver/function-sections.c
@@ -4,6 +4,8 @@
// CHECK-NOFS-NOT: -ffunction-sections
// CHECK-DS: -fdata-sections
// CHECK-NODS-NOT: -fdata-sections
+// CHECK-US-NOT: -fno-unique-section-names
+// CHECK-NOUS: -fno-unique-section-names
// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
// RUN: -target i386-unknown-linux \
@@ -60,3 +62,13 @@
// RUN: -fdata-sections -fno-data-sections -fdata-sections \
// RUN: | FileCheck --check-prefix=CHECK-DS %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: -funique-section-names \
+// RUN: | FileCheck --check-prefix=CHECK-US %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: -fno-unique-section-names \
+// RUN: | FileCheck --check-prefix=CHECK-NOUS %s
OpenPOWER on IntegriCloud