llvm.org GIT mirror llvm / release_80 test / tools / llvm-objcopy / ELF / build-id-link-dir.test
release_80

Tree @release_80 (Download .tar.gz)

build-id-link-dir.test @release_80raw · history · blame

# 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