File tree 1 file changed +9
-0
lines changed 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -652,6 +652,7 @@ static FunctionInfo getFunctionWeight(const Function &F)
652
652
}
653
653
654
654
struct ModuleInfo {
655
+ Triple triple;
655
656
size_t globals;
656
657
size_t funcs;
657
658
size_t bbs;
@@ -662,6 +663,7 @@ struct ModuleInfo {
662
663
663
664
ModuleInfo compute_module_info (Module &M) {
664
665
ModuleInfo info;
666
+ info.triple = Triple (M.getTargetTriple ());
665
667
info.globals = 0 ;
666
668
info.funcs = 0 ;
667
669
info.bbs = 0 ;
@@ -1413,6 +1415,13 @@ static unsigned compute_image_thread_count(const ModuleInfo &info) {
1413
1415
LLVM_DEBUG (dbgs () << " 32-bit systems are restricted to a single thread\n " );
1414
1416
return 1 ;
1415
1417
#endif
1418
+ // COFF has limits on external symbols (even hidden) up to 65536. We reserve the last few
1419
+ // for any of our other symbols that we insert during compilation.
1420
+ if (info.triple .isOSBinFormatCOFF () && info.globals > 64000 ) {
1421
+ LLVM_DEBUG (dbgs () << " COFF is restricted to a single thread for large images\n " );
1422
+ return 1 ;
1423
+ }
1424
+
1416
1425
// This is not overridable because empty modules do occasionally appear, but they'll be very small and thus exit early to
1417
1426
// known easy behavior. Plus they really don't warrant multiple threads
1418
1427
if (info.weight < 1000 ) {
You can’t perform that action at this time.
0 commit comments