reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
## 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