77 lines · plain
1;; Place a global object in the llvm.used list in a unique section with the SHF_GNU_RETAIN flag.2; RUN: llc -mtriple=x86_64 < %s | FileCheck %s3; RUN: llc -mtriple=x86_64 -data-sections=1 < %s | FileCheck %s4; RUN: llc -mtriple=x86_64 -no-integrated-as -binutils-version=2.36 < %s | FileCheck %s5; RUN: llc -mtriple=x86_64 -no-integrated-as -binutils-version=2.35 < %s | FileCheck %s --check-prefix=OLDGAS6;; Solaris uses the equivalent SHF_SUNW_NODISCARD flag, also represented as "R".7; RUN: llc -mtriple=x86_64-solaris < %s | FileCheck %s8 9; RUN: llc -mtriple=x86_64 -data-sections=1 -unique-section-names=0 < %s | FileCheck %s --check-prefix=NOUNIQUE10 11@llvm.used = appending global [10 x ptr] [12 ptr @fa, ptr @fb, ptr @fc,13 ptr @ga, ptr @gb, ptr @gc, ptr @gd, ptr @ge,14 ptr @aa, ptr @ab ], section "llvm.metadata"15 16; CHECK: .section .text.fa,"axR",@progbits{{$}}17; OLDGAS-NOT: .section .text18; NOUNIQUE: .section .text,"axR",@progbits,unique,119define dso_local void @fa() {20entry:21 ret void22}23 24; CHECK: .section .text.fb,"axR",@progbits{{$}}25; NOUNIQUE: .section .text,"axR",@progbits,unique,226define internal void @fb() {27entry:28 ret void29}30 31;; Explicit section.32; CHECK: .section ccc,"axR",@progbits,unique,133; OLDGAS: .section ccc,"ax",@progbits,unique,134; NOUNIQUE: .section ccc,"axR",@progbits,unique,335define dso_local void @fc() section "ccc" {36entry:37 ret void38}39 40; CHECK: .section .bss.ga,"awR",@nobits{{$}}41; OLDGAS: .bss{{$}}42; NOUNIQUE: .section .bss,"awR",@nobits,unique,443@ga = global i32 044 45; CHECK: .section .data.gb,"awR",@progbits{{$}}46; OLDGAS: .data{{$}}47; NOUNIQUE: .section .data,"awR",@progbits,unique,548@gb = internal global i32 249 50; CHECK: .section .rodata.gc,"aR",@progbits{{$}}51; OLDGAS: .section .rodata,"a",@progbits{{$}}52; NOUNIQUE: .section .rodata,"aR",@progbits,unique,653@gc = constant i32 354 55;; Explicit section.56; CHECK: .section ddd,"awR",@progbits,unique,257; OLDGAS: .section ddd,"aw",@progbits,unique,258; NOUNIQUE: .section ddd,"awR",@progbits,unique,759@gd = global i32 1, section "ddd"60 61;; Used together with !associated.62; CHECK: .section .data.ge,"awoR",@progbits,gc63; OLDGAS: .section .data.ge,"awo",@progbits,gc64; NOUNIQUE: .section .data,"awoR",@progbits,gc,unique,865@ge = global i32 1, !associated !066 67;; Aliases in llvm.used are ignored.68; CHECK: .section fff,"aw",@progbits{{$}}69; OLDGAS: .section fff,"aw",@progbits{{$}}70; NOUNIQUE: .section fff,"aw",@progbits{{$}}71@gf = global i32 1, section "fff"72 73@aa = alias i32, ptr @gf74@ab = internal alias i32, ptr @gf75 76!0 = !{ptr @gc}77