[PATCH] D102115: [LLD] [COFF] Add an assert regarding the RVA of exported symbols. NFC.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 8 14:05:15 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

As this isn't handled as a regular relocation, the normal handling of
maybeReportRelocationToDiscarded in Chunks.cpp doesn't apply here.

This would have caught the issue fixed by
82de4e075339f5ad8d68cfe31eb45b771d4750ae <https://reviews.llvm.org/rG82de4e075339f5ad8d68cfe31eb45b771d4750ae>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102115

Files:
  lld/COFF/DLL.cpp


Index: lld/COFF/DLL.cpp
===================================================================
--- lld/COFF/DLL.cpp
+++ lld/COFF/DLL.cpp
@@ -525,6 +525,8 @@
       if (e.forwardChunk) {
         write32le(p, e.forwardChunk->getRVA() | bit);
       } else {
+        assert(cast<Defined>(e.sym)->getRVA() != 0 &&
+               "Exported symbol unmapped");
         write32le(p, cast<Defined>(e.sym)->getRVA() | bit);
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102115.343866.patch
Type: text/x-patch
Size: 431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210508/5ae858ec/attachment.bin>


More information about the llvm-commits mailing list