File: build-id-link-dir.test

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (56 lines) | stat: -rw-r--r-- 2,387 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 -o %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