mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Object: Output .file symbols properly
obj2yaml would emit the NUL bytes padding the auxiliary file symbol records. Trimming them looks nicer. llvm-svn: 204314
This commit is contained in:
parent
5717204ae7
commit
f8e66b9d3f
14
test/Object/Inputs/COFF/long-file-symbol.yaml
Normal file
14
test/Object/Inputs/COFF/long-file-symbol.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
header:
|
||||||
|
Machine: IMAGE_FILE_MACHINE_AMD64
|
||||||
|
Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_LINE_NUMS_STRIPPED ]
|
||||||
|
sections:
|
||||||
|
symbols:
|
||||||
|
- Name: .file
|
||||||
|
Value: 0
|
||||||
|
SectionNumber: 65534
|
||||||
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||||
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||||
|
StorageClass: IMAGE_SYM_CLASS_FILE
|
||||||
|
File: filename_with_22_chars
|
||||||
|
...
|
3
test/Object/obj2yaml-coff-long-file-symbol.test
Normal file
3
test/Object/obj2yaml-coff-long-file-symbol.test
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
RUN: yaml2obj %p/Inputs/COFF/long-file-symbol.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
|
||||||
|
|
||||||
|
COFF-I386: File: filename_with_22_chars
|
@ -178,7 +178,8 @@ void COFFDumper::dumpSymbols(unsigned NumSymbols) {
|
|||||||
} else if (Symbol->isFileRecord()) {
|
} else if (Symbol->isFileRecord()) {
|
||||||
// This symbol represents a file record.
|
// This symbol represents a file record.
|
||||||
Sym.File = StringRef(reinterpret_cast<const char *>(AuxData.data()),
|
Sym.File = StringRef(reinterpret_cast<const char *>(AuxData.data()),
|
||||||
Symbol->NumberOfAuxSymbols * COFF::SymbolSize);
|
Symbol->NumberOfAuxSymbols * COFF::SymbolSize)
|
||||||
|
.rtrim(StringRef("\0", /*length=*/1));
|
||||||
} else if (Symbol->isSectionDefinition()) {
|
} else if (Symbol->isSectionDefinition()) {
|
||||||
// This symbol represents a section definition.
|
// This symbol represents a section definition.
|
||||||
assert(Symbol->NumberOfAuxSymbols == 1 &&
|
assert(Symbol->NumberOfAuxSymbols == 1 &&
|
||||||
|
Loading…
Reference in New Issue
Block a user