summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/sections.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/sections.c')
-rw-r--r--clang/test/CodeGen/sections.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGen/sections.c b/clang/test/CodeGen/sections.c
index 8d93fed480e..4c59881b73b 100644
--- a/clang/test/CodeGen/sections.c
+++ b/clang/test/CodeGen/sections.c
@@ -31,6 +31,14 @@ int i;
int TEST1;
#pragma bss_seg(pop)
int TEST2;
+
+#pragma section("read_flag_section", read)
+// Even though they are not declared const, these become constant since they are
+// in a read-only section.
+__declspec(allocate("read_flag_section")) int unreferenced = 0;
+extern __declspec(allocate("read_flag_section")) int referenced = 42;
+int *user() { return &referenced; }
+
#ifdef __cplusplus
}
#endif
@@ -47,5 +55,7 @@ int TEST2;
//CHECK: @i = global i32 0
//CHECK: @TEST1 = global i32 0
//CHECK: @TEST2 = global i32 0, section ".bss1"
+//CHECK: @unreferenced = constant i32 0, section "read_flag_section"
+//CHECK: @referenced = constant i32 42, section "read_flag_section"
//CHECK: define void @g()
//CHECK: define void @h() {{.*}} section ".my_code"
OpenPOWER on IntegriCloud