[llvm] r375361 - [yaml2obj][obj2yaml] - Do not create a symbol table by default.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 20 07:47:17 PDT 2019
Author: grimar
Date: Sun Oct 20 07:47:17 2019
New Revision: 375361
URL: http://llvm.org/viewvc/llvm-project?rev=375361&view=rev
Log:
[yaml2obj][obj2yaml] - Do not create a symbol table by default.
This patch tries to resolve problems faced in D68943
and uses some of the code written by Konrad Wilhelm Kleine
in that patch.
Previously, yaml2obj tool always created a .symtab section.
This patch changes that. With it we only create it when
have a "Symbols:" tag in the YAML document or when
we need to create it because it is used by another section(s).
obj2yaml follows the new behavior and does not print "Symbols:"
anymore when there is no symbol table.
Differential revision: https://reviews.llvm.org/D69041
Added:
llvm/trunk/test/tools/obj2yaml/elf-no-symtab.yaml
Modified:
llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h
llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp
llvm/trunk/test/Object/invalid.test
llvm/trunk/test/Object/objdump-sectionheaders.test
llvm/trunk/test/tools/llvm-objcopy/ELF/add-section-remove.test
llvm/trunk/test/tools/llvm-objcopy/ELF/add-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test
llvm/trunk/test/tools/llvm-objcopy/ELF/basic-only-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test
llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test
llvm/trunk/test/tools/llvm-objcopy/ELF/invalid-e_shoff.test
llvm/trunk/test/tools/llvm-objcopy/ELF/keep-only-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/no-strip-all.test
llvm/trunk/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test
llvm/trunk/test/tools/llvm-objcopy/ELF/null-symbol.test
llvm/trunk/test/tools/llvm-objcopy/ELF/only-section-many.test
llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test
llvm/trunk/test/tools/llvm-objcopy/ELF/remove-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section-multiple.test
llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/segment-shift-section-remove.test
llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test
llvm/trunk/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test
llvm/trunk/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test
llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test
llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-link.test
llvm/trunk/test/tools/llvm-objcopy/ELF/wildcard-syntax.test
llvm/trunk/test/tools/llvm-objdump/full-contents.test
llvm/trunk/test/tools/llvm-objdump/relocations-elf.test
llvm/trunk/test/tools/llvm-readobj/check-output-order.test
llvm/trunk/test/tools/llvm-readobj/elf-dynamic-malformed.test
llvm/trunk/test/tools/llvm-readobj/elf-file-headers.test
llvm/trunk/test/tools/llvm-readobj/elf-hidden-versym.test
llvm/trunk/test/tools/llvm-readobj/elf-invalid-shstrndx.test
llvm/trunk/test/tools/llvm-readobj/elf-invalid-versioning.test
llvm/trunk/test/tools/llvm-readobj/elf-no-phdrs.test
llvm/trunk/test/tools/llvm-readobj/elf-no-relocs.test
llvm/trunk/test/tools/llvm-readobj/elf-relr-relocs.test
llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test
llvm/trunk/test/tools/llvm-readobj/elf-wrong-shstrtab-type.test
llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-aarch64.test
llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-arm.test
llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-lanai.test
llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips.test
llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips64.test
llvm/trunk/test/tools/obj2yaml/elf-llvm-addrsig-section.yaml
llvm/trunk/test/tools/obj2yaml/elf-sht-symtab-shndx.yaml
llvm/trunk/test/tools/obj2yaml/no-symbol-reloc.test
llvm/trunk/test/tools/obj2yaml/section-group.test
llvm/trunk/test/tools/yaml2obj/dynamic-symbols.yaml
llvm/trunk/test/tools/yaml2obj/elf-comdat-broken-info.yaml
llvm/trunk/test/tools/yaml2obj/elf-custom-null-section.yaml
llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml
llvm/trunk/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml
llvm/trunk/test/tools/yaml2obj/implicit-sections-types.test
llvm/trunk/test/tools/yaml2obj/implicit-sections.test
llvm/trunk/test/tools/yaml2obj/invalid-symboless-relocation.yaml
llvm/trunk/test/tools/yaml2obj/reloc-sec-info.yaml
llvm/trunk/test/tools/yaml2obj/symboless-relocation.yaml
llvm/trunk/test/tools/yaml2obj/symtab-implicit-sections-flags.yaml
llvm/trunk/tools/obj2yaml/elf2yaml.cpp
Modified: llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h Sun Oct 20 07:47:17 2019
@@ -376,7 +376,7 @@ struct Object {
// cleaner and nicer if we read them from the YAML as a separate
// top-level key, which automatically ensures that invariants like there
// being a single SHT_SYMTAB section are upheld.
- std::vector<Symbol> Symbols;
+ Optional<std::vector<Symbol>> Symbols;
std::vector<Symbol> DynamicSymbols;
};
Modified: llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp Sun Oct 20 07:47:17 2019
@@ -200,10 +200,17 @@ template <class ELFT>
ELFState<ELFT>::ELFState(ELFYAML::Object &D, yaml::ErrorHandler EH)
: Doc(D), ErrHandler(EH) {
StringSet<> DocSections;
- for (std::unique_ptr<ELFYAML::Section> &D : Doc.Sections)
+ for (std::unique_ptr<ELFYAML::Section> &D : Doc.Sections) {
if (!D->Name.empty())
DocSections.insert(D->Name);
+ // Some sections wants to link to .symtab by default.
+ // That means we want to create the symbol table for them.
+ if (D->Type == llvm::ELF::SHT_REL || D->Type == llvm::ELF::SHT_RELA)
+ if (!Doc.Symbols && D->Link.empty())
+ Doc.Symbols.emplace();
+ }
+
// Insert SHT_NULL section implicitly when it is not defined in YAML.
if (Doc.Sections.empty() || Doc.Sections.front()->Type != ELF::SHT_NULL)
Doc.Sections.insert(
@@ -211,7 +218,11 @@ ELFState<ELFT>::ELFState(ELFYAML::Object
std::make_unique<ELFYAML::Section>(
ELFYAML::Section::SectionKind::RawContent, /*IsImplicit=*/true));
- std::vector<StringRef> ImplicitSections = {".symtab", ".strtab", ".shstrtab"};
+ std::vector<StringRef> ImplicitSections;
+ if (Doc.Symbols)
+ ImplicitSections.push_back(".symtab");
+ ImplicitSections.insert(ImplicitSections.end(), {".strtab", ".shstrtab"});
+
if (!Doc.DynamicSymbols.empty())
ImplicitSections.insert(ImplicitSections.end(), {".dynsym", ".dynstr"});
@@ -508,7 +519,11 @@ void ELFState<ELFT>::initSymtabSectionHe
ELFYAML::Section *YAMLSec) {
bool IsStatic = STType == SymtabType::Static;
- const auto &Symbols = IsStatic ? Doc.Symbols : Doc.DynamicSymbols;
+ ArrayRef<ELFYAML::Symbol> Symbols;
+ if (IsStatic && Doc.Symbols)
+ Symbols = *Doc.Symbols;
+ else if (!IsStatic)
+ Symbols = Doc.DynamicSymbols;
ELFYAML::RawContentSection *RawSec =
dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec);
@@ -1044,14 +1059,16 @@ template <class ELFT> void ELFState<ELFT
}
};
- Build(Doc.Symbols, SymN2I);
+ if (Doc.Symbols)
+ Build(*Doc.Symbols, SymN2I);
Build(Doc.DynamicSymbols, DynSymN2I);
}
template <class ELFT> void ELFState<ELFT>::finalizeStrings() {
// Add the regular symbol names to .strtab section.
- for (const ELFYAML::Symbol &Sym : Doc.Symbols)
- DotStrtab.add(ELFYAML::dropUniqueSuffix(Sym.Name));
+ if (Doc.Symbols)
+ for (const ELFYAML::Symbol &Sym : *Doc.Symbols)
+ DotStrtab.add(ELFYAML::dropUniqueSuffix(Sym.Name));
DotStrtab.finalize();
// Add the dynamic symbol names to .dynstr section.
Modified: llvm/trunk/test/Object/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/invalid.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/Object/invalid.test (original)
+++ llvm/trunk/test/Object/invalid.test Sun Oct 20 07:47:17 2019
@@ -226,6 +226,7 @@ Sections:
Type: SHT_SYMTAB_SHNDX
Entries: [ 0, 1 ]
Link: .symtab
+Symbols: []
## Check that llvm-readobj reports an error if the e_phentsize field is broken.
@@ -274,8 +275,8 @@ Sections:
Type: SHT_RELA
ShOffset: 0x10000
-## Check that llvm-objdump reports an error when .shstrtab has a broken sh_offset
-## so large that sh_offset + sh_size overflows the platform address size type.
+## Check that llvm-objdump reports an error when we try to print symbols and
+## .shstrtab has a broken sh_offset so large that sh_offset + sh_size overflows the platform address size type.
# RUN: yaml2obj %s --docnum=14 -o %t14
# RUN: not llvm-readobj --symbols %t14 2>&1 | FileCheck -DFILE=%t14 --check-prefix=INVALID-SECTION-SIZE2 %s
@@ -292,6 +293,7 @@ Sections:
- Name: .shstrtab
Type: SHT_STRTAB
ShOffset: 0xFFFFFFFF
+Symbols: []
## Check that llvm-readobj reports an error when trying to dump sections
## when the e_shnum field is broken (is greater than the actual number of sections).
@@ -565,7 +567,7 @@ Sections:
# RUN: yaml2obj --docnum=26 %s -o %t26
# RUN: not llvm-readobj -h %t26 2>&1 | FileCheck -DFILE=%t26 --check-prefix=INVALID-SEC-NUM1 %s
-# INVALID-SEC-NUM1: error: '[[FILE]]': invalid section header table offset (e_shoff = 0x78) or invalid number of sections specified in the first section header's sh_size field (0x3ffffffffffffff)
+# INVALID-SEC-NUM1: error: '[[FILE]]': invalid section header table offset (e_shoff = 0x58) or invalid number of sections specified in the first section header's sh_size field (0x3ffffffffffffff)
--- !ELF
FileHeader:
Modified: llvm/trunk/test/Object/objdump-sectionheaders.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/objdump-sectionheaders.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/Object/objdump-sectionheaders.test (original)
+++ llvm/trunk/test/Object/objdump-sectionheaders.test Sun Oct 20 07:47:17 2019
@@ -37,6 +37,5 @@ Sections:
- Name: .rela.text
Type: SHT_RELA
Address: 0x0000000000000038
- Link: .symtab
Info: .text
Relocations:
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/add-section-remove.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/add-section-remove.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/add-section-remove.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/add-section-remove.test Sun Oct 20 07:47:17 2019
@@ -23,11 +23,10 @@ Sections:
Flags: [ SHF_ALLOC ]
Content: "32323232"
-# CHECK: SectionHeaderCount: 7
+# CHECK: SectionHeaderCount: 6
# CHECK: Name: .test1
# CHECK: Name: .test3
-# CHECK: Name: .symtab
# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
# CHECK: Name: .test2
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/add-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/add-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/add-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/add-section.test Sun Oct 20 07:47:17 2019
@@ -24,11 +24,10 @@ Sections:
Flags: [ SHF_ALLOC ]
Content: "32323232"
-# CHECK: SectionHeaderCount: 7
+# CHECK: SectionHeaderCount: 6
# CHECK: Name: .test1
# CHECK: Name: .test3
-# CHECK: Name: .symtab
# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
# CHECK: Name: .test2
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test Sun Oct 20 07:47:17 2019
@@ -58,6 +58,9 @@ ProgramHeaders:
Align: 0x1000
Sections:
- Section: .data
+## TODO (grimar): llvm-objcopy seems produce a broken output without
+## the following line, i.e. when there is no symbol table in the input.
+Symbols: []
# CHECK: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
# CHECK-NEXT: 1: 00000001 0 NOTYPE GLOBAL DEFAULT ABS abs1
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/basic-only-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/basic-only-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/basic-only-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/basic-only-section.test Sun Oct 20 07:47:17 2019
@@ -15,9 +15,7 @@ Sections:
Type: SHT_PROGBITS
Flags: [ ]
-# CHECK: SectionHeaderCount: 5
+# CHECK: SectionHeaderCount: 3
# CHECK: Name: .test
-# CHECK: Name: .symtab
-# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test Sun Oct 20 07:47:17 2019
@@ -13,9 +13,8 @@ Sections:
Type: SHT_PROGBITS
Flags: [ ]
-# CHECK: SectionHeaderCount: 5
+# CHECK: SectionHeaderCount: 4
# CHECK: Name: .test
-# CHECK: Name: .symtab
# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test Sun Oct 20 07:47:17 2019
@@ -13,9 +13,7 @@ Sections:
Type: SHT_PROGBITS
Flags: [ ]
-# CHECK: SectionHeaderCount: 5
+# CHECK: SectionHeaderCount: 3
# CHECK: Name: .test
-# CHECK: Name: .symtab
-# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/invalid-e_shoff.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/invalid-e_shoff.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/invalid-e_shoff.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/invalid-e_shoff.test Sun Oct 20 07:47:17 2019
@@ -28,5 +28,6 @@ FileHeader:
Sections:
- Name: .foo
Type: SHT_PROGBITS
+Symbols: []
# CASE2: error: '[[INPUT]]': section header table goes past the end of the file: e_shoff = 0x40000000
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/keep-only-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/keep-only-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/keep-only-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/keep-only-section.test Sun Oct 20 07:47:17 2019
@@ -20,19 +20,15 @@ Sections:
- Name: .test3
Type: SHT_PROGBITS
-# CHECK: SectionHeaderCount: 6
+# CHECK: SectionHeaderCount: 4
# CHECK: Name: .test
# CHECK: Name: .test2
-# CHECK: Name: .symtab
-# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
-# REGEX: SectionHeaderCount: 7
+# REGEX: SectionHeaderCount: 5
# REGEX: Name: .test
# REGEX: Name: .test2
# REGEX: Name: .test3
-# REGEX: Name: .symtab
-# REGEX: Name: .strtab
# REGEX: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/no-strip-all.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/no-strip-all.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/no-strip-all.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/no-strip-all.test Sun Oct 20 07:47:17 2019
@@ -37,6 +37,7 @@ Sections:
- Name: .alloc
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
+Symbols: []
# ALL: SectionHeaderCount: 3
# ALL: Name: .alloc
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test Sun Oct 20 07:47:17 2019
@@ -17,7 +17,6 @@ Sections:
Content: "0000000000000000"
- Name: .rel.text
Type: SHT_REL
- Link: .symtab
Info: .text
Relocations:
- Offset: 0x1000
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/null-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/null-symbol.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/null-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/null-symbol.test Sun Oct 20 07:47:17 2019
@@ -15,6 +15,7 @@ Sections:
Address: 0x1000
AddressAlign: 0x0000000000000010
Size: 8
+Symbols: []
#CHECK: Symbols [
#CHECK-NEXT: Symbol {
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/only-section-many.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/only-section-many.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/only-section-many.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/only-section-many.test Sun Oct 20 07:47:17 2019
@@ -19,10 +19,8 @@ Sections:
Type: SHT_PROGBITS
Flags: [ ]
-# CHECK: SectionHeaderCount: 6
+# CHECK: SectionHeaderCount: 4
# CHECK: Name: .test1
# CHECK: Name: .test2
-# CHECK: Name: .symtab
-# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test Sun Oct 20 07:47:17 2019
@@ -39,3 +39,4 @@ ProgramHeaders:
- Type: PT_LOAD
Sections:
- Section: .keep_me
+Symbols: []
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/remove-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/remove-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/remove-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/remove-section.test Sun Oct 20 07:47:17 2019
@@ -30,6 +30,7 @@ Sections:
- Name: .test3
Type: SHT_PROGBITS
Flags: [ ]
+Symbols: []
# CHECK: SectionHeaderCount: 6
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section-multiple.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section-multiple.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section-multiple.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section-multiple.test Sun Oct 20 07:47:17 2019
@@ -22,7 +22,7 @@ Sections:
Flags: [ SHF_ALLOC ]
Content: "37373737"
-# CHECK: SectionHeaderCount: 7
+# CHECK: SectionHeaderCount: 6
# CHECK: Name: .test2
# CHECK: SectionData (
@@ -36,6 +36,5 @@ Sections:
# CHECK: SectionData (
# CHECK-NEXT: 0000: 37373737
# CHECK-NEXT: )
-# CHECK: Name: .symtab
# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/rename-section.test Sun Oct 20 07:47:17 2019
@@ -16,13 +16,12 @@ Sections:
Flags: [ SHF_ALLOC ]
Content: "c3c3c3c3"
-# CHECK: SectionHeaderCount: 5
+# CHECK: SectionHeaderCount: 4
# CHECK: Name: .bar
# CHECK: SectionData (
# CHECK-NEXT: 0000: C3C3C3C3
# CHECK-NEXT: )
-# CHECK: Name: .symtab
# CHECK: Name: .strtab
# CHECK: Name: .shstrtab
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/segment-shift-section-remove.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/segment-shift-section-remove.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/segment-shift-section-remove.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/segment-shift-section-remove.test Sun Oct 20 07:47:17 2019
@@ -40,6 +40,9 @@ ProgramHeaders:
PAddr: 0x3000
Sections:
- Section: .text3
+## TODO (grimar): without the following line (i.e. without an empty symbol table),
+## llvm-objcopy adds an empty .strtab section. It doesn't look correct.
+Symbols: []
#CHECK: SectionHeaderCount: 4
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test Sun Oct 20 07:47:17 2019
@@ -42,6 +42,9 @@ ProgramHeaders:
- Section: .text
- Section: .text2
- Section: .text3
+## TODO (grimar): without the following line (i.e. without an empty symbol table),
+## llvm-objcopy adds an empty .strtab section. It doesn't look correct.
+Symbols: []
# Make sure that when we remove a section we overwrite it with zeros
# DATA: {{^[^[:blank:]]+}} 00 00 00 00
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test Sun Oct 20 07:47:17 2019
@@ -11,7 +11,7 @@
# CHECK-NEXT: ]
# CHECK-NEXT: Address:
# CHECK-NEXT: Offset:
-# CHECK-NEXT: Size: 36
+# CHECK-NEXT: Size: 28
!ELF
FileHeader:
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test Sun Oct 20 07:47:17 2019
@@ -20,11 +20,10 @@ Sections:
- Name: .debugfoo
Type: SHT_PROGBITS
-# CHECK: There are 6 section headers
+# CHECK: There are 5 section headers
# CHECK: [ 0]
# CHECK-NEXT: [ 1] .text
-# CHECK-NEXT: [ 2] .symtab
-# CHECK-NEXT: [ 3] .strtab
-# CHECK-NEXT: [ 4] .shstrtab
-# CHECK-NEXT: [ 5] .gnu_debuglink
+# CHECK-NEXT: [ 2] .strtab
+# CHECK-NEXT: [ 3] .shstrtab
+# CHECK-NEXT: [ 4] .gnu_debuglink
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test Sun Oct 20 07:47:17 2019
@@ -9,6 +9,7 @@ FileHeader:
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
+Symbols: []
# ERR1: error: '[[INPUT]]': string table '.strtab' cannot be removed because it is referenced by the symbol table '.symtab'
# ERR2: error: '[[INPUT]]': string table '.strtab' cannot be removed because it is referenced by the symbol table '.symtab'
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-link.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-link.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-link.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-link.test Sun Oct 20 07:47:17 2019
@@ -16,6 +16,7 @@ Sections:
Link: .symtab
Type: SHT_PROGBITS
Flags: [ ]
+Symbols: []
# CHECK: Name: .foo
# CHECK-NEXT: Type:
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/wildcard-syntax.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/wildcard-syntax.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/wildcard-syntax.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/wildcard-syntax.test Sun Oct 20 07:47:17 2019
@@ -57,6 +57,7 @@ Sections:
Type: SHT_PROGBITS
- Name: .bar
Type: SHT_PROGBITS
+Symbols: []
## Use a separate test file with special characters for the following tests.
@@ -128,6 +129,7 @@ Sections:
Type: SHT_PROGBITS
- Name: .foo
Type: SHT_PROGBITS
+Symbols: []
# WARN: warning: invalid glob pattern: ][]
Modified: llvm/trunk/test/tools/llvm-objdump/full-contents.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/full-contents.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/full-contents.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/full-contents.test Sun Oct 20 07:47:17 2019
@@ -64,3 +64,4 @@ Sections:
Type: SHT_PROGBITS
Flags: [ ]
Content: '11112222'
+Symbols: []
Modified: llvm/trunk/test/tools/llvm-objdump/relocations-elf.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/relocations-elf.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/relocations-elf.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/relocations-elf.test Sun Oct 20 07:47:17 2019
@@ -86,7 +86,6 @@ FileHeader:
Sections:
- Name: .rela.foo
Type: SHT_RELA
- Link: .symtab
Info: 0x255
Relocations:
- Offset: 0x1
Modified: llvm/trunk/test/tools/llvm-readobj/check-output-order.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/check-output-order.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/check-output-order.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/check-output-order.test Sun Oct 20 07:47:17 2019
@@ -39,6 +39,7 @@ Sections:
Entries:
- Tag: DT_NULL
Value: 0
+Symbols: []
ProgramHeaders:
- Type: PT_DYNAMIC
Sections:
Modified: llvm/trunk/test/tools/llvm-readobj/elf-dynamic-malformed.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-dynamic-malformed.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-dynamic-malformed.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-dynamic-malformed.test Sun Oct 20 07:47:17 2019
@@ -34,6 +34,7 @@ Sections:
Type: SHT_DYNAMIC
Address: 0x1000
Content: "01234567"
+Symbols: []
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
@@ -76,6 +77,7 @@ Sections:
Value: 0
- Tag: DT_NULL
Value: 0
+Symbols: []
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
@@ -143,6 +145,7 @@ Sections:
Value: 1
- Tag: DT_NULL
Value: 0
+Symbols: []
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
@@ -189,6 +192,7 @@ Sections:
Value: 1
- Tag: DT_NULL
Value: 0x0
+Symbols: []
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
@@ -231,6 +235,7 @@ Sections:
Value: 0x1000000
- Tag: DT_NULL
Value: 0x0
+Symbols: []
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
Modified: llvm/trunk/test/tools/llvm-readobj/elf-file-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-file-headers.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-file-headers.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-file-headers.test Sun Oct 20 07:47:17 2019
@@ -21,15 +21,15 @@
# I386-NEXT: Version: 1
# I386-NEXT: Entry: 0x0
# I386-NEXT: ProgramHeaderOffset: 0x0
-# I386-NEXT: SectionHeaderOffset: 0x64
+# I386-NEXT: SectionHeaderOffset: 0x48
# I386-NEXT: Flags [ (0x0)
# I386-NEXT: ]
# I386-NEXT: HeaderSize: 52
# I386-NEXT: ProgramHeaderEntrySize: 0
# I386-NEXT: ProgramHeaderCount: 0
# I386-NEXT: SectionHeaderEntrySize: 40
-# I386-NEXT: SectionHeaderCount: 4
-# I386-NEXT: StringTableSectionIndex: 3
+# I386-NEXT: SectionHeaderCount: 3
+# I386-NEXT: StringTableSectionIndex: 2
# I386-NEXT:}
# I386-NOT:{{.}}
@@ -65,15 +65,15 @@ FileHeader:
# X86-64-NEXT: Version: 1
# X86-64-NEXT: Entry: 0x0
# X86-64-NEXT: ProgramHeaderOffset: 0x0
-# X86-64-NEXT: SectionHeaderOffset: 0x78
+# X86-64-NEXT: SectionHeaderOffset: 0x58
# X86-64-NEXT: Flags [ (0x0)
# X86-64-NEXT: ]
# X86-64-NEXT: HeaderSize: 64
# X86-64-NEXT: ProgramHeaderEntrySize: 0
# X86-64-NEXT: ProgramHeaderCount: 0
# X86-64-NEXT: SectionHeaderEntrySize: 64
-# X86-64-NEXT: SectionHeaderCount: 4
-# X86-64-NEXT: StringTableSectionIndex: 3
+# X86-64-NEXT: SectionHeaderCount: 3
+# X86-64-NEXT: StringTableSectionIndex: 2
# X86-64-NEXT:}
# X86-64-NOT:{{.}}
@@ -116,14 +116,14 @@ FileHeader:
# LANAI-NEXT: Version: 1
# LANAI-NEXT: Entry: 0x0
# LANAI-NEXT: ProgramHeaderOffset: 0x0
-# LANAI-NEXT: SectionHeaderOffset: 0x64
+# LANAI-NEXT: SectionHeaderOffset: 0x48
# LANAI-NEXT: Flags [ (0x0)
# LANAI-NEXT: ]
# LANAI-NEXT: HeaderSize: 52
# LANAI-NEXT: ProgramHeaderEntrySize: 0
# LANAI-NEXT: ProgramHeaderCount: 0
# LANAI-NEXT: SectionHeaderEntrySize: 40
-# LANAI-NEXT: SectionHeaderCount: 4
-# LANAI-NEXT: StringTableSectionIndex: 3
+# LANAI-NEXT: SectionHeaderCount: 3
+# LANAI-NEXT: StringTableSectionIndex: 2
# LANAI-NEXT:}
# LANAI-NOT:{{.}}
Modified: llvm/trunk/test/tools/llvm-readobj/elf-hidden-versym.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-hidden-versym.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-hidden-versym.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-hidden-versym.test Sun Oct 20 07:47:17 2019
@@ -2,7 +2,7 @@
# RUN: llvm-readelf -V %t | FileCheck %s --check-prefix=HIDDEN
# HIDDEN: Version symbols section '.gnu.version' contains 2 entries:
-# HIDDEN-NEXT: Addr: 0000000000200210 Offset: 0x000040 Link: 6 (.dynsym)
+# HIDDEN-NEXT: Addr: 0000000000200210 Offset: 0x000040 Link: 5 (.dynsym)
# HIDDEN-NEXT: 000: 0 (*local*) 3h(hiddensym)
--- !ELF
Modified: llvm/trunk/test/tools/llvm-readobj/elf-invalid-shstrndx.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-invalid-shstrndx.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-invalid-shstrndx.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-invalid-shstrndx.test Sun Oct 20 07:47:17 2019
@@ -4,7 +4,7 @@
# GNU: ELF Header:
# GNU: Section header string table index: 255
-# GNU-NEXT: There are 4 section headers, starting at offset 0x78:
+# GNU-NEXT: There are 3 section headers, starting at offset 0x58:
# GNU: Section Headers:
# GNU-NEXT: [Nr] Name
# GNU-EMPTY:
Modified: llvm/trunk/test/tools/llvm-readobj/elf-invalid-versioning.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-invalid-versioning.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-invalid-versioning.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-invalid-versioning.test Sun Oct 20 07:47:17 2019
@@ -2,7 +2,7 @@
# RUN: llvm-readelf -V %t | FileCheck %s --check-prefix=INVALID
# INVALID: Version symbols section '.gnu.version' contains 2 entries:
-# INVALID-NEXT: Addr: 0000000000200210 Offset: 0x000040 Link: 6 (.dynsym)
+# INVALID-NEXT: Addr: 0000000000200210 Offset: 0x000040 Link: 5 (.dynsym)
# INVALID-NEXT: 000: 0 (*local*) 3 (*invalid*)
--- !ELF
Modified: llvm/trunk/test/tools/llvm-readobj/elf-no-phdrs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-no-phdrs.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-no-phdrs.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-no-phdrs.test Sun Oct 20 07:47:17 2019
@@ -14,7 +14,7 @@
# GNU-EMPTY:
# GNU-NEXT: Section to Segment mapping:
# GNU-NEXT: Segment Sections...
-# GNU-NEXT: None .symtab .strtab .shstrtab
+# GNU-NEXT: None .strtab .shstrtab
--- !ELF
FileHeader:
Modified: llvm/trunk/test/tools/llvm-readobj/elf-no-relocs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-no-relocs.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-no-relocs.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-no-relocs.test Sun Oct 20 07:47:17 2019
@@ -41,8 +41,6 @@ Sections:
- Name: .rela.text
Type: SHT_RELA
Info: .text
- Link: .symtab
- Name: .rel.text
Type: SHT_REL
Info: .text
- Link: .symtab
Modified: llvm/trunk/test/tools/llvm-readobj/elf-relr-relocs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-relr-relocs.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-relr-relocs.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-relr-relocs.test Sun Oct 20 07:47:17 2019
@@ -91,6 +91,7 @@ Sections:
Link: .symtab
AddressAlign: 0x0000000000000001
Content: 600D0100000000000301000000000000000002000000000001050F00000000000900405005700A00
+Symbols: []
...
# RUN: yaml2obj -docnum 2 %s \
@@ -169,4 +170,5 @@ Sections:
Link: .symtab
AddressAlign: 0x00000001
Content: 600D0100030100000000020001050F0009004050
+Symbols: []
...
Modified: llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test Sun Oct 20 07:47:17 2019
@@ -164,12 +164,12 @@ DynamicSymbols:
# LLVM-NEXT: ]
# GNU: Version symbols section '.gnu.version' contains 6 entries:
-# GNU-NEXT: Addr: 0000000000000000 Offset: 0x000040 Link: 7 (.dynsym)
+# GNU-NEXT: Addr: 0000000000000000 Offset: 0x000040 Link: 6 (.dynsym)
# GNU-NEXT: 000: 0 (*local*) 2 (VERSION1) 3 (VERSION2) 4 (v1)
# GNU-NEXT: 004: 5 (v2) 6 (v3)
# GNU-EMPTY:
# GNU-NEXT: Version definition section '.gnu.version_d' contains 3 entries:
-# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00004c Link: 8 (.dynstr)
+# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00004c Link: 7 (.dynstr)
# GNU-NEXT: 0x0000: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: VERSION1
# GNU-NEXT: 0x001c: Rev: 1 Flags: none Index: 3 Cnt: 2 Name: VERSION2
# GNU-NEXT: 0x0038: Parent 1: VERSION1
@@ -177,7 +177,7 @@ DynamicSymbols:
# GNU-NEXT: 0x0038: Parent 1: VERSION1
# GNU-EMPTY:
# GNU-NEXT: Version needs section '.gnu.version_r' contains 2 entries:
-# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00008c Link: 8 (.dynstr)
+# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00008c Link: 7 (.dynstr)
# GNU-NEXT: 0x0000: Version: 1 File: verneed1.so.0 Cnt: 2
# GNU-NEXT: 0x0010: Name: v1 Flags: none Version: 4
# GNU-NEXT: 0x0020: Name: v2 Flags: none Version: 5
Modified: llvm/trunk/test/tools/llvm-readobj/elf-wrong-shstrtab-type.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-wrong-shstrtab-type.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-wrong-shstrtab-type.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/elf-wrong-shstrtab-type.test Sun Oct 20 07:47:17 2019
@@ -15,7 +15,7 @@
# GNU: Section Headers:
# GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# GNU: warning: '[[FILE]]': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
-# GNU: [ 1] .shstrtab PROGBITS 0000000000000000 000040 00001b 00 0 0 0
+# GNU: [ 1] .shstrtab PROGBITS 0000000000000000 000040 000013 00 0 0 0
## Test we report multiple identical warnings (one for each object) when dumping an archive.
Modified: llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-aarch64.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-aarch64.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-aarch64.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-aarch64.test Sun Oct 20 07:47:17 2019
@@ -140,7 +140,6 @@ Sections:
Content: 00
- Name: .rela.text
Type: SHT_RELA
- Link: .symtab
AddressAlign: 0x0000000000000008
EntSize: 0x0000000000000018
Info: .text
Modified: llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-arm.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-arm.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-arm.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-arm.test Sun Oct 20 07:47:17 2019
@@ -149,7 +149,6 @@ Sections:
Content: 00
- Name: .rel.text
Type: SHT_REL
- Link: .symtab
AddressAlign: 0x0000000000000004
EntSize: 0x0000000000000008
Info: .text
Modified: llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-lanai.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-lanai.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-lanai.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-lanai.test Sun Oct 20 07:47:17 2019
@@ -26,7 +26,6 @@ Sections:
Content: 00
- Name: .rela.text
Type: SHT_RELA
- Link: .symtab
AddressAlign: 0x0000000000000004
EntSize: 0x000000000000000C
Info: .text
Modified: llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips.test Sun Oct 20 07:47:17 2019
@@ -70,7 +70,6 @@ Sections:
Content: 00
- Name: .rel.text
Type: SHT_REL
- Link: .symtab
AddressAlign: 0x0000000000000004
EntSize: 0x0000000000000008
Info: .text
Modified: llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips64.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips64.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips64.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/reloc-types-elf-mips64.test Sun Oct 20 07:47:17 2019
@@ -70,7 +70,6 @@ Sections:
Content: 00
- Name: .rela.text
Type: SHT_RELA
- Link: .symtab
AddressAlign: 0x0000000000000008
EntSize: 0x0000000000000018
Info: .text
Modified: llvm/trunk/test/tools/obj2yaml/elf-llvm-addrsig-section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/elf-llvm-addrsig-section.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/elf-llvm-addrsig-section.yaml (original)
+++ llvm/trunk/test/tools/obj2yaml/elf-llvm-addrsig-section.yaml Sun Oct 20 07:47:17 2019
@@ -62,7 +62,6 @@ Symbols:
# INVALID-ENTRY: - Name: .llvm_addrsig
# INVALID-ENTRY-NEXT: Type: SHT_LLVM_ADDRSIG
-# INVALID-ENTRY-NEXT: Link: .symtab
# INVALID-ENTRY-NEXT: Content: FFFFFFFFFF
--- !ELF
@@ -83,7 +82,6 @@ Sections:
# EMPTY: - Name: .llvm_addrsig
# EMPTY-NEXT: Type: SHT_LLVM_ADDRSIG
-# EMPTY-NEXT: Link: .symtab
# EMPTY-NEXT: Symbols: []
--- !ELF
Added: llvm/trunk/test/tools/obj2yaml/elf-no-symtab.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/elf-no-symtab.yaml?rev=375361&view=auto
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/elf-no-symtab.yaml (added)
+++ llvm/trunk/test/tools/obj2yaml/elf-no-symtab.yaml Sun Oct 20 07:47:17 2019
@@ -0,0 +1,43 @@
+## Check that obj2yaml doesn't create a "Symbols" tag for the objects
+## without a symbol table.
+
+# RUN: yaml2obj --docnum=1 %s -o %t1
+# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=NOSYMTAB
+
+# NOSYMTAB: --- !ELF
+# NOSYMTAB-NEXT: FileHeader:
+# NOSYMTAB-NEXT: Class: ELFCLASS64
+# NOSYMTAB-NEXT: Data: ELFDATA2LSB
+# NOSYMTAB-NEXT: Type: ET_DYN
+# NOSYMTAB-NEXT: Machine: EM_X86_64
+# NOSYMTAB-NEXT: ...
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+
+## Check that obj2yaml creates a "Symbols" tag for the objects
+## that have a symbol table.
+
+# RUN: yaml2obj --docnum=2 %s -o %t2
+# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=SYMTAB
+
+# SYMTAB: --- !ELF
+# SYMTAB-NEXT: FileHeader:
+# SYMTAB-NEXT: Class: ELFCLASS64
+# SYMTAB-NEXT: Data: ELFDATA2LSB
+# SYMTAB-NEXT: Type: ET_DYN
+# SYMTAB-NEXT: Machine: EM_X86_64
+# SYMTAB-NEXT: Symbols: []
+# SYMTAB-NEXT: ...
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+Symbols: []
Modified: llvm/trunk/test/tools/obj2yaml/elf-sht-symtab-shndx.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/elf-sht-symtab-shndx.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/elf-sht-symtab-shndx.yaml (original)
+++ llvm/trunk/test/tools/obj2yaml/elf-sht-symtab-shndx.yaml Sun Oct 20 07:47:17 2019
@@ -142,6 +142,7 @@ Sections:
Type: SHT_SYMTAB_SHNDX
Entries: [ 0 ]
Link: .symtab
+Symbols: []
## Check that yaml2obj can't dump the object if SHT_SYMTAB_SHNDX is
## not associated with a SHT_SYMTAB section (this case is illegal).
Modified: llvm/trunk/test/tools/obj2yaml/no-symbol-reloc.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/no-symbol-reloc.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/no-symbol-reloc.test (original)
+++ llvm/trunk/test/tools/obj2yaml/no-symbol-reloc.test Sun Oct 20 07:47:17 2019
@@ -26,6 +26,7 @@
# CHECK-NEXT: - Offset: 0x0000000000000004
# CHECK-NEXT: Symbol: ''
# CHECK-NEXT: Type: R_X86_64_NONE
+# CHECK-NEXT: Symbols: []
# CHECK-NEXT: ...
--- !ELF
Modified: llvm/trunk/test/tools/obj2yaml/section-group.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/section-group.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/section-group.test (original)
+++ llvm/trunk/test/tools/obj2yaml/section-group.test Sun Oct 20 07:47:17 2019
@@ -66,5 +66,6 @@ Sections:
Info: 0xFF
Members:
- SectionOrType: GRP_COMDAT
+Symbols: []
# ERR: Error reading file: {{.*}}2.o: unable to get symbol from section [index 2]: invalid symbol index (255)
Modified: llvm/trunk/test/tools/yaml2obj/dynamic-symbols.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/dynamic-symbols.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/dynamic-symbols.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/dynamic-symbols.yaml Sun Oct 20 07:47:17 2019
@@ -52,7 +52,7 @@ DynamicSymbols:
# NUM: Name: bar
# NUM: Section:
-# NUM-SAME: .symtab (0x2)
+# NUM-SAME: .strtab (0x2)
# NUM: error: '[[FILE]]': invalid section index: 255
Modified: llvm/trunk/test/tools/yaml2obj/elf-comdat-broken-info.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/elf-comdat-broken-info.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/elf-comdat-broken-info.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/elf-comdat-broken-info.yaml Sun Oct 20 07:47:17 2019
@@ -12,7 +12,6 @@ FileHeader:
Sections:
- Name: .group
Type: SHT_GROUP
- Link: .symtab
Info: 12345
Members:
- SectionOrType: GRP_COMDAT
Modified: llvm/trunk/test/tools/yaml2obj/elf-custom-null-section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/elf-custom-null-section.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/elf-custom-null-section.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/elf-custom-null-section.yaml Sun Oct 20 07:47:17 2019
@@ -8,9 +8,8 @@
# DEFAULT: Section Headers:
# DEFAULT-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# DEFAULT-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
-# DEFAULT-NEXT: [ 1] .symtab SYMTAB 0000000000000000 000040 000018 18 2 1 8
-# DEFAULT-NEXT: [ 2] .strtab STRTAB 0000000000000000 000058 000001 00 0 0 1
-# DEFAULT-NEXT: [ 3] .shstrtab STRTAB 0000000000000000 000059 00001b 00 0 0 1
+# DEFAULT-NEXT: [ 1] .strtab STRTAB 0000000000000000 000040 000001 00 0 0 1
+# DEFAULT-NEXT: [ 2] .shstrtab STRTAB 0000000000000000 000041 000013 00 0 0 1
--- !ELF
FileHeader:
@@ -105,9 +104,8 @@ Sections:
# OTHER-SECTION-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# OTHER-SECTION-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
# OTHER-SECTION-NEXT: [ 1] foo PROGBITS 0000000000000000 000040 000000 00 0 0 0
-# OTHER-SECTION-NEXT: [ 2] .symtab SYMTAB 0000000000000000 000040 000018 18 3 1 8
-# OTHER-SECTION-NEXT: [ 3] .strtab STRTAB 0000000000000000 000058 000001 00 0 0 1
-# OTHER-SECTION-NEXT: [ 4] .shstrtab STRTAB 0000000000000000 000059 00001f 00 0 0 1
+# OTHER-SECTION-NEXT: [ 2] .strtab STRTAB 0000000000000000 000040 000001 00 0 0 1
+# OTHER-SECTION-NEXT: [ 3] .shstrtab STRTAB 0000000000000000 000041 000017 00 0 0 1
--- !ELF
FileHeader:
Modified: llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml Sun Oct 20 07:47:17 2019
@@ -6,10 +6,10 @@
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readelf --file-headers %t1 | FileCheck %s --check-prefix=DEFAULT
-# DEFAULT: Start of section headers: 120 (bytes into file)
+# DEFAULT: Start of section headers: 88 (bytes into file)
# DEFAULT: Size of section headers: 64 (bytes)
-# DEFAULT: Number of section headers: 4
-# DEFAULT: Section header string table index: 3
+# DEFAULT: Number of section headers: 3
+# DEFAULT: Section header string table index: 2
--- !ELF
FileHeader:
Modified: llvm/trunk/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml Sun Oct 20 07:47:17 2019
@@ -126,4 +126,3 @@ Sections:
Type: SHT_SYMTAB_SHNDX
Entries: [ 0 ]
EntSize: 2
- Link: .symtab
Modified: llvm/trunk/test/tools/yaml2obj/implicit-sections-types.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/implicit-sections-types.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/implicit-sections-types.test (original)
+++ llvm/trunk/test/tools/yaml2obj/implicit-sections-types.test Sun Oct 20 07:47:17 2019
@@ -24,6 +24,8 @@ FileHeader:
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
+## Needed to force the creation of the .symtab.
+Symbols: []
## Needed to force the creation of the .dynsym and .dynstr.
DynamicSymbols:
- Name: foo
Modified: llvm/trunk/test/tools/yaml2obj/implicit-sections.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/implicit-sections.test?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/implicit-sections.test (original)
+++ llvm/trunk/test/tools/yaml2obj/implicit-sections.test Sun Oct 20 07:47:17 2019
@@ -84,3 +84,30 @@ Sections:
- Name: .text.foo
Type: SHT_PROGBITS
Address: 0x200
+
+## Check we don't add a symbol table when no "Symbols" key is specified.
+
+# RUN: yaml2obj --docnum=3 %s -o %t3
+# RUN: llvm-readelf -S %t3 | FileCheck /dev/null --implicit-check-not=.symtab
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+
+## Check we add a symbol table when "Symbols" key is specified.
+
+# RUN: yaml2obj --docnum=4 %s -o %t4
+# RUN: llvm-readelf -S %t4 | FileCheck %s --check-prefix=SYMTAB
+
+# SYMTAB: .symtab
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+Symbols: []
Modified: llvm/trunk/test/tools/yaml2obj/invalid-symboless-relocation.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/invalid-symboless-relocation.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/invalid-symboless-relocation.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/invalid-symboless-relocation.yaml Sun Oct 20 07:47:17 2019
@@ -16,7 +16,6 @@ Sections:
Content: "00000000"
- Name: .rel.text
Type: SHT_REL
- Link: .symtab
Info: .text
Relocations:
- Offset: 0x1000
Modified: llvm/trunk/test/tools/yaml2obj/reloc-sec-info.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/reloc-sec-info.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/reloc-sec-info.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/reloc-sec-info.yaml Sun Oct 20 07:47:17 2019
@@ -20,7 +20,6 @@ FileHeader:
Sections:
- Name: .rela.text
Type: SHT_RELA
- Link: .symtab
Info: 12345
Relocations:
Modified: llvm/trunk/test/tools/yaml2obj/symboless-relocation.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/symboless-relocation.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/symboless-relocation.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/symboless-relocation.yaml Sun Oct 20 07:47:17 2019
@@ -14,7 +14,6 @@ Sections:
Content: "00000000"
- Name: .rel.text
Type: SHT_REL
- Link: .symtab
Info: .text
Relocations:
- Offset: 0x1000
Modified: llvm/trunk/test/tools/yaml2obj/symtab-implicit-sections-flags.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/symtab-implicit-sections-flags.yaml?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/symtab-implicit-sections-flags.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/symtab-implicit-sections-flags.yaml Sun Oct 20 07:47:17 2019
@@ -77,3 +77,4 @@ FileHeader:
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
+Symbols: []
Modified: llvm/trunk/tools/obj2yaml/elf2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=375361&r1=375360&r2=375361&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/elf2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp Sun Oct 20 07:47:17 2019
@@ -200,9 +200,13 @@ template <class ELFT> Expected<ELFYAML::
return TableOrErr.takeError();
ShndxTable = *TableOrErr;
}
- if (SymTab)
- if (Error E = dumpSymbols(SymTab, Y->Symbols))
+
+ if (SymTab) {
+ Y->Symbols.emplace();
+ if (Error E = dumpSymbols(SymTab, *Y->Symbols))
return std::move(E);
+ }
+
if (DynSymTab)
if (Error E = dumpSymbols(DynSymTab, Y->DynamicSymbols))
return std::move(E);
More information about the llvm-commits
mailing list