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