]> granicus.if.org Git - llvm/commit
[MC] Accept a numeric value as an ELF section header's type
authorSimon Atanasyan <simon@atanasyan.com>
Fri, 10 Mar 2017 08:22:13 +0000 (08:22 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Fri, 10 Mar 2017 08:22:13 +0000 (08:22 +0000)
commitd1a4b1d64a4de0f637e74da9f52193323721a143
tree710acf4946c8367a5272a67d1ca14f4b1a8e22c2
parentc2bf545fa9f3a9967b86be2a4e4f8dc8e0ab8c46
[MC] Accept a numeric value as an ELF section header's type

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

Differential Revision: https://reviews.llvm.org/D29719

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297446 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/MCParser/ELFAsmParser.cpp
lib/MC/MCSectionELF.cpp
test/MC/ELF/section-numeric-invalid-type.s [new file with mode: 0644]
test/MC/ELF/section-numeric-type.s [new file with mode: 0644]