1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +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:
David Majnemer 2014-03-20 06:29:02 +00:00
parent 5717204ae7
commit f8e66b9d3f
3 changed files with 19 additions and 1 deletions

View 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
...

View 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

View File

@ -178,7 +178,8 @@ void COFFDumper::dumpSymbols(unsigned NumSymbols) {
} else if (Symbol->isFileRecord()) {
// This symbol represents a file record.
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()) {
// This symbol represents a section definition.
assert(Symbol->NumberOfAuxSymbols == 1 &&