Chris Lattner | 2e0110e | 2009-08-10 18:56:44 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s |
Anders Carlsson | 98883e1 | 2008-12-03 05:51:23 +0000 | [diff] [blame] | 2 | |
| 3 | // This checks that the global won't be marked as common. |
| 4 | // (It shouldn't because it's being initialized). |
| 5 | |
| 6 | int a; |
| 7 | int a = 242; |
Chris Lattner | 309457d | 2009-08-05 04:56:58 +0000 | [diff] [blame] | 8 | // CHECK: @a = global i32 242 |
| 9 | |
Chris Lattner | e78b86f | 2009-08-05 05:20:29 +0000 | [diff] [blame] | 10 | // This should get normal weak linkage. |
| 11 | int c __attribute__((weak))= 0; |
| 12 | // CHECK: @c = weak global i32 0 |
| 13 | |
| 14 | |
| 15 | |
| 16 | // Since this is marked const, it should get weak_odr linkage, since all |
| 17 | // definitions have to be the same. |
| 18 | // CHECK: @d = weak_odr constant i32 0 |
| 19 | const int d __attribute__((weak))= 0; |
| 20 | |
| 21 | |
| 22 | |
| 23 | // NOTE: tentative definitions are processed at the end of the translation unit. |
| 24 | |
Chris Lattner | 309457d | 2009-08-05 04:56:58 +0000 | [diff] [blame] | 25 | // This shouldn't be emitted as common because it has an explicit section. |
| 26 | // rdar://7119244 |
| 27 | int b __attribute__((section("foo"))); |
| 28 | |
| 29 | // CHECK: @b = global i32 0, section "foo" |
Chris Lattner | e78b86f | 2009-08-05 05:20:29 +0000 | [diff] [blame] | 30 | |