[llvm] r204314 - Object: Output .file symbols properly
David Majnemer
david.majnemer at gmail.com
Wed Mar 19 23:29:02 PDT 2014
Author: majnemer
Date: Thu Mar 20 01:29:02 2014
New Revision: 204314
URL: http://llvm.org/viewvc/llvm-project?rev=204314&view=rev
Log:
Object: Output .file symbols properly
obj2yaml would emit the NUL bytes padding the auxiliary file symbol
records. Trimming them looks nicer.
Added:
llvm/trunk/test/Object/Inputs/COFF/long-file-symbol.yaml
llvm/trunk/test/Object/obj2yaml-coff-long-file-symbol.test
Modified:
llvm/trunk/tools/obj2yaml/coff2yaml.cpp
Added: llvm/trunk/test/Object/Inputs/COFF/long-file-symbol.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/COFF/long-file-symbol.yaml?rev=204314&view=auto
==============================================================================
--- llvm/trunk/test/Object/Inputs/COFF/long-file-symbol.yaml (added)
+++ llvm/trunk/test/Object/Inputs/COFF/long-file-symbol.yaml Thu Mar 20 01:29:02 2014
@@ -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
+...
Added: llvm/trunk/test/Object/obj2yaml-coff-long-file-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/obj2yaml-coff-long-file-symbol.test?rev=204314&view=auto
==============================================================================
--- llvm/trunk/test/Object/obj2yaml-coff-long-file-symbol.test (added)
+++ llvm/trunk/test/Object/obj2yaml-coff-long-file-symbol.test Thu Mar 20 01:29:02 2014
@@ -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
Modified: llvm/trunk/tools/obj2yaml/coff2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/coff2yaml.cpp?rev=204314&r1=204313&r2=204314&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/coff2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/coff2yaml.cpp Thu Mar 20 01:29:02 2014
@@ -178,7 +178,8 @@ void COFFDumper::dumpSymbols(unsigned Nu
} 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 &&
More information about the llvm-commits
mailing list