[lld] 518b7f9 - [LLD] [COFF] Add an assert regarding the RVA of exported symbols. NFC.

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 03:09:23 PDT 2021


Author: Martin Storsjö
Date: 2021-05-11T13:04:01+03:00
New Revision: 518b7f913526b5d002751edfa88869d10f5412fc

URL: https://github.com/llvm/llvm-project/commit/518b7f913526b5d002751edfa88869d10f5412fc
DIFF: https://github.com/llvm/llvm-project/commit/518b7f913526b5d002751edfa88869d10f5412fc.diff

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

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.

Differential Revision: https://reviews.llvm.org/D102115

Added: 
    

Modified: 
    lld/COFF/DLL.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp
index e88a6b1bffb06..5f6087182a801 100644
--- a/lld/COFF/DLL.cpp
+++ b/lld/COFF/DLL.cpp
@@ -525,6 +525,8 @@ class AddressTableChunk : public NonSectionChunk {
       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);
       }
     }


        


More information about the llvm-commits mailing list