I tried again using the use_thinlto=yes
option. It went way faster, but also produced a lot more warnings about ignoring invalid debug info, and quite a few error messages. lld/clang hadn't displayed any error messages before, only SCons had mentioned an error.
Here are the error messages, I hope they're useful:
ld.lld-10: error: undefined symbol: register_module_types()
>>> referenced by main.cpp
>>> lto.tmp:(Main::setup2(unsigned long))
ld.lld-10: error: undefined symbol: unregister_module_types()
>>> referenced by main.cpp
>>> lto.tmp:(Main::cleanup())
ld.lld-10: error: undefined symbol: vtable for GDScriptTokenizerText
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(GDScriptTokenizerText::~GDScriptTokenizerText())
the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::set_code(String const&)
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_identifier(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_constant(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_error(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_line(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_line_indent(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_built_in_func(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptFunctions::get_func_name(GDScriptFunctions::Function)
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::_disassemble_class(Ref<GDScript> const&, Vector<String> const&))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::_parser_expr(GDScriptParser::Node const*))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::get_token_column(int) const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizerText::advance(int)
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptTokenizer::get_token_name(GDScriptTokenizer::Token)
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptParser::GDScriptParser()
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptParser::parse(String const&, String const&, bool, String const&, bool, Set<int, Comparator<int>, DefaultAllocator>*, bool)
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptParser::get_error_line() const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptParser::get_error_column() const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: undefined symbol: GDScriptParser::get_error() const
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
>>> referenced by test_gdscript.cpp
>>> lto.tmp:(TestGDScript::test(TestGDScript::TestType))
ld.lld-10: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.x11.opt.tools.64.llvm] Error 1
scons: building terminated because of errors.