Sean Fertile b6212a4caf
XCOFF associated metadata (#159096)
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.
2026-01-09 13:49:21 -05:00

32 lines
786 B
LLVM

; RUN: not llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
@a = global i32 1, !implicit.ref !0
@b = global i32 2, !implicit.ref !1
@c = global i32 3, !implicit.ref !1, !implicit.ref !2
@d = global i32 4, !implicit.ref !3
@e = external global i32, !implicit.ref !1
!0 = !{i32 1}
!1 = !{ptr @b}
!2 = !{!"Hello World!"}
!3 = !{ptr @c, ptr @a}
; CHECK: ref value must be pointer typed
; CHECK: ptr @a
; CHECK: !0 = !{i32 1}
; CHECK: values should not reference themselves
; CHECK: ptr @b
; CHECK: !1 = !{ptr @b}
; CHECK: ref metadata must be ValueAsMetadata
; CHECK: ptr @c
; CHECK: !2 = !{!"Hello World!"}
; CHECK: ref metadata must have one operand
; CHECK: ptr @d
; CHECK: !3 = !{ptr @c, ptr @a}
; CHECK: ref metadata must not be placed on a declaration
; CHECK: @e