Skip to content

[test][Linux] Improve Gold/LLD detection for function_sections.swift #73470

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

Merged
merged 1 commit into from
May 7, 2024

Conversation

drodriguez
Copy link
Contributor

@drodriguez drodriguez commented May 7, 2024

In #72061 the test was modified because LLD and Gold linker map formats are different, so they need different CHECKs. The original method in PR #72061 presents problems when the output is not exactly only one line.

These changes use the first line of the linker map file to decide if the Gold or the LLD linker map checks should be used, since the format differs in both for the first line.

This way of checking works in my Linux machine when using the default linker, when forcing Gold with -use-ld=gold and when forcing LLD with -use-ld=lld.

Additionally, the temporary directory is used for the outputs, or the non-temporary directory static archive libFunctionSections.a will get more and more temporary objects added to it as one runs the test suite (clang invokes ar as ar crs, which will "replace" the objects, but since clang is using a temporary object, the object names always have different suffixes, so nothing gets replaced).

In swiftlang#72061 the test was modified because LLD and Gold linker map formats
are different, so they need different CHECKs. The original method in
PR swiftlang#72061 presents problems when the output is not exactly only one
line.

These changes use the first line of the linker map file to decide if the
Gold or the LLD linker map checks should be used, since the format
differs in both for the first line.

This way of checking works in my Linux machine when using the default
linker, when forcing Gold with `-use-ld=gold` and when forcing LLD with
`-use-ld=lld`.
@drodriguez
Copy link
Contributor Author

@swift-ci please test

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

#73474
@swift-ci Please test macOS platform

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

Thanks for this. I was going to look at this this morning, but it looks like you've already found the problem.

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

Looking at the build failure at the moment.

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

Hmmm. Maybe it just didn't include the other fix we needed. My other PR built fine, and I can build locally just fine.

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

@swift-ci Please test macOS platform

@al45tair al45tair merged commit f6a2793 into swiftlang:main May 7, 2024
@drodriguez drodriguez deleted the function-sections-fix branch May 7, 2024 20:24
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