This is an archive of the discontinued LLVM Phabricator instance.

[test] Fix lld's ELF/linkerscript/thunk-gen-mips.s
ClosedPublic

Authored by thopre on May 1 2020, 3:29 PM.

Details

Summary

Lld test ELF/linkerscript/thunk-gen-mips.s was accidentally disabled due
to the use of wrong FileCheck directives. As a result the test seems to
have bitrotted as it fails to pass if fixing the directive. To ease
updates to the test in case of change of the start address the checks
have been changed to use numeric variables to express all the addresses
based on the
start address.

Diff Detail

Event Timeline

thopre created this revision.May 1 2020, 3:29 PM
thopre edited the summary of this revision. (Show Details)May 1 2020, 3:31 PM
MaskRay added inline comments.May 1 2020, 4:02 PM
lld/test/ELF/linkerscript/thunk-gen-mips.s
18–20

What does [[#%x, START_ADDR:<0x100000]] mean?

s/was/were/ I think

atanasyan accepted this revision.May 1 2020, 11:20 PM

LGTM

Initially the test case just checks that LLD does not crash under some conditions. It's not mandatory to test exact symbols' values and/or offsets between symbols. But after this fix the test additionally becomes more tolerant to exact symbol addresses. It's fine.
As to me, I'd remove the "Ideally we'd use..." comment.

This revision is now accepted and ready to land.May 1 2020, 11:20 PM
thopre marked 2 inline comments as done.May 2 2020, 2:37 PM
thopre added inline comments.
lld/test/ELF/linkerscript/thunk-gen-mips.s
18–20

It is not supported by FileCheck yet but the syntax for numeric expression was designed to allow for it. The meaning would be:

Match an lower case hex number (%x) that is less in value than 0x100000 and assign its value to START_ADDR. But reading the testcase again it is clear the address of start does not matter but only the offset of the 2 other symbols relative to it. Therefore I'm going to remove the 0x30 and just set START_ADDR to whatever is the address of start unconditionally.

thopre updated this revision to Diff 261667.May 2 2020, 2:38 PM
thopre marked an inline comment as done.

Set START_ADDR from llvm-objdump output instead of expecting 0x30.

thopre edited the summary of this revision. (Show Details)May 2 2020, 2:38 PM
This revision was automatically updated to reflect the committed changes.