[clang] [llvm] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 08:03:27 PDT 2023


================
@@ -0,0 +1,16 @@
+; RUN: not --crash llc -mtriple powerpc-ibm-aix-xcoff < %s 2>&1 | FileCheck %s --check-prefix CHECK-ERROR
+; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff < %s 2>&1 | FileCheck %s --check-prefix CHECK-ERROR
+
+ at a = global [5 x i16] zeroinitializer, align 2 #0
+
+; Function Attrs: noinline
+define i16 @foo() #1 {
+entry:
+  %0 = load i16, ptr @a, align 2
+  ret i16 %0
+}
+
+attributes #0 = { "toc-data" }
+attributes #1 = { noinline }
+
----------------
diggerlin wrote:

If I deleted the 
`; Function Attrs: noinline
define i16 @foo() #1 {
entry:
  %0 = load i16, ptr @a, align 2
  ret i16 %0
}`
 
and  
`attributes #1 = { noinline }`

it do not crash (I should be crash)

and it generate following Asm


```
.csect [PR],5
        .file   "<stdin>","IBM Open XL C/C++ for Linux on Power 17.1.2 (5725-C72, 5765-J20), version 17.1.2.0, LLVM version 18.0.0git"
        .toc
        .csect a[TD],2
        .globl  a[TD]                           # @a
        .align  1
        .space  10 

```
 if I understand correctly. It  should not generate a[TD] which is 10 bytes large than  8 bytes pointer size.




https://github.com/llvm/llvm-project/pull/67999


More information about the cfe-commits mailing list