RUN: obj2yaml %t.x86_64.exe > %t.x86_64.exe.yaml
RUN: obj2yaml %t.x86_64-copy.exe > %t.x86_64-copy.exe.yaml
RUN: cmp %t.x86_64.exe.yaml %t.x86_64-copy.exe.yaml
+
+RUN: yaml2obj %p/Inputs/no-symbols.yaml > %t.no-symbols.o
+RUN: llvm-objcopy %t.no-symbols.o %t.no-symbols-copy.o
+RUN: obj2yaml %t.no-symbols.o > %t.no-symbols.o.yaml
+RUN: obj2yaml %t.no-symbols-copy.o > %t.no-symbols-copy.o.yaml
+RUN: cmp %t.no-symbols.o.yaml %t.no-symbols-copy.o.yaml
size_t PointerToSymbolTable = FileSize;
// StrTabSize <= 4 is the size of an empty string table, only consisting
// of the length field.
- if (SymTabSize == 0 && StrTabSize <= 4) {
- // Don't point to the symbol table if empty.
+ if (SymTabSize == 0 && StrTabSize <= 4 && Obj.IsPE) {
+ // For executables, don't point to the symbol table and skip writing
+ // the length field, if both the symbol and string tables are empty.
PointerToSymbolTable = 0;
- // For executables, skip the length field of an empty string table.
- if (Obj.IsPE)
- StrTabSize = 0;
+ StrTabSize = 0;
}
size_t NumRawSymbols = SymTabSize / SymbolSize;