xref: /llvm-project/llvm/test/tools/llvm-objcopy/dash-dash.test (revision 1fb5278882e4abf7172b9f6d66404c8febe38ea6)
1## Create a clean temporary directory and cd to it to use relative paths.
2# RUN: rm -rf %t && mkdir %t && cd %t
3
4## Check that tools correctly treat paths after '--' as file paths,
5## even if they start with dashes.
6# RUN: yaml2obj %s -o test-obj
7# RUN: llvm-objcopy --only-section=.test test-obj -- --only-section
8# RUN: llvm-objcopy --only-section=.test test-obj out-obj1
9# RUN: cmp -- out-obj1 --only-section
10
11# RUN: cp -- test-obj --strip-symbol
12# RUN: cp -- test-obj strip-obj1
13# RUN: llvm-strip --remove-section=.test strip-obj1 -- --strip-symbol
14# RUN: cp -- test-obj no-dash-dash1
15# RUN: llvm-strip --remove-section=.test no-dash-dash1
16# RUN: cmp -- no-dash-dash1 strip-obj1
17# RUN: cmp -- no-dash-dash1 --strip-symbol
18
19## Check the case when '--' is specified with input files but no options.
20# RUN: llvm-objcopy -- test-obj --add-section
21# RUN: llvm-objcopy test-obj out-obj2
22# RUN: cmp -- out-obj2 --add-section
23
24# RUN: cp -- test-obj --keep-symbol
25# RUN: cp -- test-obj strip-obj2
26# RUN: llvm-strip -- strip-obj2 --keep-symbol
27# RUN: cp -- test-obj no-dash-dash2
28# RUN: llvm-strip no-dash-dash2
29# RUN: cmp -- no-dash-dash2 strip-obj2
30# RUN: cmp -- no-dash-dash2 --keep-symbol
31
32## Check the case when '--' is specified with options but no input files.
33# RUN: not llvm-objcopy --only-section=.test -- 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-INPUT
34# RUN: not llvm-strip --remove-section=.test -- 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-INPUT
35
36# CHECK-NO-INPUT: error: no input file specified
37
38--- !ELF
39FileHeader:
40  Class: ELFCLASS64
41  Data:  ELFDATA2LSB
42  Type:  ET_REL
43