We already have Symbols property to list regular symbols and it is currently Optional<>. This patch makes DynamicSymbols to be optional too. With this there is no need to define a dummy symbol anymore to trigger creation of the .dynsym and it is now possible to define an empty .dynsym using just the following line: DynamicSymbols: [] (it is important to have when you do not want to have dynamic symbols, but want to have a .dynsym) Now the code is consistent and it helped to fix a bug: previously we did not report an error when both Content/Size and an empty Symbols/DynamicSymbols list were specified. Differential revision: https://reviews.llvm.org/D70956
56 lines
1.2 KiB
YAML
56 lines
1.2 KiB
YAML
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-readobj --sections %t | FileCheck %s
|
|
|
|
## Check yaml2obj does not ignore the address of the
|
|
## explicitly listed .dynstr, .dynsym, .strtab
|
|
## and .symtab sections.
|
|
|
|
# CHECK: Name: .dynstr
|
|
# CHECK-NEXT: Type: SHT_STRTAB
|
|
# CHECK-NEXT: Flags [
|
|
# CHECK-NEXT: SHF_ALLOC
|
|
# CHECK-NEXT: ]
|
|
# CHECK-NEXT: Address: 0x1000
|
|
|
|
# CHECK: Name: .dynsym
|
|
# CHECK-NEXT: Type: SHT_DYNSYM
|
|
# CHECK-NEXT: Flags [
|
|
# CHECK-NEXT: SHF_ALLOC
|
|
# CHECK-NEXT: ]
|
|
# CHECK-NEXT: Address: 0x2000
|
|
|
|
# CHECK: Name: .strtab
|
|
# CHECK-NEXT: Type: SHT_STRTAB
|
|
# CHECK-NEXT: Flags [
|
|
# CHECK-NEXT: ]
|
|
# CHECK-NEXT: Address: 0x3000
|
|
|
|
# CHECK: Name: .symtab
|
|
# CHECK-NEXT: Type: SHT_SYMTAB
|
|
# CHECK-NEXT: Flags [
|
|
# CHECK-NEXT: ]
|
|
# CHECK-NEXT: Address: 0x4000
|
|
|
|
!ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_DYN
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .dynstr
|
|
Type: SHT_STRTAB
|
|
Flags: [ SHF_ALLOC ]
|
|
Address: 0x1000
|
|
- Name: .dynsym
|
|
Type: SHT_DYNSYM
|
|
Flags: [ SHF_ALLOC ]
|
|
Address: 0x2000
|
|
- Name: .strtab
|
|
Type: SHT_STRTAB
|
|
Address: 0x3000
|
|
- Name: .symtab
|
|
Type: SHT_SYMTAB
|
|
Address: 0x4000
|
|
DynamicSymbols: []
|