This is an archive of the discontinued LLVM Phabricator instance.

[MC] Fix DWARF forms for 64-bit DWARFv3 files [6/7]
ClosedPublic

Authored by ikudrin on Jun 4 2020, 5:14 AM.

Details

Summary

DW_FORM_sec_offset was introduced in DWARFv4, so, for 64-bit DWARFv3, DW_FORM_data8 should be used instead.

Diff Detail

Event Timeline

ikudrin created this revision.Jun 4 2020, 5:14 AM
dblaikie accepted this revision.Jun 4 2020, 10:57 AM

Looks good - thanks!

This revision is now accepted and ready to land.Jun 4 2020, 10:57 AM
MaskRay accepted this revision.Jun 4 2020, 11:15 AM

With one test change

llvm/test/MC/ELF/gen-dwarf64.s
4

--check-prefixes=REL,REL3

17

This REL can be REL-NEXT to prevent the accidental omission of check-prefixes=REL,REL3

jhenderson accepted this revision.Jun 5 2020, 12:37 AM

LGTM, once @MaskRay's comments have been addressed.

ikudrin updated this revision to Diff 268815.Jun 5 2020, 8:30 AM
ikudrin marked 3 inline comments as done.
  • Fixed the test.
ikudrin added inline comments.Jun 5 2020, 8:31 AM
llvm/test/MC/ELF/gen-dwarf64.s
4

Thanks!

17

There are other relocations for the .debug_info section which I did not want to check because they are irrelevant to the changes of these patches. So, I probably would not add the -NEXT suffix, if you do not mind.

dblaikie added inline comments.Jun 5 2020, 9:22 AM
llvm/test/MC/ELF/gen-dwarf64.s
17

At least a "REL-NOT: }" to check that you haven't accidentally jumped into another section's relocations might be useful? But really that'd have to go between every one of these check lines.

Perhaps llvm-readobj has flags that specify which sections to dump - and if you only dump the relocations for the sections you're interested in, then you could use an --implicit-check-not: Section, for instance - to ensure you didn't jump over any section headers.

ikudrin marked an inline comment as done.Jun 7 2020, 11:20 PM
ikudrin added inline comments.
llvm/test/MC/ELF/gen-dwarf64.s
17

You probably meant "REL-NOT: {", but that still would not have helped with missed ,REL3.

jhenderson added inline comments.Jun 8 2020, 12:51 AM
llvm/test/MC/ELF/gen-dwarf64.s
17

You could add a REL: } check to mark the end of the .rela.debug_info, which would allow for the next bit to be REL-NEXT, but that also wouldn't solve the problem.

This sounds like one of those FileCheck gotchas, and I can't see much we can do in the test to avoid it in this case. You could maybe use something like --implicit-check-not=.debug to show that there are no relocations targeting debug sections in the output except for those explicitly checked, maybe?

ikudrin updated this revision to Diff 269156.Jun 8 2020, 3:35 AM
ikudrin marked an inline comment as done.
  • Added --implicit-check-not="R_{{.*}} .debug_" to the test to ensure that all relocations to debug sections are checked.
llvm/test/MC/ELF/gen-dwarf64.s
17

That's a marvellous idea, thanks! I'll add --implicit-check-not="R_{{.*}} .debug_" to D81146 and D81148.

This revision was automatically updated to reflect the committed changes.