-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-objdump] Error with relevant message when adding invalid notes
- Loading branch information
1 parent
15f0272
commit 8df8478
Showing
2 changed files
with
99 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Verify that --add-section can be used to add a note section which is | ||
# successfully interpreted by tools that read notes. | ||
|
||
# Add [namesz, descsz, type, name, desc] for a build id. | ||
# | ||
# RUN: echo -e -n "\x04\x00\x00\x00" > %t-miss-padding-note.bin | ||
# RUN: echo -e -n "\x07\x00\x00\x00" >> %t-miss-padding-note.bin | ||
# RUN: echo -e -n "\x03\x00\x00\x00" >> %t-miss-padding-note.bin | ||
# RUN: echo -e -n "GNU\x00" >> %t-miss-padding-note.bin | ||
# RUN: echo -e -n "\x0c\x0d\x0e" >> %t-miss-padding-note.bin | ||
# | ||
# RUN: echo -e -n "\x08\x00\x00\x00" > %t-invalid-size-note.bin | ||
# RUN: echo -e -n "\x07\x00\x00\x00" >> %t-invalid-size-note.bin | ||
# RUN: echo -e -n "\x03\x00\x00\x00" >> %t-invalid-size-note.bin | ||
# RUN: echo -e -n "GNU\x00" >> %t-invalid-size-note.bin | ||
# RUN: echo -e -n "\x0c\x0d\x0e\x00" >> %t-invalid-size-note.bin | ||
|
||
# RUN: echo -e -n "\x08\x00\x00\x00" > %t-short-note.bin | ||
# RUN: echo -e -n "\x07\x00\x00\x00" >> %t-short-note.bin | ||
|
||
# RUN: yaml2obj %s -o %t.o | ||
# RUN: not llvm-objcopy --add-section=.note.miss.padding=%t-miss-padding-note.bin %t.o %t-with-note.o 2>&1 | FileCheck --check-prefix=CHECK-MISS-PADDING %s | ||
# RUN: not llvm-objcopy --add-section=.note.invalid.size=%t-invalid-size-note.bin %t.o %t-with-note.o 2>&1 | FileCheck --check-prefix=CHECK-INVALID-SIZE %s | ||
# RUN: not llvm-objcopy --add-section=.note.short=%t-short-note.bin %t.o %t-with-note.o 2>&1 | FileCheck --check-prefix=CHECK-SHORT %s | ||
|
||
!ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_X86_64 | ||
|
||
# CHECK-MISS-PADDING: .note.miss.padding data size must be a multiple of 4 bytes. | ||
# CHECK-INVALID-SIZE: .note.invalid.size data size is incompatible with the content of the name and description size fields: expecting 28, found 20. | ||
# CHECK-SHORT: .note.short data must be either empty or at least 12 bytes long. |