File: build-id-link-dir.test

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,388 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 (56 lines) | stat: -rw-r--r-- 2,386 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# RUN: yaml2obj %s > %t
# RUN: mkdir -p %t-dir

# RUN: llvm-objcopy --build-id-link-dir=%t-dir %t %t2
# RUN: not test -e %t-dir/4f/cb712aa6387724a9f465a32cd8c14b

# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t %t3
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug %t
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug

# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-output "" --strip-sections %t %t4
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b %t4
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b

# Linking the output of an inplace argument means that the file in the build-id
# directory will be hard-linked to the resulting file.
# RUN: cp %t %t5
# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-output "" --strip-sections %t5
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b %t5
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b

# Linking the input of an inplace argument means that the file in the build-id
# directory will be hard-linked to the original file.
# RUN: cp %t %t6
# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug --strip-sections %t6
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug %t
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug

# You can use both at once.
# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-output "" --build-id-link-input=.debug --strip-sections %t %t7
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug %t
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b %t7
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b

# --build-id-link-output can have a suffix as well
# RUN: llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-output=.debug --only-keep-debug %t %t8
# RUN: cmp %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug %t8
# RUN: rm %t-dir/4f/cb712aa6387724a9f465a32cd8c14b.debug

--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_EXEC
  Machine:         EM_X86_64
Sections:
  - Name:            .note.gnu.build-id
    Type:            SHT_NOTE
    Flags:           [ SHF_ALLOC ]
    Content:         040000001000000003000000474E55004FCB712AA6387724A9F465A32CD8C14B
ProgramHeaders:
  - Type: PT_NOTE
    Flags: [ PF_R ]
    Sections:
      - Section: .note.gnu.build-id