mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
bf2ba230f0
Fix: Add a `consumeError` call removed by mistake to 'printStackSize', this should fix the "Expected<T> must be checked before access or destruction." reported by following bot: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio Original commit message: Currently we have the following functions for error reporting: LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg); void reportError(Error Err, StringRef Input); void reportWarning(Twine Msg); void reportWarning(StringRef Input, Error Err); void warn(llvm::Error Err); void error(std::error_code EC); Problems are: naming is inconsistent, arguments order is inconsistent, some of the functions looks excessive. After applying this patch we have: void reportError(Error Err, StringRef Input); void reportError(std::error_code EC, StringRef Input); void reportWarning(Error Err, StringRef Input); I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it is used by COFF heavily. Test cases were updated, they show an improvement introduced. Differential revision: https://reviews.llvm.org/D66286 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369194 91177308-0d34-0410-b5e6-96231b3b80d8
147 lines
4.3 KiB
Plaintext
147 lines
4.3 KiB
Plaintext
## Test that malformed NT_FILE sections in core files are gracefully ignored.
|
|
|
|
## llvm-mc doesn't support generating ET_CORE files; the 'Content' field in
|
|
## each of the following test cases were generated with the following steps:
|
|
# $ llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu tmp.s -o tmp.o
|
|
# $ bin/llvm-objcopy --dump-section=.note.foo=tmp.txt tmp.o /dev/null
|
|
# $ xxd -p tmp.txt | tr -d '\n'; echo
|
|
# using the assembly shown with each test case.
|
|
|
|
# RUN: yaml2obj --docnum=1 %s -o %t1.o
|
|
# RUN: llvm-readelf -n %t1.o 2>&1 | FileCheck -DFILE=%t1.o %s --check-prefix=ERR-HEADER-SHORT
|
|
# ERR-HEADER-SHORT: warning: '[[FILE]]': malformed note: header too short
|
|
|
|
# .section ".note.foo", "a"
|
|
# .align 4
|
|
# .long 5 /* namesz */
|
|
# .long end - begin /* descsz */
|
|
# .long 0x46494c45 /* type = NT_FILE */
|
|
# .asciz "CORE"
|
|
# .align 4
|
|
# begin:
|
|
# .quad 0 /* no file mappings */
|
|
# end:
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_CORE
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .note.foo
|
|
Type: SHT_NOTE
|
|
Content: 0500000008000000454C4946434F5245000000000000000000000000
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
Sections:
|
|
- Section: .note.foo
|
|
|
|
# RUN: yaml2obj --docnum=2 %s -o %t2.o
|
|
# RUN: llvm-readelf -n %t2.o 2>&1 | FileCheck -DFILE=%t2.o %s --check-prefix=ERR-NULL-TERM
|
|
# ERR-NULL-TERM: warning: '[[FILE]]': malformed note: not NUL terminated
|
|
|
|
# .section ".note.foo", "a"
|
|
# .align 4
|
|
# .long 5 /* namesz */
|
|
# .long end - begin /* descsz */
|
|
# .long 0x46494c45 /* type = NT_FILE */
|
|
# .asciz "CORE"
|
|
# .align 4
|
|
# begin:
|
|
# .quad 1 /* 1 file mapping */
|
|
# .quad 4096 /* page size */
|
|
# .quad 0x1000 /* start #1 */
|
|
# .quad 0x2000 /* end #1 */
|
|
# .quad 0x3000 /* offset #1 */
|
|
# .ascii "xxxx"
|
|
# end:
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_CORE
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .note.foo
|
|
Type: SHT_NOTE
|
|
Content: 050000002C000000454C4946434F5245000000000100000000000000001000000000000000100000000000000020000000000000003000000000000078787878
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
Sections:
|
|
- Section: .note.foo
|
|
|
|
# RUN: yaml2obj --docnum=3 %s -o %t3.o
|
|
# RUN: llvm-readelf -n %t3.o 2>&1 | FileCheck -DFILE=%t3.o %s --check-prefix=ERR-FILE-COUNT
|
|
# ERR-FILE-COUNT: warning: '[[FILE]]': malformed note: too short for number of files
|
|
|
|
# .section ".note.foo", "a"
|
|
# .align 4
|
|
# .long 5 /* namesz */
|
|
# .long end - begin /* descsz */
|
|
# .long 0x46494c45 /* type = NT_FILE */
|
|
# .asciz "CORE"
|
|
# .align 4
|
|
# begin:
|
|
# .quad 2 /* 2 file mappings */
|
|
# .quad 4096 /* page size */
|
|
# .quad 0x1000 /* start #1 */
|
|
# .quad 0x2000 /* end #1 */
|
|
# .quad 0x3000 /* offset #1 */
|
|
# .asciz "xyz"
|
|
# end:
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_CORE
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .note.foo
|
|
Type: SHT_NOTE
|
|
Content: 050000002C000000454C4946434F5245000000000200000000000000001000000000000000100000000000000020000000000000003000000000000078797A00
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
Sections:
|
|
- Section: .note.foo
|
|
|
|
# RUN: yaml2obj --docnum=4 %s -o %t4.o
|
|
# RUN: llvm-readelf -n %t4.o 2>&1 | FileCheck -DFILE=%t4.o %s --check-prefix=ERR-FILE-END-EARLY
|
|
# ERR-FILE-END-EARLY: warning: '[[FILE]]': malformed note: too few filenames
|
|
|
|
# .section ".note.foo", "a"
|
|
# .align 4
|
|
# .long 5 /* namesz */
|
|
# .long end - begin /* descsz */
|
|
# .long 0x46494c45 /* type = NT_FILE */
|
|
# .asciz "CORE"
|
|
# .align 4
|
|
# begin:
|
|
# .quad 2 /* 2 file mappings */
|
|
# .quad 4096 /* page size */
|
|
# .quad 0x1000 /* start #1 */
|
|
# .quad 0x2000 /* end #1 */
|
|
# .quad 0x3000 /* offset #1 */
|
|
# .quad 0x4000 /* start #2 */
|
|
# .quad 0x5000 /* end #2 */
|
|
# .quad 0x6000 /* offset #2 */
|
|
# .asciz "xyz"
|
|
# end:
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_CORE
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .note.foo
|
|
Type: SHT_NOTE
|
|
Content: 0500000044000000454C4946434F5245000000000200000000000000001000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000078797A00
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
Sections:
|
|
- Section: .note.foo
|