This is an archive of the discontinued LLVM Phabricator instance.

[NDS32 2/46] Add NDS32 ELF defines
Needs ReviewPublic

Authored by shiva0217 on Jan 12 2017, 11:10 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Add the necessary definitions for NDS32 ELF files, including relocs.
Also make necessary trivial change to ELFYaml, llvm-objdump, and llvm-readobj in order to work with NDS32 ELFs.

Diff Detail

Event Timeline

shiva0217 updated this revision to Diff 84229.Jan 12 2017, 11:10 PM
shiva0217 retitled this revision from to [NDS32 2/22] Add NDS32 ELF defines.
shiva0217 updated this object.
shiva0217 added a subscriber: llvm-commits.
joerg added a subscriber: joerg.Jan 13 2017, 4:14 AM

Test cases?

Test cases?

Hi joerg,
Did you mean add the test case like test/MC/NDS32/elf-reloc.s in https://reviews.llvm.org/D28659 ?
If so, should I move the test case to this patch ?
I reference https://reviews.llvm.org/D23558 and it didn't add testcases when adding ELF defines.
Could you help me to point out the right test I should add ?
Thanks.

davide added a subscriber: davide.Jan 16 2017, 12:26 AM

Please upload diffs with context git diff -U99999.
You need tests for each of the tools that dump: llvm-readobj/llvm-objdump (and yaml2elf/elf2yaml once/if yu add support for them). I'd suggest to add a line for each of the relocations that can be emitted (to have full coverage).

Test cases?

Hi joerg,
Did you mean add the test case like test/MC/NDS32/elf-reloc.s in https://reviews.llvm.org/D28659 ?
If so, should I move the test case to this patch ?
I reference https://reviews.llvm.org/D23558 and it didn't add testcases when adding ELF defines.
Could you help me to point out the right test I should add ?
Thanks.

To remove the dependency on llvm-mc you can probably just check-in a small binary.

joerg added a comment.Jan 16 2017, 2:02 AM

yaml2obj can be used for all the tests that need an object file. Just make sure the output is understood by binutils on the first round.

shiva0217 updated this revision to Diff 84646.Jan 17 2017, 2:45 AM

Thanks for the comments from @davide and @joerg.
That help me a lot.
I add a binary file "relocs.obj.elf-nds32" to fully cover the testing for relocation types
and "elf-nds32-rel.yaml" test case to test yaml2obj and obj2yaml.
Please let me know if I still missing something.

shiva0217 updated this revision to Diff 84939.Jan 18 2017, 10:38 PM

Fixup visitELF_NDS32_32 function.
Res should add Addend because we use RELA relocation.

shiva0217 updated this revision to Diff 88667.Feb 16 2017, 12:46 AM
shiva0217 retitled this revision from [NDS32 2/22] Add NDS32 ELF defines to [NDS32 2/46] Add NDS32 ELF defines.