diff options
Diffstat (limited to 'test/CodeGenCXX/clang-sections.cpp')
-rw-r--r-- | test/CodeGenCXX/clang-sections.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/CodeGenCXX/clang-sections.cpp b/test/CodeGenCXX/clang-sections.cpp index 4fe42eaf77..59faf27679 100644 --- a/test/CodeGenCXX/clang-sections.cpp +++ b/test/CodeGenCXX/clang-sections.cpp @@ -29,17 +29,20 @@ int goo(void) { // my_text.2 static int lstat_h; // my_bss.2 return zoo(g, &lstat_h); } -#pragma clang section rodata="my_rodata.2" data="my_data.2" +#pragma clang section rodata="my_rodata.2" data="my_data.2" relro="my_relro.2" int l = 5; // my_data.2 extern const int m; const int m = 6; // my_rodata.2 + +typedef int (*fptr_t)(void); +const fptr_t fptrs[2] = {&foo, &goo}; #pragma clang section rodata="" data="" bss="" text="" int n; // default int o = 6; // default extern const int p; const int p = 7; // default int hoo(void) { - return b; + return b + fptrs[f](); } } //CHECK: @a = global i32 0, align 4 #0 @@ -62,17 +65,19 @@ int hoo(void) { //CHECK: @n = global i32 0, align 4 //CHECK: @o = global i32 6, align 4 //CHECK: @p = constant i32 7, align 4 +//CHECK: @_ZL5fptrs = internal constant [2 x i32 ()*] [i32 ()* @foo, i32 ()* @goo], align 4 #3 -//CHECK: define i32 @foo() #4 { -//CHECK: define i32 @goo() #5 { -//CHECK: declare i32 @zoo(i32*, i32*) #6 -//CHECK: define i32 @hoo() #7 { +//CHECK: define i32 @foo() #5 { +//CHECK: define i32 @goo() #6 { +//CHECK: declare i32 @zoo(i32*, i32*) #7 +//CHECK: define i32 @hoo() #8 { //CHECK: attributes #0 = { "bss-section"="my_bss.1" "data-section"="my_data.1" "rodata-section"="my_rodata.1" } //CHECK: attributes #1 = { "data-section"="my_data.1" "rodata-section"="my_rodata.1" } //CHECK: attributes #2 = { "bss-section"="my_bss.2" "rodata-section"="my_rodata.1" } -//CHECK: attributes #3 = { "bss-section"="my_bss.2" "data-section"="my_data.2" "rodata-section"="my_rodata.2" } -//CHECK: attributes #4 = { {{.*"implicit-section-name"="my_text.1".*}} } -//CHECK: attributes #5 = { {{.*"implicit-section-name"="my_text.2".*}} } -//CHECK-NOT: attributes #6 = { {{.*"implicit-section-name".*}} } +//CHECK: attributes #3 = { "bss-section"="my_bss.2" "data-section"="my_data.2" "relro-section"="my_relro.2" "rodata-section"="my_rodata.2" } +//CHECK: attributes #4 = { "relro-section"="my_relro.2" } +//CHECK: attributes #5 = { {{.*"implicit-section-name"="my_text.1".*}} } +//CHECK: attributes #6 = { {{.*"implicit-section-name"="my_text.2".*}} } //CHECK-NOT: attributes #7 = { {{.*"implicit-section-name".*}} } +//CHECK-NOT: attributes #8 = { {{.*"implicit-section-name".*}} } |