-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yaml2obj/obj2yaml] - Make RawContentSection::Info Optional<>
This allows to customize this field for "implicit" sections properly. Differential revision: https://reviews.llvm.org/D63487 llvm-svn: 363777
- Loading branch information
George Rimar
committed
Jun 19, 2019
1 parent
af22e07
commit b6e2093
Showing
8 changed files
with
159 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Check that obj2yaml does not write a section Info | ||
## field in the case when it has a value of zero. | ||
|
||
# RUN: yaml2obj %s -o %t | ||
# RUN: obj2yaml %t | FileCheck %s | ||
|
||
# CHECK: Sections: | ||
# CHECK-NEXT: - Name: .foo | ||
# CHECK-NEXT: Type: SHT_PROGBITS | ||
# CHECK-NEXT: - Name: .bar | ||
# CHECK-NEXT: Type: SHT_PROGBITS | ||
# CHECK-NEXT: Info: 0x0000000000000001 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .foo | ||
Type: SHT_PROGBITS | ||
- Name: .bar | ||
Type: SHT_PROGBITS | ||
Info: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
## Check the values of sh_info fields set by default for | ||
## explicitly listed .dynstr, .dynsym, .strtab and .symtab | ||
## sections. | ||
## | ||
## For symbol table sections, sh_info has a value which is | ||
## one greater than the symbol table index of the last | ||
## local symbol. | ||
## | ||
## sh_info isn't set for string table sections. | ||
|
||
# RUN: yaml2obj --docnum=1 %s -o %t | ||
# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE1 | ||
|
||
# CASE1: Name: .symtab | ||
# CASE1: Info: | ||
# CASE1-SAME: 2 | ||
# CASE1: Name: .strtab | ||
# CASE1: Info: | ||
# CASE1-SAME: 0 | ||
# CASE1: Name: .dynsym | ||
# CASE1: Info: | ||
# CASE1-SAME: 1 | ||
# CASE1: Name: .dynstr | ||
# CASE1: Info: | ||
# CASE1-SAME: 0 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .symtab | ||
Type: SHT_SYMTAB | ||
- Name: .strtab | ||
Type: SHT_STRTAB | ||
- Name: .dynsym | ||
Type: SHT_DYNSYM | ||
- Name: .dynstr | ||
Type: SHT_STRTAB | ||
Symbols: | ||
- Name: local | ||
- Name: global1 | ||
Binding: STB_GLOBAL | ||
DynamicSymbols: | ||
- Name: global2 | ||
Binding: STB_GLOBAL | ||
|
||
## In the case when these sections are not defined in YAML, the | ||
## behavior is the same as when we define them, but do not set the Info. | ||
|
||
# RUN: yaml2obj --docnum=2 %s -o %t | ||
# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE1 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Symbols: | ||
- Name: local | ||
- Name: global1 | ||
Binding: STB_GLOBAL | ||
DynamicSymbols: | ||
- Name: global2 | ||
Binding: STB_GLOBAL | ||
|
||
## Check we are able to set any sh_info explicitly. | ||
|
||
# RUN: yaml2obj --docnum=3 %s -o %t | ||
# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE2 | ||
|
||
# CASE2: Name: .dynstr | ||
# CASE2: Info: | ||
# CASE2-SAME: 10 | ||
# CASE2: Name: .dynsym | ||
# CASE2: Info: | ||
# CASE2-SAME: 11 | ||
# CASE2: Name: .strtab | ||
# CASE2: Info: | ||
# CASE2-SAME: 12 | ||
# CASE2: Name: .symtab | ||
# CASE2: Info: | ||
# CASE2-SAME: 13 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .dynstr | ||
Type: SHT_STRTAB | ||
Info: 10 | ||
- Name: .dynsym | ||
Type: SHT_DYNSYM | ||
Info: 11 | ||
- Name: .strtab | ||
Type: SHT_STRTAB | ||
Info: 12 | ||
- Name: .symtab | ||
Type: SHT_SYMTAB | ||
Info: 13 | ||
Symbols: | ||
- Name: local | ||
- Name: global1 | ||
Binding: STB_GLOBAL | ||
DynamicSymbols: | ||
- Name: global2 | ||
Binding: STB_GLOBAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters