82 lines · plain
1# REQUIRES: aarch642# RUN: rm -rf %t; split-file %s %t3 4# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/explicit-selrefs-1.s -o %t/explicit-selrefs-1.o5# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/explicit-selrefs-2.s -o %t/explicit-selrefs-2.o6# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/implicit-selrefs.s -o %t/implicit-selrefs.o7 8# RUN: %lld -dylib -arch arm64 -lSystem -o %t/explicit-only-no-icf \9# RUN: %t/explicit-selrefs-1.o %t/explicit-selrefs-2.o -no_fixup_chains10# RUN: llvm-otool -vs __DATA __objc_selrefs %t/explicit-only-no-icf | \11# RUN: FileCheck %s --check-prefix=EXPLICIT-NO-ICF12 13## NOTE: ld64 always dedups the selrefs unconditionally, but we only do it when14## ICF is enabled.15# RUN: %lld -dylib -arch arm64 -lSystem -o %t/explicit-only-with-icf \16# RUN: %t/explicit-selrefs-1.o %t/explicit-selrefs-2.o -no_fixup_chains17# RUN: llvm-otool -vs __DATA __objc_selrefs %t/explicit-only-with-icf \18# RUN: | FileCheck %s --check-prefix=EXPLICIT-WITH-ICF19 20# SELREFS: Contents of (__DATA,__objc_selrefs) section21# SELREFS-NEXT: __TEXT:__objc_methname:foo22# SELREFS-NEXT: __TEXT:__objc_methname:bar23# SELREFS-NEXT: __TEXT:__objc_methname:foo24# SELREFS-NEXT: __TEXT:__objc_methname:length25# SELREFS-EMPTY:26 27# RUN: %lld -dylib -arch arm64 -lSystem --icf=all -o %t/explicit-and-implicit \28# RUN: %t/explicit-selrefs-1.o %t/explicit-selrefs-2.o %t/implicit-selrefs.o \29# RUN: -no_fixup_chains30# RUN: llvm-otool -vs __DATA __objc_selrefs %t/explicit-and-implicit \31# RUN: | FileCheck %s --check-prefix=EXPLICIT-AND-IMPLICIT32 33# EXPLICIT-NO-ICF: Contents of (__DATA,__objc_selrefs) section34# EXPLICIT-NO-ICF-NEXT: __TEXT:__objc_methname:foo35# EXPLICIT-NO-ICF-NEXT: __TEXT:__objc_methname:bar36# EXPLICIT-NO-ICF-NEXT: __TEXT:__objc_methname:bar37# EXPLICIT-NO-ICF-NEXT: __TEXT:__objc_methname:foo38 39# EXPLICIT-WITH-ICF: Contents of (__DATA,__objc_selrefs) section40# EXPLICIT-WITH-ICF-NEXT: __TEXT:__objc_methname:foo41# EXPLICIT-WITH-ICF-NEXT: __TEXT:__objc_methname:bar42 43# EXPLICIT-AND-IMPLICIT: Contents of (__DATA,__objc_selrefs) section44# EXPLICIT-AND-IMPLICIT-NEXT: __TEXT:__objc_methname:foo45# EXPLICIT-AND-IMPLICIT-NEXT: __TEXT:__objc_methname:bar46# EXPLICIT-AND-IMPLICIT-NEXT: __TEXT:__objc_methname:length47 48#--- explicit-selrefs-1.s49.section __TEXT,__objc_methname,cstring_literals50lselref1:51 .asciz "foo"52lselref2:53 .asciz "bar"54 55.section __DATA,__objc_selrefs,literal_pointers,no_dead_strip56.p2align 357 .quad lselref158 .quad lselref259 .quad lselref260 61#--- explicit-selrefs-2.s62.section __TEXT,__objc_methname,cstring_literals63lselref1:64 .asciz "foo"65 66.section __DATA,__objc_selrefs,literal_pointers,no_dead_strip67.p2align 368 .quad lselref169 70#--- implicit-selrefs.s71.text72.globl _objc_msgSend73.p2align 274_objc_msgSend:75 ret76 77.p2align 278_sender:79 bl _objc_msgSend$length80 bl _objc_msgSend$foo81 ret82