blob: e166fb44659d3daf679f096c85282a685da1882a [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s
Anders Carlsson98883e12008-12-03 05:51:23 +00002
3// This checks that the global won't be marked as common.
4// (It shouldn't because it's being initialized).
5
6int a;
7int a = 242;
Chris Lattner309457d2009-08-05 04:56:58 +00008// CHECK: @a = global i32 242
9
Chris Lattnere78b86f2009-08-05 05:20:29 +000010// This should get normal weak linkage.
11int 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
19const int d __attribute__((weak))= 0;
20
21
22
23// NOTE: tentative definitions are processed at the end of the translation unit.
24
Chris Lattner309457d2009-08-05 04:56:58 +000025// This shouldn't be emitted as common because it has an explicit section.
26// rdar://7119244
27int b __attribute__((section("foo")));
28
29// CHECK: @b = global i32 0, section "foo"
Chris Lattnere78b86f2009-08-05 05:20:29 +000030