@@ -1822,10 +1822,11 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
18221822 ctx.in .iplt ->addSymbols ();
18231823
18241824 if (ctx.arg .unresolvedSymbolsInShlib != UnresolvedPolicy::Ignore) {
1825- auto diagnose =
1826- ctx.arg .unresolvedSymbolsInShlib == UnresolvedPolicy::ReportError
1827- ? errorOrWarn
1828- : warn;
1825+ auto diag =
1826+ ctx.arg .unresolvedSymbolsInShlib == UnresolvedPolicy::ReportError &&
1827+ !ctx.arg .noinhibitExec
1828+ ? DiagLevel::Err
1829+ : DiagLevel::Warn;
18291830 // Error on undefined symbols in a shared object, if all of its DT_NEEDED
18301831 // entries are seen. These cases would otherwise lead to runtime errors
18311832 // reported by the dynamic linker.
@@ -1850,14 +1851,14 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
18501851 if (sym->dsoDefined )
18511852 continue ;
18521853 if (sym->isUndefined () && !sym->isWeak ()) {
1853- diagnose ( " undefined reference: " + toString (*sym) +
1854- " \n >>> referenced by " + toString (file) +
1855- " (disallowed by --no-allow-shlib-undefined)" ) ;
1854+ ELFSyncStream (ctx, diag)
1855+ << " undefined reference: " << sym << " \n >>> referenced by "
1856+ << file << " (disallowed by --no-allow-shlib-undefined)" ;
18561857 } else if (sym->isDefined () &&
18571858 sym->computeBinding (ctx) == STB_LOCAL) {
1858- diagnose ( " non-exported symbol ' " + toString (*sym) + " ' in ' " +
1859- toString ( sym-> file ) + " ' is referenced by DSO '" +
1860- toString ( file) + " '" ) ;
1859+ ELFSyncStream (ctx, diag)
1860+ << " non-exported symbol ' " << sym << " ' in '" << sym-> file
1861+ << " ' is referenced by DSO ' " << file << " '" ;
18611862 }
18621863 }
18631864 }
0 commit comments