Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/add-note.test

raw
1 # Verify that --add-section can be used to add a note section which is
2 # successfully interpreted by tools that read notes.
3
4 # Add [namesz, descsz, type, name, desc] for a build id.
5 # RUN: echo -e -n "\x04\x00\x00\x00" > %t-note.bin
6 # RUN: echo -e -n "\x10\x00\x00\x00" >> %t-note.bin
7 # RUN: echo -e -n "\x03\x00\x00\x00" >> %t-note.bin
8 # RUN: echo -e -n "GNU\x00" >> %t-note.bin
9 # RUN: echo -e -n "\x00\x01\x02\x03" >> %t-note.bin
10 # RUN: echo -e -n "\x04\x05\x06\x07" >> %t-note.bin
11 # RUN: echo -e -n "\x08\x09\x0a\x0b" >> %t-note.bin
12 # RUN: echo -e -n "\x0c\x0d\x0e\x0f" >> %t-note.bin
13
14 # RUN: yaml2obj %s -o %t.o
15 # RUN: llvm-objcopy --add-section=.note.gnu.build-id=%t-note.bin %t.o %t-with-note.o
16 # RUN: llvm-readobj --notes %t-with-note.o | FileCheck %s
17
18 !ELF
19 FileHeader:
20 Class: ELFCLASS64
21 Data: ELFDATA2LSB
22 Type: ET_REL
23 Machine: EM_X86_64
24
25 # CHECK: NoteSections [
26 # CHECK-NEXT: NoteSection {
27 # CHECK-NEXT: Name: .note.gnu.build-id
28 # CHECK-NEXT: Offset:
29 # CHECK-NEXT: Size:
30 # CHECK-NEXT: Notes [
31 # CHECK-NEXT: {
32 # CHECK-NEXT: Owner: GNU
33 # CHECK-NEXT: Data size: 0x10
34 # CHECK-NEXT: Type: NT_GNU_BUILD_ID
35 # CHECK-NEXT: Build ID: 000102030405060708090a0b0c0d0e0f
36 # CHECK-NEXT: }
37 # CHECK-NEXT: ]
38 # CHECK-NEXT: }
39 # CHECK-NEXT: ]