This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj/elf] - Refine testing of broken Android's packed relocation sections.
ClosedPublic

Authored by grimar on Aug 12 2020, 7:02 AM.

Details

Summary

This uses modern split-file tool to merge 5 packed-relocs-error*.s tests to a
new packed-relocs-errors.s and adds testing for GNU style.

Diff Detail

Event Timeline

grimar created this revision.Aug 12 2020, 7:02 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Aug 12 2020, 7:02 AM
MaskRay accepted this revision.Aug 13 2020, 9:31 PM

LGTM

llvm/test/tools/llvm-readobj/ELF/packed-relocs-errors.s
38

You can unify the comment markers while updating the tests.

This revision is now accepted and ready to land.Aug 13 2020, 9:31 PM
jhenderson added inline comments.Aug 14 2020, 12:54 AM
llvm/test/tools/llvm-readobj/ELF/packed-relocs-errors.s
9

I could easily be misunderstanding how the -triple argument works, but don't we need a -linux suffix on here to ensure an ELF object is produced (as opposed to e.g. COFF or Mach-O) on all platforms, regardless of their default triple?

grimar added inline comments.Aug 17 2020, 4:25 AM
llvm/test/tools/llvm-readobj/ELF/packed-relocs-errors.s
9

Hmm, good question. Honestly I did not know the answer before, but just few points I'd like to mention:

  1. I had no intention to change the tripple here, original objects are using x86_64-pc-linux-gnu and I think that just truncated the tripple, because copy pasted it from one of LLD(ELF) test cases.
  2. There are multiple LLD ELF tests that are using -triple=x86_64. I've verified that llvm-mc produces ELF inputs when running from windows environment. (It was very expected, since all these tests are known to pass on windows, but anyways..)
  3. Finally, I've debugged how tripples are parsed and the default OS for this case is always ELF: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/Triple.cpp#L665 I.e. a host OS doesn't matter here and when no OS is specified it fall backs to the default ELF one.

But I think that would be indeed slightly cleaner to specify an expected target OS in the tripple. So I am going to update this invocation to specify the x86_64-unknown-linux, which is also very commonly used by LLD tests (another popular variant is x86_64-pc-linux, btw). I think it might be slightly better than original x86_64-pc-linux-gnu, since there is nothing GNU specific in this tests.

grimar updated this revision to Diff 285964.Aug 17 2020, 4:37 AM
  • Use x86_64-unknown-linux tripple.
jhenderson accepted this revision.Aug 18 2020, 2:24 AM

LGTM, with nit.

llvm/test/tools/llvm-readobj/ELF/packed-relocs-errors.s
9

Thanks. I was under the impression there was CMake configuration variable to configure the default triple, but maybe that only applies in certain cases, and not here. I know @MaskRay often comments about the extra suffix bit for triples, so maybe he's got something to add.

38

I'm assuming this means '//' -> '##' for consistency. If so, +1 to that.

grimar added inline comments.Aug 18 2020, 2:25 AM
llvm/test/tools/llvm-readobj/ELF/packed-relocs-errors.s
38

Oops. I missed this one. Will do.

llvm/test/tools/llvm-readobj/ELF/packed-relocs-error3.s