File: add-note.test

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (36 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download | duplicates (2)
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
# 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-note.bin
# RUN: echo -e -n "\x10\x00\x00\x00" >> %t-note.bin
# RUN: echo -e -n "\x03\x00\x00\x00" >> %t-note.bin
# RUN: echo -e -n "GNU\x00"          >> %t-note.bin
# RUN: echo -e -n "\x00\x01\x02\x03" >> %t-note.bin
# RUN: echo -e -n "\x04\x05\x06\x07" >> %t-note.bin
# RUN: echo -e -n "\x08\x09\x0a\x0b" >> %t-note.bin
# RUN: echo -e -n "\x0c\x0d\x0e\x0f" >> %t-note.bin

# RUN: yaml2obj %s > %t.o
# RUN: llvm-objcopy --add-section=.note.gnu.build-id=%t-note.bin %t.o %t-with-note.o
# RUN: llvm-readobj --notes %t-with-note.o | FileCheck %s

!ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_X86_64

# CHECK:      Notes [
# CHECK-NEXT:   NoteSection {
# CHECK-NEXT:     Offset:
# CHECK-NEXT:     Size:
# CHECK-NEXT:     Note {
# CHECK-NEXT:       Owner: GNU
# CHECK-NEXT:       Data size: 0x10
# CHECK-NEXT:       Type: NT_GNU_BUILD_ID
# CHECK-NEXT:       Build ID: 000102030405060708090a0b0c0d0e0f
# CHECK-NEXT:     }
# CHECK-NEXT:   }
# CHECK-NEXT: ]