This initial commit does not add any specific binary analyses yet, it merely contains the boilerplate to introduce a new BOLT-based tool. This basically combines the 4 first patches from the prototype pac-ret and stack-clash binary analyzer discussed in RFC https://discourse.llvm.org/t/rfc-bolt-based-binary-analysis-tool-to-verify-correctness-of-security-hardening/78148 and published at https://github.com/llvm/llvm-project/compare/main...kbeyls:llvm-project:bolt-gadget-scanner-prototype The introduction of such a BOLT-based binary analysis tool was proposed and discussed in at least the following places: - The RFC pointed to above - EuroLLVM 2024 round table https://discourse.llvm.org/t/summary-of-bolt-as-a-binary-analysis-tool-round-table-at-eurollvm/78441 The round table showed quite a few people interested in being able to build a custom binary analysis quickly with a tool like this. - Also at the US LLVM dev meeting a few weeks ago, I heard interest from a few people, asking when the tool would be available upstream. - The presentation "Adding Pointer Authentication ABI support for your ELF platform" (https://llvm.swoogo.com/2024devmtg/session/2512720/adding-pointer-authentication-abi-support-for-your-elf-platform) explicitly mentioned interest to extend the prototype tool to verify correct implementation of pauthabi.
34 lines
1.6 KiB
Plaintext
34 lines
1.6 KiB
Plaintext
# This file tests error messages produced on invalid command line arguments.
|
|
# It also checks that help messages are generated as expected.
|
|
|
|
# Verify that an error message is provided if an input file is missing or incorrect
|
|
|
|
RUN: not llvm-bolt-binary-analysis 2>&1 | FileCheck -check-prefix=NOFILEARG %s
|
|
NOFILEARG: llvm-bolt-binary-analysis: Not enough positional command line arguments specified!
|
|
NOFILEARG-NEXT: Must specify at least 1 positional argument: See: {{.*}}llvm-bolt-binary-analysis --help
|
|
|
|
RUN: not llvm-bolt-binary-analysis non-existing-file 2>&1 | FileCheck -check-prefix=NONEXISTINGFILEARG %s
|
|
NONEXISTINGFILEARG: llvm-bolt-binary-analysis: 'non-existing-file': No such file or directory.
|
|
|
|
RUN: not llvm-bolt-binary-analysis %p/Inputs/dummy.txt 2>&1 | FileCheck -check-prefix=NOELFFILEARG %s
|
|
NOELFFILEARG: llvm-bolt-binary-analysis: '{{.*}}/Inputs/dummy.txt': The file was not recognized as a valid object file.
|
|
|
|
RUN: %clang %cflags %p/../../Inputs/asm_foo.s %p/../../Inputs/asm_main.c -o %t.exe
|
|
RUN: llvm-bolt-binary-analysis %t.exe 2>&1 | FileCheck -check-prefix=VALIDELFFILEARG --allow-empty %s
|
|
# Check that there are no BOLT-WARNING or BOLT-ERROR output lines
|
|
VALIDELFFILEARG: BOLT-INFO:
|
|
VALIDELFFILEARG-NOT: BOLT-WARNING:
|
|
VALIDELFFILEARG-NOT: BOLT-ERROR:
|
|
|
|
# Check --help output
|
|
|
|
RUN: llvm-bolt-binary-analysis --help 2>&1 | FileCheck -check-prefix=HELP %s
|
|
|
|
HELP: OVERVIEW: BinaryAnalysis
|
|
HELP-EMPTY:
|
|
HELP-NEXT: USAGE: llvm-bolt-binary-analysis [options] <executable>
|
|
HELP-EMPTY:
|
|
HELP-NEXT: OPTIONS:
|
|
HELP-EMPTY:
|
|
HELP-NEXT: Generic Options:
|