| 1 |
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s |
| 2 |
|
| 3 |
__attribute__((section("A"))) |
| 4 |
const int a = 1; |
| 5 |
const int *f() { return &a; } |
| 6 |
// CHECK: @_ZL1a = internal constant i32 1, section "A" |
| 7 |
|
| 8 |
int init(); |
| 9 |
__attribute__((section("B"))) |
| 10 |
const int b = init(); |
| 11 |
// Even if it's const-qualified, it must not be LLVM IR `constant` since it's |
| 12 |
// dynamically initialised. |
| 13 |
// CHECK: @_ZL1b = internal global i32 0, section "B" |
| 14 |
|
| 15 |
__attribute__((section("C"))) |
| 16 |
int c = 2; |
| 17 |
// CHECK: @c = {{.*}}global i32 2, section "C" |
| 18 |
|
| 19 |
__attribute__((section("D"))) |
| 20 |
int d = init(); |
| 21 |
// CHECK: @d = {{.*}}global i32 0, section "D" |
| 22 |
|
| 23 |
__attribute__((section("E"))) |
| 24 |
int e; |
| 25 |
// CHECK: @e = {{.*}}global i32 0, section "E", align 4 |