brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 169c355 Raw
69 lines · c
1// RUN: %clang_cc1 %s -triple=powerpc-ibm-aix-xcoff -mtocdata=h,g,f,e,d,c,b,a,globalOneWithAlias,globalTwoWithAlias,ll,t3 -verify -emit-llvm -o - | FileCheck %s -check-prefix=CHECK --match-full-lines2// RUN: %clang_cc1 %s -triple=powerpc-ibm-aix-xcoff -mtocdata -verify=none -emit-llvm -o - | FileCheck %s -check-prefix=CHECK --match-full-lines3 4// none-no-diagnostics5 6struct large_struct {7  int x;8  short y;9  short z;10  char c;11};12 13struct large_struct a;                      // expected-warning {{-mtocdata option is ignored for a because variable is larger than a pointer}}14long long b = 5;                            // expected-warning {{-mtocdata option is ignored for b because variable is larger than a pointer}}15int __attribute__((aligned(128))) c = 0;    // expected-warning {{-mtocdata option is ignored for c because variable is aligned wider than a pointer}}16double d = 2.5;                             // expected-warning {{-mtocdata option is ignored for d because variable is larger than a pointer}}17int e __attribute__((section("foo"))) = 10; // expected-warning {{-mtocdata option is ignored for e because variable has a section attribute}}18__thread int f;                             // expected-warning {{-mtocdata option is ignored for f because of thread local storage}}19 20struct SomeStruct;21extern struct SomeStruct g;                 // expected-warning {{-mtocdata option is ignored for g because of incomplete type}}22 23extern int h[];                             // expected-warning {{-mtocdata option is ignored for h because of incomplete type}}24 25struct ty3 {26  int A;27  char C[];28};29struct ty3 t3 = { 4, "fo" }; // expected-warning {{-mtocdata option is ignored for t3 because it contains a flexible array member}}30 31int globalOneWithAlias = 10;32__attribute__((__alias__("globalOneWithAlias"))) extern int aliasOne; // expected-warning {{-mtocdata option is ignored for globalOneWithAlias because the variable has an alias}}33__attribute__((__alias__("globalTwoWithAlias"))) extern int aliasTwo; // expected-warning {{-mtocdata option is ignored for globalTwoWithAlias because the variable has an alias}}34int globalTwoWithAlias = 20;35 36 37int func() {38  return a.x+b+c+d+e+f+h[0];39}40 41struct SomeStruct* getAddress(void) {42  return &g;43}44 45int test() {46  return globalOneWithAlias + globalTwoWithAlias + aliasOne + aliasTwo;47}48 49long long test2() {50  static long long ll = 5;51  ll++;52  return ll;53}54 55// CHECK: @b = global i64 5, align 856// CHECK: @c = global i32 0, align 12857// CHECK: @d = global double 2.500000e+00, align 858// CHECK: @e = global i32 10, section "foo", align 459// CHECK: @globalOneWithAlias = global i32 10, align 460// CHECK: @globalTwoWithAlias = global i32 20, align 461// CHECK: @a = global %struct.large_struct zeroinitializer, align 462// CHECK: @f = thread_local global i32 0, align 463// CHECK: @h = external global [0 x i32], align 464// CHECK: @g = external global %struct.SomeStruct, align 1 65// CHECK: @test2.ll = internal global i64 5, align 866// CHECK: @aliasOne = alias i32, ptr @globalOneWithAlias67// CHECK: @aliasTwo = alias i32, ptr @globalTwoWithAlias68// CHECK-NOT: attributes #0 = { "toc-data" }69