xref: /llvm-project/lld/test/MachO/invalid/dso-handle-duplicate.s (revision d8283d9ddcc5e9ffda7e72ae122df279b2c5ee17)
1# REQUIRES: x86
2
3## If for some bizarre reason the input file defines its own ___dso_handle, we
4## should raise an error. At least, we've implemented this behavior if the
5## conflicting symbol is a global. A local symbol of the same name will still
6## take priority in our implementation, unlike in ld64. But that's a pretty
7## far-out edge case that should be safe to ignore.
8
9# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
10# RUN: not %lld -dylib %t.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t.o
11# CHECK:      error: duplicate symbol: ___dso_handle
12# CHECK-NEXT: >>> defined in [[FILE]]
13# CHECK-NEXT: >>> defined in <internal>
14
15.globl _main, ___dso_handle
16.text
17_main:
18  leaq ___dso_handle(%rip), %rdx
19  ret
20
21___dso_handle:
22  .space 1
23