File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -651,6 +651,7 @@ static FunctionInfo getFunctionWeight(const Function &F)
651651}
652652
653653struct ModuleInfo {
654+ Triple triple;
654655 size_t globals;
655656 size_t funcs;
656657 size_t bbs;
@@ -661,6 +662,7 @@ struct ModuleInfo {
661662
662663ModuleInfo compute_module_info (Module &M) {
663664 ModuleInfo info;
665+ info.triple = Triple (M.getTargetTriple ());
664666 info.globals = 0 ;
665667 info.funcs = 0 ;
666668 info.bbs = 0 ;
@@ -1412,6 +1414,13 @@ static unsigned compute_image_thread_count(const ModuleInfo &info) {
14121414 LLVM_DEBUG (dbgs () << " 32-bit systems are restricted to a single thread\n " );
14131415 return 1 ;
14141416#endif
1417+ // COFF has limits on external symbols (even hidden) up to 65536. We reserve the last few
1418+ // for any of our other symbols that we insert during compilation.
1419+ if (info.triple .isOSBinFormatCOFF () && info.globals > 64000 ) {
1420+ LLVM_DEBUG (dbgs () << " COFF is restricted to a single thread for large images\n " );
1421+ return 1 ;
1422+ }
1423+
14151424 // This is not overridable because empty modules do occasionally appear, but they'll be very small and thus exit early to
14161425 // known easy behavior. Plus they really don't warrant multiple threads
14171426 if (info.weight < 1000 ) {
You can’t perform that action at this time.
0 commit comments