Skip to content

[SourceKit] Link SwiftCompilerModules to SourceKit #42087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 29, 2022

This is required for SourceKit to parse Regex literals

Also link it to swift-ide-test too, to test IDE functionalities for regex literals.

rdar://90236990

@rintaro
Copy link
Member Author

rintaro commented Mar 29, 2022

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Mar 29, 2022

@swift-ci Please test macOS

@rintaro rintaro requested a review from eeckstein March 30, 2022 04:10
@rintaro
Copy link
Member Author

rintaro commented Mar 30, 2022

Hmm I can't reproduce the linker crash locally.

FAILED: lib/sourcekitd.framework/Versions/A/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService
...
0  0x107706970  __assert_rtn + 127
1  0x10770c3d6  ld::tool::OutputFile::writeAtoms(ld::Internal&, unsigned char*) (.cold.1) + 0
2  0x1076518d9  ld::tool::OutputFile::compressedOrdinalForAtom(ld::Atom const*) const + 335
3  0x107655df9  ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 1523
4  0x107646901  ld::tool::OutputFile::generateLinkEditInfo(ld::Internal&) + 1149
5  0x107640304  ld::tool::OutputFile::write(ld::Internal&) + 116
6  0x1075bfc35  main + 747
A linker snapshot was created at:
	/tmp/SourceKitService-2022-02-29-232110.ld-snapshot
ld: Assertion failed: (0 && "dylib not assigned ordinal"), function compressedOrdinalForAtom, file OutputFile.cpp, line 4973.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@eeckstein Do you know what causes this error?


# Workaround for a linker crash related to autolinking: rdar://77839981
set_property(TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS " -lobjc ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding -objc should workaround the linker crash. You add it here but according to the log file, it's not contained in the linker command line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LINK_FLAGS was overwritten by set_target_properties after this. Updated it to set_property(TARGET ... APPEND_STRING)

This is required for SourceKit to parse Regex literals

rdar://90236990
@rintaro rintaro force-pushed the sourcekit-lib-swiftcompilermodules-rdar90236990 branch from 49e4132 to 88e1905 Compare March 30, 2022 16:15
@rintaro
Copy link
Member Author

rintaro commented Mar 30, 2022

@swift-ci Please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rintaro rintaro merged commit 8f54a15 into swiftlang:main Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants