This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Rewrite reloc-types.test to use YAML. NFCI.
ClosedPublic

Authored by grimar on May 29 2019, 7:57 AM.

Details

Summary

This change rewrites and splits reloc-types.test
to use yaml2obj instead of precompiled binaries.
That allowed to remove 7 precompiled objects from the inputs.

I took the existent objects, used obj2yaml on them, simplified the result and
used yaml2obj in the test case with the result.

Notes:

  1. I converted, but did not remove relocs.obj.elf-i386, relocs.obj.elf-x86_64 or relocs.obj.elf-mips objects

because found they are used in other tests. I think it is bad practice to spread using
the precompiled objects with no reason and would be better to convert those tests
to use yaml instead too. Going to do that.

  1. I was unable to convert relocs.obj.elf-ppc64, because obj2yaml hangs on this file for me.

I'll take a look.

  1. I was unable to convert relocs.obj.macho-arm, relocs.obj.macho-i386 and relocs.obj.macho-x86_64

because the output produced by obj2yaml does not seem to be correct. Or at least I was unable to
use it with yaml2obj to make the existent tests pass.

  1. Because of the above I did not remove the script for creating all of those objects: test\tools\llvm-readobj\Inputs\relocs.py

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.May 29 2019, 7:57 AM

In addition:

  1. Previous version was broken in one place at least:
ELF-32: Type: R_386_IRELATIVE (42)
_LF-32: Type: R_386_NUM (43)
  1. Not all of the relocations are tested now. For example I know the next two are missing: R_X86_64_GOTPCRELX(41), R_X86_64_REX_GOTPCRELX(42)

With this patch it will be much easier to update the supported set.

MaskRay added inline comments.May 29 2019, 8:06 AM
test/tools/llvm-readobj/reloc-types.test
1 ↗(On Diff #201914)

This file is monstrous. Do you feel it should be split by binary format or by target?

If it isn't too much work I'd prefer these be split up as well. Otherwise this looks like a strict improvement to me!

grimar planned changes to this revision.May 30 2019, 1:01 AM

I do not mind to split it. Will update it soon then.

grimar updated this revision to Diff 202154.May 30 2019, 4:43 AM
  • Splitted the test as suggested.
  • Added 2 missing relocations mentioned for elf-x86_64 target.
MaskRay accepted this revision.May 30 2019, 5:24 AM

Thanks for doing this!

This revision is now accepted and ready to land.May 30 2019, 5:24 AM
grimar edited the summary of this revision. (Show Details)May 30 2019, 5:32 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2019, 5:37 AM
Herald added a subscriber: jrtc27. · View Herald Transcript
llvm/trunk/test/tools/llvm-readobj/reloc-types-macho-i386.test