This is an archive of the discontinued LLVM Phabricator instance.

[MC] Accept a numeric value as an ELF section header's type
ClosedPublic

Authored by atanasyan on Feb 8 2017, 8:13 AM.

Details

Summary

GAS supports specification of section header's type using a numeric value [1]. This patch brings the same functionality to LLVM. That allows to setup some target-specific section types belong to the SHT_LOPROC - SHT_HIPROC range. If we attempt to print unknown section type, MCSectionELF class shows an error message. It's better than print sole '@' sign without any section type name.

In case of MIPS, example of such section's type is SHT_MIPS_DWARF. Without the patch we will have to implement some workarounds in probably not-MIPS-specific part of code base to convert SHT_MIPS_DWARF to the @progbits while printing assembly and to assign SHT_MIPS_DWARF for @progbits sections named .debug_* if we encounter such section in an input assembly.

[1] https://sourceware.org/binutils/docs/as/Section.html

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Feb 8 2017, 8:13 AM
atanasyan edited the summary of this revision. (Show Details)Feb 23 2017, 4:05 PM
atanasyan edited the summary of this revision. (Show Details)Feb 24 2017, 12:32 AM
atanasyan updated this revision to Diff 91216.Mar 9 2017, 1:59 PM
atanasyan retitled this revision from [MC] Accept and print a numeric value as an ELF section header's type to [MC] Accept a numeric value as an ELF section header's type.
atanasyan edited the summary of this revision. (Show Details)
  • Show an error if MCSectionELF attempt to print unknown section type value.
  • Added a test case to check the error mentioned above.
This revision was automatically updated to reflect the committed changes.