1+ ; REQUIRES: powerpc-registered-target, system-aix
2+
3+ ; This test verify that the CopyrightMetadataPass and the PowerPC AIX backend
4+ ; correctly lower and preserve copyright metadata emitted by Clang
5+ ; from `#pragma comment(copyright, "...")`.
6+
7+ ; Build IR with the pass:
8+ ; RUN: opt -passes=copyright-metadata %s -o %t.bc
9+
10+ ; ---------------- 32-bit AIX ----------------
11+ ; RUN: llc -mtriple=powerpc-ibm-aix -filetype=obj -o %t32.o %t.bc
12+ ; RUN: llc -mtriple=powerpc-ibm-aix -filetype=asm %t.bc -o - | FileCheck %s --check-prefix=CHECK-ASM
13+
14+ ; Verify that TU-local symbols and relocations reference the string.
15+ ; RUN: llvm-objdump -t %t32.o | FileCheck %s --check-prefix=CHECK-SYMS
16+ ; RUN: llvm-objdump -r %t32.o | FileCheck %s --check-prefix=CHECK-REL
17+
18+ ; ---------------- 64-bit AIX ----------------
19+ ; RUN: llc -mtriple=powerpc64-ibm-aix -filetype=obj -o %t64.o %t.bc
20+ ; RUN: llc -mtriple=powerpc-ibm-aix -filetype=asm %t.bc -o - | FileCheck %s --check-prefix=CHECK-ASM
21+ ; RUN: llvm-objdump -t %t64.o | FileCheck %s --check-prefix=CHECK-SYMS
22+ ; RUN: llvm-objdump -r %t64.o | FileCheck %s --check-prefix=CHECK-REL
23+
24+ target triple = "powerpc-ibm-aix"
25+
26+ define void @f0 () {
27+ entry:
28+ ret void
29+ }
30+
31+ define i32 @main () {
32+ entry:
33+ ret i32 0
34+ }
35+
36+ !llvm.module.flags = !{!0 }
37+ !0 = !{i32 1 , !"wchar_size" , i32 2 }
38+
39+ !aix.copyright.comment = !{!1 }
40+ !1 = !{!"Copyright IBM" }
41+
42+ ; ---------------- Assembly checks ----------------
43+ ; Verify that the backend:
44+ ; - Emits a `.ref` directive to tie the string to the TU
45+ ; - Emits the string in a dedicated read-only csect
46+ ;
47+ ; CHECK-ASM: .ref __aix_copyright_str
48+ ; CHECK-ASM: .csect __aix_copyright[RO],2
49+ ; CHECK-ASM-NEXT: .lglobl __aix_copyright_str
50+ ; CHECK-ASM: __aix_copyright_str
51+ ; CHECK-ASM: .string "Copyright IBM"
52+
53+ ; ---------------- Symbol table checks ----------------
54+ ; TU-local globals/functions should be present in the symbol table
55+ ; CHECK-SYMS: __aix_copyright_str
56+
57+ ; ---------------- Relocation checks ----------------
58+ ; The object should contain a relocation in the text section
59+ ; that references the copyright string.
60+ ; CHECK-LABEL: RELOCATION RECORDS FOR [.text]
61+ ; CHECK-REL: __aix_copyright_str
0 commit comments