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

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 13:15:32 PDT 2022


mstorsjo created this revision.
mstorsjo added reviewers: rnk, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130117

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


Index: lld/test/COFF/export-limit.s
===================================================================
--- lld/test/COFF/export-limit.s
+++ 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
Index: lld/COFF/DriverUtils.cpp
===================================================================
--- lld/COFF/DriverUtils.cpp
+++ lld/COFF/DriverUtils.cpp
@@ -709,7 +709,7 @@
     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()) + ")");
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130117.445923.patch
Type: text/x-patch
Size: 976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220719/5b7891fa/attachment.bin>


More information about the llvm-commits mailing list