xref: /llvm-project/clang/test/CodeGen/PowerPC/aix-roptr.c (revision 1b1f1b9079e2f01f963c6c7cd766d67029ba87cb)
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple=powerpc-ibm-aix-xcoff -mxcoff-roptr -fdata-sections \
3 // RUN:     -S <%s | FileCheck %s --check-prefix=CHECK32
4 // RUN: %clang_cc1 -triple=powerpc64-ibm-aix-xcoff -mxcoff-roptr -fdata-sections \
5 // RUN:     -S <%s | FileCheck %s --check-prefix=CHECK64
6 // RUN: not %clang_cc1 -triple=powerpc-ibm-aix-xcoff -mxcoff-roptr \
7 // RUN:     -S <%s 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR
8 // RUN: not %clang_cc1 -triple=powerpc64-ibm-aix-xcoff -mxcoff-roptr \
9 // RUN:     -S <%s 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR
10 // RUN: not %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -mxcoff-roptr \
11 // RUN:     %s 2>&1 | FileCheck %s --check-prefix=TARGET_ROPTR_ERR
12 
13 char c1 = 10;
14 char* const c1_ptr = &c1;
15 // CHECK32:         .csect c1_ptr[RO],2
16 // CHECK32-NEXT:	.globl	c1_ptr[RO]
17 // CHECK32-NEXT:	.align	2
18 // CHECK32-NEXT:	.vbyte	4, c1[RW]
19 
20 // CHECK64:         .csect c1_ptr[RO],3
21 // CHECK64-NEXT:	.globl	c1_ptr[RO]
22 // CHECK64-NEXT:	.align	3
23 // CHECK64-NEXT:	.vbyte	8, c1[RW]
24 
25 // DATA_SECTION_ERR: error: -mxcoff-roptr is supported only with -fdata-sections
26 // TARGET_ROPTR_ERR: error: unsupported option '-mxcoff-roptr' for target 'powerpc64le-unknown-linux-gnu'
27