mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
obj2yaml, COFF: Handle long section names
Long section names are represented as a slash followed by a numeric ASCII string. This number is an offset into a string table. Print the appropriate entry in the string table instead of the less enlightening /4. N.B. yaml2obj already does the right thing, this test exercises both sides of the (de-)serialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ffdb31af0
commit
54a3b749e1
11
test/Object/Inputs/COFF/long-section-name.yaml
Normal file
11
test/Object/Inputs/COFF/long-section-name.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
header:
|
||||||
|
Machine: IMAGE_FILE_MACHINE_I386
|
||||||
|
Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_LINE_NUMS_STRIPPED, IMAGE_FILE_LOCAL_SYMS_STRIPPED, IMAGE_FILE_32BIT_MACHINE ]
|
||||||
|
sections:
|
||||||
|
- Name: .long_section_name
|
||||||
|
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
|
||||||
|
Alignment: 1
|
||||||
|
SectionData: ''
|
||||||
|
symbols:
|
||||||
|
...
|
3
test/Object/obj2yaml-coff-long-section-name.test
Normal file
3
test/Object/obj2yaml-coff-long-section-name.test
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
RUN: yaml2obj %p/Inputs/COFF/long-section-name.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
|
||||||
|
|
||||||
|
COFF-I386: Name: .long_section_name
|
@ -47,13 +47,13 @@ void COFFDumper::dumpSections(unsigned NumSections) {
|
|||||||
for (const auto &Section : Obj.sections()) {
|
for (const auto &Section : Obj.sections()) {
|
||||||
const object::coff_section *Sect = Obj.getCOFFSection(Section);
|
const object::coff_section *Sect = Obj.getCOFFSection(Section);
|
||||||
COFFYAML::Section Sec;
|
COFFYAML::Section Sec;
|
||||||
Sec.Name = Sect->Name; // FIXME: check the null termination!
|
Section.getName(Sec.Name);
|
||||||
uint32_t Characteristics = Sect->Characteristics;
|
Sec.Header.Characteristics = Sect->Characteristics;
|
||||||
Sec.Header.Characteristics = Characteristics;
|
Sec.Alignment = Section.getAlignment();
|
||||||
Sec.Alignment = 1 << (((Characteristics >> 20) & 0xf) - 1);
|
|
||||||
|
|
||||||
ArrayRef<uint8_t> sectionData;
|
ArrayRef<uint8_t> sectionData;
|
||||||
Obj.getSectionContents(Sect, sectionData);
|
if (!Section.isBSS())
|
||||||
|
Obj.getSectionContents(Sect, sectionData);
|
||||||
Sec.SectionData = yaml::BinaryRef(sectionData);
|
Sec.SectionData = yaml::BinaryRef(sectionData);
|
||||||
|
|
||||||
std::vector<COFFYAML::Relocation> Relocations;
|
std::vector<COFFYAML::Relocation> Relocations;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user