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 @@ -650,6 +650,7 @@ static FunctionInfo getFunctionWeight(const Function &F)
650650}
651651
652652struct ModuleInfo {
653+ Triple triple;
653654 size_t globals;
654655 size_t funcs;
655656 size_t bbs;
@@ -660,6 +661,7 @@ struct ModuleInfo {
660661
661662ModuleInfo compute_module_info (Module &M) {
662663 ModuleInfo info;
664+ info.triple = Triple (M.getTargetTriple ());
663665 info.globals = 0 ;
664666 info.funcs = 0 ;
665667 info.bbs = 0 ;
@@ -1406,6 +1408,13 @@ static unsigned compute_image_thread_count(const ModuleInfo &info) {
14061408 LLVM_DEBUG (dbgs () << " 32-bit systems are restricted to a single thread\n " );
14071409 return 1 ;
14081410#endif
1411+ // COFF has limits on external symbols (even hidden) up to 65536. We reserve the last few
1412+ // for any of our other symbols that we insert during compilation.
1413+ if (info.triple .isOSBinFormatCOFF () && info.globals > 64000 ) {
1414+ LLVM_DEBUG (dbgs () << " COFF is restricted to a single thread for large images\n " );
1415+ return 1 ;
1416+ }
1417+
14091418 // This is not overridable because empty modules do occasionally appear, but they'll be very small and thus exit early to
14101419 // known easy behavior. Plus they really don't warrant multiple threads
14111420 if (info.weight < 1000 ) {
You can’t perform that action at this time.
0 commit comments