-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm-objdump] Rework .gnu.version_d dumping #128434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MaskRay
merged 4 commits into
main
from
users/MaskRay/spr/llvm-objdump-rework-gnuversion_d-dumping
Feb 28, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,77 @@ | ||
## Adapted from test/llvm-readobj/ELF/verdef-invalid.test | ||
## Check that we report a warning when a SHT_GNU_verdef section contains a version definition | ||
## that refers to an auxiliary entry that goes past the end of the section. | ||
|
||
# RUN: yaml2obj %s -o %t | ||
# RUN: llvm-objdump -p %t 2>&1 | FileCheck %s --check-prefix=AUX-PAST-END -DFILE=%t | ||
|
||
# AUX-PAST-END: warning: '[[FILE]]': invalid SHT_GNU_verdef section with index 1: version definition 1 refers to an auxiliary entry that goes past the end of the section | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Sections: | ||
- Name: .gnu.version_d | ||
Type: SHT_GNU_verdef | ||
Entries: | ||
- Names: | ||
- FOO | ||
## The correct sh_size is 28. | ||
ShSize: 27 | ||
DynamicSymbols: | ||
- Name: foo | ||
|
||
## Check we report a warning when a version definition is not correctly aligned in memory. | ||
|
||
# RUN: yaml2obj %s --docnum=2 -o %t2 | ||
# RUN: llvm-objdump -p %t2 2>&1 | FileCheck %s --check-prefix=MISALIGNED-DEF -DFILE=%t2 | ||
|
||
# MISALIGNED-DEF: warning: '[[FILE]]': invalid SHT_GNU_verdef section with index 1: found a misaligned version definition entry at offset 0x0 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Sections: | ||
- Type: Fill | ||
Size: 0x1 | ||
- Name: .gnu.version_d | ||
Type: SHT_GNU_verdef | ||
Link: .dynstr | ||
Info: 0x1 | ||
Entries: | ||
- Names: | ||
- FOO | ||
DynamicSymbols: | ||
- Name: foo | ||
|
||
## Check we report "invalid vda_name" when vda_name = size(.dynstr) | ||
|
||
# RUN: yaml2obj %s --docnum=3 -o %t3 | ||
# RUN: llvm-objdump -p %t3 2>&1 | FileCheck %s --check-prefix=VDANAME-PAST-END --implicit-check-not=warning: | ||
|
||
# VDANAME-PAST-END: Version definitions: | ||
# VDANAME-PAST-END-NEXT: 0 0x00 0x00000000 V0 | ||
# VDANAME-PAST-END-NEXT: <invalid vda_name: 7> | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_DYN | ||
Sections: | ||
- Name: .gnu.version_d | ||
Type: SHT_GNU_verdef | ||
Flags: [ SHF_ALLOC ] | ||
Link: .dynstr | ||
Info: 0x1 | ||
## The byte offset to the auxiliary entry is 0x13, i.e. it is not correctly aligned in memory. | ||
Content: "010000000000020000000000140000000000000004000000080000000700000000000000" | ||
DynamicSymbols: | ||
- Name: V1 | ||
Binding: STB_GLOBAL | ||
- Name: V0 | ||
Binding: STB_GLOBAL |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.