[lld] 801971e - [LLD] [COFF] Improve the error message for too many exported symbols

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 06:59:21 PDT 2022


Author: Martin Storsjö
Date: 2022-07-20T16:58:29+03:00
New Revision: 801971e5b4c026a7941749cc1b3c7ac562577dda

URL: https://github.com/llvm/llvm-project/commit/801971e5b4c026a7941749cc1b3c7ac562577dda
DIFF: https://github.com/llvm/llvm-project/commit/801971e5b4c026a7941749cc1b3c7ac562577dda.diff

LOG: [LLD] [COFF] Improve the error message for too many exported symbols

Print the actual number of symbols that would have been exported
too, which helps assessing the situation.

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

Added: 
    

Modified: 
    lld/COFF/DriverUtils.cpp
    lld/test/COFF/export-limit.s

Removed: 
    


################################################################################
diff  --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index ac0f1f972c798..dbfbec16b1405 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -709,7 +709,7 @@ void assignExportOrdinals() {
     if (e.ordinal == 0)
       e.ordinal = ++max;
   if (max > std::numeric_limits<uint16_t>::max())
-    fatal("too many exported symbols (max " +
+    fatal("too many exported symbols (got " + Twine(max) + ", max " +
           Twine(std::numeric_limits<uint16_t>::max()) + ")");
 }
 

diff  --git a/lld/test/COFF/export-limit.s b/lld/test/COFF/export-limit.s
index 8936754ab2688..baf1f5d741c2f 100644
--- a/lld/test/COFF/export-limit.s
+++ b/lld/test/COFF/export-limit.s
@@ -5,7 +5,7 @@
 # RUN: lld-link -dll -noentry %t.obj -out:%t.dll -def:%t-65535.def
 # RUN: env LLD_IN_TEST=1 not lld-link -dll -noentry %t.obj -out:%t.dll -def:%t-65536.def 2>&1 | FileCheck %s
 
-# CHECK: error: too many exported symbols
+# CHECK: error: too many exported symbols (got 65536, max 65535)
 
         .text
         .globl f


        


More information about the llvm-commits mailing list