summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-07-18 00:27:07 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-07-18 00:27:07 +0000
commit641d6452c92bbb41eb207365a757b8026c7083ff (patch)
treeb757b74c6b455a5738f067d9170917fb41a1ce4e /test/CodeGen
parent6a156a84aeb7cb74aa8b95639ae73e57fb2aaa04 (diff)
Re-land r337333, "Teach Clang to emit address-significance tables.",
which was reverted in r337336. The problem that required a revert was fixed in r337338. Also added a missing "REQUIRES: x86-registered-target" to one of the tests. Original commit message: > Teach Clang to emit address-significance tables. > > By default, we emit an address-significance table on all ELF > targets when the integrated assembler is enabled. The emission of an > address-significance table can be controlled with the -faddrsig and > -fno-addrsig flags. > > Differential Revision: https://reviews.llvm.org/D48155 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/addrsig.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGen/addrsig.c b/test/CodeGen/addrsig.c
new file mode 100644
index 0000000000..d7141092bb
--- /dev/null
+++ b/test/CodeGen/addrsig.c
@@ -0,0 +1,20 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux -S %s -faddrsig -O -o - | FileCheck --check-prefix=ADDRSIG %s
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux -S %s -O -o - | FileCheck --check-prefix=NO-ADDRSIG %s
+
+// ADDRSIG: .addrsig
+// ADDRSIG: .addrsig_sym g1
+// ADDRSIG-NOT: .addrsig_sym g2
+
+// NO-ADDRSIG-NOT: .addrsig
+
+extern const int g1[], g2[];
+
+const int *f1() {
+ return g1;
+}
+
+int f2() {
+ return g2[0];
+}