This is an archive of the discontinued LLVM Phabricator instance.

Fix test cases that check addresses that are not always invariable
Needs ReviewPublic

Authored by shenhan on May 11 2018, 11:31 AM.

Details

Summary

D45788 (later reverted) breaks a few test cases, because they check address that are not always invariable (under some condition).

All 4 test case failures are caused by the variable size of .dynstr, which contains absolute path to some .so file. So any section that are placed after .dynstr may have a variable address, check statements asserting those values are flaky.

D45788 makes this more likely to happen, because D45788 rearranges output sections, so .dynstr is usually placed at the beginning of "A" sections.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

shenhan created this revision.May 11 2018, 11:31 AM

Cool that you found the reason! Thanks! I suggest to fix it in a bit different way.

Lets use -soname to fix up the name in .dynstr.
I believe that you should be able to resolve this with a change of few invocations only then.
And no need to add additional comments. I think we already used this approach for the same.

test/ELF/relocation.s
3

Just add a -soname foo.so:

ld.lld %t2 -o %t2.so -shared -soname foo.so

Let do the next thing. I think there is no reason to have this patch separately as it makes sense only with D45788 together probably.
Please update the D45788 with this change suggested, I'll test it locally then.

Thanks for the review. Fixed as suggested in D45788.