[PATCH] D101615: [LLD] [COFF] Actually include the exported comdat symbols

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 12:13:27 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG82de4e075339: [LLD] [COFF] Actually include the exported comdat symbols (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101615

Files:
  lld/COFF/Driver.cpp
  lld/test/COFF/export-all.s


Index: lld/test/COFF/export-all.s
===================================================================
--- lld/test/COFF/export-all.s
+++ lld/test/COFF/export-all.s
@@ -4,6 +4,7 @@
 
 # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup at 12 %t.obj -implib:%t.lib
 # RUN: llvm-readobj --coff-exports %t.dll | grep Name: | FileCheck %s
+# RUN: llvm-readobj --coff-exports %t.dll | FileCheck %s --check-prefix=CHECK-RVA
 # RUN: llvm-readobj %t.lib | FileCheck -check-prefix=IMPLIB %s
 
 # CHECK: Name:
@@ -12,6 +13,13 @@
 # CHECK-NEXT: Name: foobar
 # CHECK-EMPTY:
 
+# CHECK-RVA: Name: comdatFunc
+# CHECK-RVA-NEXT: RVA: 0x1003
+# CHECK-RVA: Name: dataSym
+# CHECK-RVA-NEXT: RVA: 0x3000
+# CHECK-RVA: Name: foobar
+# CHECK-RVA-NEXT: RVA: 0x1001
+
 # IMPLIB: Symbol: __imp__comdatFunc
 # IMPLIB: Symbol: _comdatFunc
 # IMPLIB: Symbol: __imp__dataSym
@@ -33,7 +41,7 @@
   ret
 _unexported:
   ret
-.section .text at _comdatFunc,"xr",one_only,_comdatFunc
+.section .text$_comdatFunc,"xr",one_only,_comdatFunc
 _comdatFunc:
   ret
 .data
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -1205,6 +1205,11 @@
     if (!exporter.shouldExport(def))
       return;
 
+    if (!def->isGCRoot) {
+      def->isGCRoot = true;
+      config->gcroot.push_back(def);
+    }
+
     Export e;
     e.name = def->getName();
     e.sym = def;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101615.342823.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210504/8acbd134/attachment.bin>


More information about the llvm-commits mailing list