1 /* { dg-do compile { target nios2-*-linux-gnu } } */ 2 /* { dg-options "-O2 -fpic" } */ 3 /* { dg-final { scan-assembler-not "ldw\tr., %lo" } } */ 4 /* { dg-final { scan-assembler-not "stw\tr., %lo" } } */ 5 6 /* Check that address transformations for symbolic constants do NOT 7 apply to code compiled with -fPIC, which requires references to 8 go through the GOT pointer (r22) instead. */ 9 10 #define TYPE int 11 12 struct ss 13 { 14 TYPE x1,x2; 15 }; 16 17 extern TYPE S1; 18 extern TYPE S2[]; 19 20 extern struct ss S3; 21 extern struct ss S4[]; 22 addr1(void)23TYPE *addr1 (void) { return &S1; } get1(void)24TYPE get1 (void) { return S1; } set1(TYPE value)25void set1 (TYPE value) { S1 = value; } 26 addr2(int i)27TYPE *addr2 (int i) { return &(S2[i]); } get2(int i)28TYPE get2 (int i) { return S2[i]; } set2(int i,TYPE value)29void set2 (int i, TYPE value) { S2[i] = value; } 30 addr3(void)31TYPE *addr3 (void) { return &(S3.x2); } get3(void)32TYPE get3 (void) { return S3.x2; } set3(TYPE value)33void set3 (TYPE value) { S3.x2 = value; } 34 addr4(int i)35TYPE *addr4 (int i) { return &(S4[i].x2); } get4(int i)36TYPE get4 (int i) { return S4[i].x2; } set4(int i,TYPE value)37void set4 (int i, TYPE value) { S4[i].x2 = value; } 38 39