Add a new metadata node `!implicit.ref` to represent an implicit dependency between 2 symbols. The metadata is unique to AIX and gets lowered to a relocation that adds an explicit link between the section the global that the metadata is placed on is allocated in, to the asscoiated symbol. This relocation will cause the associated symbol to remain live if the section is not garbage collected. This is used mainly for compiler features where there is some hidden runtime dependency between the symbols that isn't otherwise obvious to the linker.
56 lines
1.4 KiB
LLVM
56 lines
1.4 KiB
LLVM
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff < %s | \
|
|
; RUN: FileCheck %s -check-prefixes=NOFSECTS,CHECK
|
|
|
|
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff --function-sections < %s | \
|
|
; RUN: FileCheck %s -check-prefixes=FSECTS,CHECK
|
|
|
|
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
|
|
; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -check-prefix=OBJ %s
|
|
|
|
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff --function-sections -filetype=obj -o %t.o < %s
|
|
; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -check-prefix=FSECTOBJ %s
|
|
|
|
@a = global i32 1
|
|
@b = global i32 2
|
|
@c = global i32 3
|
|
|
|
define i32 @foo() !implicit.ref !0 {
|
|
ret i32 0
|
|
}
|
|
|
|
define i32 @bar() !implicit.ref !1 !implicit.ref !2 {
|
|
ret i32 0
|
|
}
|
|
|
|
!0 = !{ptr @a}
|
|
!1 = !{ptr @b}
|
|
!2 = !{ptr @c}
|
|
|
|
; NOFSECTS: .foo:
|
|
; FSECTS: .csect .foo[PR]
|
|
; CHECK: .ref a[RW]
|
|
|
|
; NOFSECTS: .bar:
|
|
; FSECTS: .csect .bar[PR]
|
|
; CHECK: .ref b[RW]
|
|
; CHECK: .ref c[RW]
|
|
|
|
; OBJ: Disassembly of section .text:
|
|
; OBJ: .foo:
|
|
; OBJ: li 3, 0
|
|
; OBJ: R_REF {{.*}} a[RW]
|
|
; OBJ: R_REF {{.*}} b[RW]
|
|
; OBJ: R_REF {{.*}} c[RW]
|
|
; OBJ: blr
|
|
; OBJ: .bar
|
|
|
|
; FSECTOBJ: .foo[PR]:
|
|
; FSECTOBJ: li 3, 0
|
|
; FSECTOBJ: R_REF {{.*}} a[RW]
|
|
; FSECTOBJ: blr
|
|
; FSECTOBJ: .bar[PR]:
|
|
; FSECTOBJ: li 3, 0
|
|
; FSECTOBJ: R_REF {{.*}} b[RW]
|
|
; FSECTOBJ: R_REF {{.*}} c[RW]
|
|
; FSECTOBJ: blr
|