1 ## Test case where input file does not exit.
2 RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj -DMSG=%errc_ENOENT %s
3 RUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf -DMSG=%errc_ENOENT %s
5 ENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': [[MSG]]
7 # Test case with no input file.
8 RUN: not llvm-readobj 2>&1 | FileCheck %s --check-prefix=NO-FILE
9 RUN: not llvm-readelf 2>&1 | FileCheck %s --check-prefix=NO-FILE
10 NO-FILE: error: no input files specified
12 # Test case where input file is too small to be a recognised object file.
14 RUN: not llvm-readobj %t.empty 2>&1 | FileCheck --check-prefix=EMPTY %s
15 EMPTY: '{{.*}}.empty': The file was not recognized as a valid object file
17 # Test that unrecognised files in archives are ignored.
19 RUN: llvm-ar rc %t.a %t.empty
20 RUN: llvm-readobj --all %t.a 2>&1 | FileCheck --check-prefix=NO-OUTPUT --allow-empty %s
23 ## Test we report a meaningful warning for bitcode files.
24 ## Check we try to continue dumping other files.
26 ## Note: 'echo -e -n "\x42\x43\xc0\xde" > %t.bc.1' simply doesn't work properly on windows.
27 ## It has an issue with writing of the 2 last bytes and emits different data instead.
28 ## echo.exe from GnuWin32 works properly though, but using of python is a more stable way.
29 RUN: %python -c "import os; open(r'%t.bc.1', 'wb').write(b'\x42\x43\xC0\xDE')"
30 RUN: %python -c "import os; open(r'%t.bc.2', 'wb').write(b'\xDE\xC0\x17\x0B')"
31 RUN: llvm-readelf %t.bc.1 %t.bc.2 2>&1 | \
32 RUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s
33 RUN: llvm-readobj %t.bc.1 %t.bc.2 2>&1 | \
34 RUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s
36 # BITCODE: warning: '[[FILE1]]': bitcode files are not supported{{$}}
37 # BITCODE: warning: '[[FILE2]]': bitcode files are not supported{{$}}
39 # Test case where switch it not recognised.
40 RUN: not llvm-readobj --unknown-switch 2>&1 | FileCheck --check-prefix=UNKNOWN %s
41 UNKNOWN: error: unknown argument '--unknown-switch'
43 # Test version switch.
44 RUN: llvm-readobj --version | FileCheck %s --check-prefix=VERSION
45 RUN: llvm-readelf --version | FileCheck %s --check-prefix=VERSION
46 # In default configuration we could match "LLVM version", but the "LLVM" part
47 # can be changed with PACKAGE_NAME in CMake, so we match only version.
51 RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ
52 RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF
53 HELP: OVERVIEW: LLVM Object Reader
54 OBJ: llvm-readobj{{.*}} [options] <input object files>
55 ELF: llvm-readelf{{.*}} [options] <input object files>
57 HELP: -s Alias for --symbols
58 HELP: -t Alias for --section-details
59 HELP: OPTIONS (ELF specific):
61 HELP: OPTIONS (Mach-O specific):
62 HELP: --macho-data-in-code
63 HELP: OPTIONS (PE/COFF specific):
64 HELP: --codeview-ghash