mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
[ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj tools
SHT_NOBITS sections do not have content in an object file. Now the yaml2obj tool does not accept `Content` field for such sections, and the obj2yaml tool does not attempt to read the section content from a file. Restore r241350 and r241352. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241377 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -627,6 +627,11 @@ static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
|
||||
IO.mapOptional("Size", Section.Size, Hex64(Section.Content.binary_size()));
|
||||
}
|
||||
|
||||
static void sectionMapping(IO &IO, ELFYAML::NoBitsSection &Section) {
|
||||
commonSectionMapping(IO, Section);
|
||||
IO.mapOptional("Size", Section.Size, Hex64(0));
|
||||
}
|
||||
|
||||
static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
|
||||
commonSectionMapping(IO, Section);
|
||||
IO.mapOptional("Relocations", Section.Relocations);
|
||||
@@ -682,6 +687,11 @@ void MappingTraits<std::unique_ptr<ELFYAML::Section>>::mapping(
|
||||
Section.reset(new ELFYAML::Group());
|
||||
groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get()));
|
||||
break;
|
||||
case ELF::SHT_NOBITS:
|
||||
if (!IO.outputting())
|
||||
Section.reset(new ELFYAML::NoBitsSection());
|
||||
sectionMapping(IO, *cast<ELFYAML::NoBitsSection>(Section.get()));
|
||||
break;
|
||||
case ELF::SHT_MIPS_ABIFLAGS:
|
||||
if (!IO.outputting())
|
||||
Section.reset(new ELFYAML::MipsABIFlags());
|
||||
|
Reference in New Issue
Block a user