diff --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h --- a/lld/MachO/Symbols.h +++ b/lld/MachO/Symbols.h @@ -171,9 +171,13 @@ uint64_t getFileOffset() const override; + bool isWeakDef() const override { return false; } + + bool isTlv() const override { return false; } + static constexpr StringRef name = "___dso_handle"; - static bool classof(const Symbol *s) { return s->kind() == DefinedKind; } + static bool classof(const Symbol *s) { return s->kind() == DSOHandleKind; } }; union SymbolUnion { diff --git a/lld/test/MachO/dso-handle.s b/lld/test/MachO/dso-handle.s --- a/lld/test/MachO/dso-handle.s +++ b/lld/test/MachO/dso-handle.s @@ -3,14 +3,17 @@ # RUN: lld -flavor darwinnew %t.o -o %t # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s -# CHECK: leaq {{.*}} # 100000000 +# CHECK: leaq {{.*}} # 100000000 +# CHECK-NEXT: leaq {{.*}} # 100000000 # RUN: lld -flavor darwinnew -dylib %t.o -o %t.dylib # RUN: llvm-objdump -d --no-show-raw-insn %t.dylib | FileCheck %s --check-prefix=DYLIB-CHECK -# DYLIB-CHECK: leaq {{.*}} # 0 +# DYLIB-CHECK: leaq {{.*}} # 0 +# DYLIB-CHECK-NEXT: leaq {{.*}} # 0 .globl _main .text _main: leaq ___dso_handle(%rip), %rdx + movq ___dso_handle@GOTPCREL(%rip), %rdx ret