rui314 / mold

Mold: A Modern Linker šŸ¦ 
MIT License
14.21k stars 468 forks source link

Assertion failed: (got_idx != -1), function get_got_addr #750

Open erneestoc opened 2 years ago

erneestoc commented 2 years ago

Getting Assertion failed: (got_idx != -1), function get_got_addr, file mold.h, line 1017.

"/usr/local/bin/ld64.mold" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.profile_iossim.a -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -bundle -bundle_loader /Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/MockApp.app/MockApp -dead_strip -platform_version ios-simulator 14.0.0 15.5 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk -ObjC -o /Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/MockApp.app/PlugIns/SomeExampleTests.xctest/SomeExampleTests -L/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -filelist /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/SomeExampleTests.build/Objects-normal/arm64/SomeExampleTests.LinkFileList -rpath /usr/lib/swift -rpath @loader_path/Frameworks -rpath @executable_path/Frameworks -rpath @loader_path/Frameworks -object_path_lto /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/SomeExampleTests.build/Objects-normal/arm64/SomeExampleTests_lto.o -export_dynamic -no_deduplicate -objc_abi_version 2 -debug_variant -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/SomeExampleTests.build/Objects-normal/arm64/SomeExampleTests.swiftmodule -framework XCTest -framework FBSnapshotTestCase -framework TestCommon -lAhoyTestSupport -lAPIConfigurationTestSupport -lAuthUtilitiesTestSupport -lKeychainTestSupport -lNetworkingTestSupport -lUtilitiesTestSupport -framework RxBlocking -no_adhoc_codesign -dependency_info /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/SomeExampleTests.build/Objects-normal/arm64/SomeExampleTests_dependency_info.dat -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/AhoyTestSupport.build/Objects-normal/arm64/AhoyTestSupport.swiftmodule -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/APIConfigurationTestSupport.build/Objects-normal/arm64/APIConfigurationTestSupport.swiftmodule -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/AuthUtilitiesTestSupport.build/Objects-normal/arm64/AuthUtilitiesTestSupport.swiftmodule -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/KeychainTestSupport.build/Objects-normal/arm64/KeychainTestSupport.swiftmodule -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/NetworkingTestSupport.build/Objects-normal/arm64/NetworkingTestSupport.swiftmodule -add_ast_path /Users/myuser/DerivedData/Projects/Build/Intermediates.noindex/Projects.build/Debug-iphonesimulator/UtilitiesTestSupport.build/Objects-normal/arm64/UtilitiesTestSupport.swiftmodule -framework Foundation -lobjc -sectalign DATA llvm_prf_cnts 0x4000 -sectalign DATA llvm_prf_data 0x4000 -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.iossim.a -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/myuser/DerivedData/Projects/Build/Products/Debug-iphonesimulator -FCarthage/Build -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk/Developer/Library/Frameworks

I can try to tackle this issue with some guidance.

erneestoc commented 2 years ago

Suspecting this issue is a configuration error on my side. Would this error happen if I'm using different linkers on different targets and then try to link using mold?

rui314 commented 2 years ago

Wrong usage should be reported to the user with a proper error mesage, so an assertion failures are always a bug. I'll take a look at this. Thank you for reporting!

erneestoc commented 2 years ago

I'm working on an Xcode project with 150+ targets and multiple schemas to build different things. One for each of those 150 frameworks and their tests, and others for the main app and all of the tests. When I compile the framework and tests individually, it works flawlessly. It also works to compile and run the app, but when I try to compile tests for all of the targets, it randomly fails at different frameworks with the error above. šŸ‘†šŸ»

Do you have an idea of what it could be?