This is an archive of the discontinued LLVM Phabricator instance.

[PPC64] Add test for toc-restore on recursive call.
ClosedPublic

Authored by sfertile on Sep 26 2018, 11:10 AM.

Details

Summary

A test verifying that toc restores are properly inserted following recursive calls, as well as briefly describing why they are needed.

Prompted by the discussion in https://reviews.llvm.org/D46204 related to older builds of libstdc++.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sfertile created this revision.Sep 26 2018, 11:10 AM
MaskRay added inline comments.Sep 26 2018, 11:29 AM
test/ELF/ppc64-toc-restore-recursive-call.s
42

Are these extra operations (addi, mulld, ...) needed to make the test feel more authentic?

45

Is this related to the behavior of powerpc gcc >= 5.0?

https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/powerpc.cc;hb=4e57b456393946cb4f90131b78e162cdec903c8a#l9069

We had a discussion in https://reviews.llvm.org/D46204 that pre-5 versions of GCC did not emit a nop after bl.

sfertile added inline comments.Sep 26 2018, 1:47 PM
test/ELF/ppc64-toc-restore-recursive-call.s
42

essentially. Its from one of the unit tests I wrote to figure out how we could have a recursive function call that crossed module boundaries, so I needed some 'testable' behavior.

45

Yes that discussion is what prompted this, this test is for documenting that we need the toc restore following the recursive call.

MaskRay accepted this revision.Sep 26 2018, 2:19 PM

LG (but please wait for the code owner).

Just a random grumble not related to this test:

  1. CHECK: 1003c: {{[0-9a-fA-F ]+}} bl .+67108804

We should really fix the address display in disassembler (it requires passing addresses in MC disassembler if I remember correctly)... (it makes llvm-objdump awkward to use while objdump provides a better display)

This revision is now accepted and ready to land.Sep 26 2018, 2:19 PM
ruiu accepted this revision.Sep 26 2018, 2:19 PM

LGTM

MaskRay added inline comments.Sep 26 2018, 2:33 PM
test/ELF/ppc64-toc-restore-recursive-call.s
42

And I asked about this because I found that ppc64 tests tend to be verbose while tests of other architectures usually only contain the construction that is relevant in question and very few set up.

The way other tests are organized make them outstanding what are being tested while I the verbosity has the merit that they feel more natural (the context may help understanding). I was just asking, not really have an opinion on what should be favored...

sfertile added inline comments.Sep 28 2018, 10:07 AM
test/ELF/ppc64-toc-restore-recursive-call.s
42

I appreciate the feedback. I definitely find the context helps my understanding , but can see how it obfuscates what exactly is being tested. I imagine that since I'm typically very familiar with the 'surrounding' extra code I probably tend to underestimate that effect as well :)

This revision was automatically updated to reflect the committed changes.