47 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o5 6## "_llvm." symbols are not special. LLD would produce duplicate symbol errors7## if they were not within the LLVM segment.8 9## 1/ Test that LLD does not produce duplicate symbols errors when linking global symbols10## with the same name under the LLVM segment.11# RUN: %lld -dylib %t/foo.o %t/bar.o -o %t/libDuplicate.dylib12 13## 2/ Test that all sections within an LLVM segment are dropped.14# RUN: llvm-objdump --section-headers %t/libDuplicate.dylib | FileCheck %s15 16# CHECK-LABEL: Sections:17# CHECK-NEXT: Idx Name Size VMA Type18# CHECK-NEXT: 0 __text 00000000 {{[0-9a-f]+}} TEXT19 20## 3/ Test that linking global symbol that is not under the LLVM segment produces duplicate21## symbols22# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin --defsym TEXT=0 %t/foo.s -o %t/foo.o23# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin --defsym TEXT=0 %t/bar.s -o %t/bar.o24# RUN: not %lld -dylib %t/foo.o %t/bar.o -o %t/libDuplicate.dylib 2>&1 | FileCheck %s --check-prefix=DUP25 26# DUP: error: duplicate symbol: _llvm.foo27 28#--- foo.s29.globl _llvm.foo30.ifdef TEXT31 .section __TEXT,__cstring32.else33 .section __LLVM,__bitcode34.endif35 _llvm.foo:36 .asciz "test"37 38#--- bar.s39.globl _llvm.foo40.ifdef TEXT41 .section __TEXT,__cstring42.else43 .section __LLVM,__bitcode44.endif45 _llvm.foo:46 .asciz "test"47