1 // RUN: %clang_cc1 -emit-llvm -triple i686-pc-win32 -fms-extensions -o - %s | FileCheck %s 2 3 extern "C" { 4 5 #pragma const_seg(".my_const") 6 #pragma bss_seg(".my_bss") 7 int D = 1; 8 #pragma data_seg(".data") 9 int a = 1; 10 #pragma data_seg(push, label, ".data2") 11 extern const int b; 12 const int b = 1; 13 const char* s = "my string!"; 14 #pragma data_seg(push, ".my_seg") 15 int c = 1; 16 #pragma data_seg(pop, label) 17 int d = 1; 18 int e; 19 #pragma bss_seg(".c") 20 int f; 21 void g(void){} 22 #pragma code_seg(".my_code") 23 void h(void){} 24 #pragma bss_seg() 25 int i; 26 #pragma bss_seg(".bss1") 27 #pragma bss_seg(push, test, ".bss2") 28 #pragma bss_seg() 29 #pragma bss_seg() 30 int TEST1; 31 #pragma bss_seg(pop) 32 int TEST2; 33 34 #pragma section("read_flag_section", read) 35 // Even though they are not declared const, these become constant since they are 36 // in a read-only section. 37 __declspec(allocate("read_flag_section")) int unreferenced = 0; 38 extern __declspec(allocate("read_flag_section")) int referenced = 42; 39 int *user() { return &referenced; } 40 41 } 42 43 //CHECK: @D = global i32 1 44 //CHECK: @a = global i32 1, section ".data" 45 //CHECK: @b = constant i32 1, section ".my_const" 46 //CHECK: @[[MYSTR:.*]] = {{.*}} unnamed_addr constant [11 x i8] c"my string!\00" 47 //CHECK: @s = global i8* getelementptr inbounds ([11 x i8]* @[[MYSTR]], i32 0, i32 0), section ".data2" 48 //CHECK: @c = global i32 1, section ".my_seg" 49 //CHECK: @d = global i32 1, section ".data" 50 //CHECK: @e = global i32 0, section ".my_bss" 51 //CHECK: @f = global i32 0, section ".c" 52 //CHECK: @i = global i32 0 53 //CHECK: @TEST1 = global i32 0 54 //CHECK: @TEST2 = global i32 0, section ".bss1" 55 //CHECK: @unreferenced = constant i32 0, section "read_flag_section" 56 //CHECK: @referenced = constant i32 42, section "read_flag_section" 57 //CHECK: define void @g() 58 //CHECK: define void @h() {{.*}} section ".my_code" 59