[PATCH] D86642: [lld-macho] Support GOT relocations to __dso_handle

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 17:44:57 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0407197711f1: [lld-macho] Support GOT relocations to __dso_handle (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86642/new/

https://reviews.llvm.org/D86642

Files:
  lld/MachO/Symbols.h
  lld/test/MachO/dso-handle.s


Index: lld/test/MachO/dso-handle.s
===================================================================
--- lld/test/MachO/dso-handle.s
+++ 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 at GOTPCREL(%rip), %rdx
   ret
Index: lld/MachO/Symbols.h
===================================================================
--- lld/MachO/Symbols.h
+++ 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86642.288492.patch
Type: text/x-patch
Size: 1329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200828/cf0c90e2/attachment.bin>


More information about the llvm-commits mailing list