[LLD] [COFF] Improve the error message for too many exported symbols
authorMartin Storsjö <martin@martin.st>
Mon, 18 Jul 2022 06:27:11 +0000 (09:27 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 20 Jul 2022 13:58:29 +0000 (16:58 +0300)
Print the actual number of symbols that would have been exported
too, which helps assessing the situation.

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

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

index ac0f1f9..dbfbec1 100644 (file)
@@ -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()) + ")");
 }
 
index 8936754..baf1f5d 100644 (file)
@@ -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