[test][Linux] Improve Gold/LLD detection for function_sections.swift #73470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
invokesar
asar crs
, which will "replace" the objects, but sinceclang
is using a temporary object, the object names always have different suffixes, so nothing gets replaced).