diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9340fc6..bfebbfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,82 +31,93 @@ jobs: fail-fast: false matrix: include: - - { title: "linux-lib" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", problem_matcher: "cpp" } - - { title: "windows-lib" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , problem_matcher: "cpp" } + - { title: "linux-lib" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } + - { title: "macos-lib" , os: "macos-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } + - { title: "windows-lib" , os: "windows-latest", cc: "vs2022" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } - - { title: "diag-asan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON", diagnostics: "address" } - - { title: "diag-ubsan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON", diagnostics: "undefined" } - - { title: "diag-valgrind" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON", diagnostics: "valgrind" } - - { title: "diag-scan-build", os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , diagnostics: "scan-build" } + - { title: "diag-asan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "address" , defs: "ASMJIT_TEST=1" } + - { title: "diag-ubsan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "undefined", defs: "ASMJIT_TEST=1" } + - { title: "diag-valgrind" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "valgrind" , defs: "ASMJIT_TEST=1" } + - { title: "diag-scan-build" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , diagnostics: "scan-build" } - - { title: "no-deprecated" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON,ASMJIT_NO_DEPRECATED=1" } - - { title: "no-intrinsics" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON,ASMJIT_NO_INTRINSICS=1" } - - { title: "no-logging" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON,ASMJIT_NO_LOGGING=1" } - - { title: "no-builder" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON,ASMJIT_NO_BUILDER=1" } - - { title: "no-compiler" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON,ASMJIT_NO_COMPILER=1" } + - { title: "no-deprecated" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_DEPRECATED=1" } + - { title: "no-intrinsics" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_INTRINSICS=1" } + - { title: "no-logging" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_LOGGING=1" } + - { title: "no-builder" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_BUILDER=1" } + - { title: "no-compiler" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_COMPILER=1" } + - { title: "no-jit" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_JIT=1" } + - { title: "no-introspection", os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_INTROSPECTI1=1" } + - { title: "no-validation" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_VALIDATI1=1" } + - { title: "no-x86" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_X86=1" } + - { title: "no-aarch64" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_AARCH64=1" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "gcc-11" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "gcc-11" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=1" } - - { title: "macos" , os: "macos-11.0" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "macos" , os: "macos-11.0" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "macos" , os: "macos-11.0" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "macos" , os: "macos-11.0" , cc: "clang" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + - { host: "macos-12" , os: "freebsd", osver: "13.1", cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + - { host: "macos-12" , os: "netbsd" , osver: "9.2" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + - { host: "macos-12" , os: "openbsd", osver: "7.2" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + - { host: "ubuntu-latest" , os: "openbsd", osver: "7.2" , cc: "clang", arch: "arm64" , build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } + name: "${{matrix.title || format('{0}-{1}', matrix.os, matrix.osver)}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" + runs-on: "${{matrix.host || matrix.os}}" - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Debug" , defs: "ASMJIT_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - name: "${{matrix.title}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" - runs-on: "${{matrix.os}}" + # name: "${{matrix.os}}-${{matrix.osver}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" + # runs-on: ${{}} steps: - name: "Checkout" @@ -125,57 +136,19 @@ jobs: with: python-version: "3.x" - - name: "Prepare" + - name: "Build & Test" + if: ${{!matrix.host}} run: python build-actions/action.py - --step=prepare - --compiler=${{matrix.cc}} - --diagnostics=${{matrix.diagnostics}} - --architecture=${{matrix.arch}} + --step=all + --compiler=${{matrix.cc}} + --architecture=${{matrix.arch}} + --source-dir=source + --config=source/.github/workflows/build-config.json + --build-type=${{matrix.build_type}} + --build-defs=${{matrix.defs}} - - name: "Configure" - run: python build-actions/action.py - --step=configure - --config=source/.github/workflows/build-config.json - --source-dir=source - --compiler=${{matrix.cc}} - --diagnostics=${{matrix.diagnostics}} - --architecture=${{matrix.arch}} - --build-type=${{matrix.build_type}} - --build-defs=${{matrix.defs}} - --problem-matcher=${{matrix.problem_matcher}} - - - name: "Build" - run: python build-actions/action.py --step=build - - - name: "Test" - run: python build-actions/action.py --step=test - - build-vm: - strategy: - fail-fast: false - matrix: - include: - - { host: "macos-12" , os: "freebsd", osver: "13.1", cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { host: "macos-12" , os: "netbsd" , osver: "9.2" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { host: "macos-12" , os: "openbsd", osver: "7.2" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "ASMJIT_TEST=ON" } - - { host: "ubuntu-latest", os: "openbsd", osver: "7.2" , cc: "clang", arch: "arm64" , build_type: "Release", defs: "ASMJIT_TEST=ON" } - - name: "${{matrix.os}}-${{matrix.osver}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" - runs-on: ${{matrix.host}} - - steps: - - name: "Checkout" - uses: actions/checkout@v3 - with: - path: "source" - - - name: "Checkout Build Actions" - uses: actions/checkout@v3 - with: - repository: build-actions/build-actions - path: "build-actions" - - - name: Build & Test in VM + - name: "Build & Test in VM" + if: ${{matrix.host}} uses: cross-platform-actions/action@master with: operating_system: ${{matrix.os}} diff --git a/test/asmjit_test_compiler.cpp b/test/asmjit_test_compiler.cpp index 293b84e..c6b1c28 100644 --- a/test/asmjit_test_compiler.cpp +++ b/test/asmjit_test_compiler.cpp @@ -13,37 +13,36 @@ #include #include +#if !defined(ASMJIT_NO_COMPILER) + #include "cmdline.h" #include "asmjitutils.h" #include "performancetimer.h" - #include "asmjit_test_compiler.h" -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 -#include -void compiler_add_x86_tests(TestApp& app); -#endif +#if !defined(ASMJIT_NO_X86) + #include + void compiler_add_x86_tests(TestApp& app); +#endif // !ASMJIT_NO_X86 -#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64 -#include -void compiler_add_a64_tests(TestApp& app); -#endif - -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 - #define ASMJIT_HAVE_WORKING_JIT -#endif - -#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64 - #define ASMJIT_HAVE_WORKING_JIT -#endif +#if !defined(ASMJIT_NO_AARCH64) + #include + void compiler_add_a64_tests(TestApp& app); +#endif // !ASMJIT_NO_AARCH64 using namespace asmjit; int TestApp::handleArgs(int argc, const char* const* argv) { CmdLine cmd(argc, argv); + _arch = cmd.valueOf("--arch", "all"); + if (cmd.hasArg("--help")) _helpOnly = true; if (cmd.hasArg("--verbose")) _verbose = true; + +#ifndef ASMJIT_NO_LOGGING if (cmd.hasArg("--dump-asm")) _dumpAsm = true; +#endif // !ASMJIT_NO_LOGGING + if (cmd.hasArg("--dump-hex")) _dumpHex = true; return 0; @@ -55,31 +54,63 @@ void TestApp::showInfo() { unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF), asmjitArchAsString(Arch::kHost)); - printf(" [%s] Verbose (use --verbose to turn verbose output ON)\n", _verbose ? "x" : " "); - printf(" [%s] DumpAsm (use --dump-asm to turn assembler dumps ON)\n", _dumpAsm ? "x" : " "); - printf(" [%s] DumpHex (use --dump-hex to dump binary in hexadecimal)\n", _dumpHex ? "x" : " "); + + printf("Usage:\n"); + printf(" --help Show usage only\n"); + printf(" --arch= Select architecture to run ('all' by default)\n"); + printf(" --verbose Verbose output\n"); + printf(" --dump-asm Assembler output\n"); + printf(" --dump-hex Hexadecimal output (relocated, only for host arch)\n"); printf("\n"); } +#ifndef ASMJIT_NO_LOGGING +class IndentedStdoutLogger : public Logger { +public: + ASMJIT_NONCOPYABLE(IndentedStdoutLogger) + + size_t _indentation = 0; + + explicit IndentedStdoutLogger(size_t indentation) noexcept + : _indentation(indentation) {} + + Error _log(const char* data, size_t size = SIZE_MAX) noexcept override { + asmjit::DebugUtils::unused(size); + printIndented(data, _indentation); + return kErrorOk; + } +}; +#endif // !ASMJIT_NO_LOGGING + int TestApp::run() { -#ifndef ASMJIT_HAVE_WORKING_JIT - return 0; -#else #ifndef ASMJIT_NO_LOGGING FormatOptions formatOptions; formatOptions.addFlags( FormatFlags::kMachineCode | FormatFlags::kExplainImms | FormatFlags::kRegCasts ); + formatOptions.setIndentation(FormatIndentationGroup::kCode, 2); - FileLogger fileLogger(stdout); - fileLogger.setOptions(formatOptions); + IndentedStdoutLogger printLogger(4); + printLogger.setOptions(formatOptions); StringLogger stringLogger; stringLogger.setOptions(formatOptions); -#endif + auto printStringLoggerContent = [&]() { + if (!_verbose) + printf("%s", stringLogger.data()); + }; +#else + auto printStringLoggerContent = [&]() {}; +#endif // !ASMJIT_NO_LOGGING + + // maybe unused... + DebugUtils::unused(printStringLoggerContent); + +#ifndef ASMJIT_NO_JIT JitRuntime runtime; +#endif // !ASMJIT_NO_JIT PerformanceTimer compileTimer; PerformanceTimer finalizeTimer; @@ -88,54 +119,134 @@ int TestApp::run() { for (std::unique_ptr& test : _tests) { for (uint32_t pass = 0; pass < 2; pass++) { + bool runnable = false; CodeHolder code; SimpleErrorHandler errorHandler; - code.init(runtime.environment(), runtime.cpuFeatures()); + const char* statusSeparator = " "; + + // Filter architecture to run. + if (strcmp(_arch, "all") != 0) { + switch (test->arch()) { + case Arch::kX86: + if (strcmp(_arch, "x86") == 0) + break; + continue; + case Arch::kX64: + if (strcmp(_arch, "x64") == 0) + break; + continue; + case Arch::kAArch64: + if (strcmp(_arch, "aarch64") == 0) + break; + continue; + default: + continue; + } + } + + // Use platform environment and CPU features when the test can run on the arch. +#ifndef ASMJIT_NO_JIT + if (runtime.arch() == test->arch()) { + code.init(runtime.environment(), runtime.cpuFeatures()); + runnable = true; + } +#endif // !ASMJIT_NO_JIT + + if (!code.isInitialized()) { + Environment customEnv; + CpuFeatures features; + + switch (test->arch()) { + case Arch::kX86: + case Arch::kX64: + features.add(CpuFeatures::X86::kADX, + CpuFeatures::X86::kAVX, + CpuFeatures::X86::kAVX2, + CpuFeatures::X86::kBMI, + CpuFeatures::X86::kBMI2, + CpuFeatures::X86::kCMOV, + CpuFeatures::X86::kF16C, + CpuFeatures::X86::kFMA, + CpuFeatures::X86::kFPU, + CpuFeatures::X86::kI486, + CpuFeatures::X86::kLZCNT, + CpuFeatures::X86::kMMX, + CpuFeatures::X86::kMMX2, + CpuFeatures::X86::kPOPCNT, + CpuFeatures::X86::kSSE, + CpuFeatures::X86::kSSE2, + CpuFeatures::X86::kSSE3, + CpuFeatures::X86::kSSSE3, + CpuFeatures::X86::kSSE4_1, + CpuFeatures::X86::kSSE4_2); + break; + + case Arch::kAArch64: + features.add(CpuFeatures::ARM::kAES, + CpuFeatures::ARM::kASIMD, + CpuFeatures::ARM::kIDIVA, + CpuFeatures::ARM::kIDIVT, + CpuFeatures::ARM::kPMULL); + break; + + default: + break; + } + + customEnv.init(test->arch()); + code.init(customEnv, features); + } + code.setErrorHandler(&errorHandler); if (pass != 0) { + printf("[Test:%s] %s", asmjitArchAsString(test->arch()), test->name()); + #ifndef ASMJIT_NO_LOGGING + if (_verbose || _dumpAsm || _dumpHex) { + printf("\n"); + statusSeparator = " "; + } + if (_verbose) { - code.setLogger(&fileLogger); + printf(" [Log]\n"); + code.setLogger(&printLogger); } else { stringLogger.clear(); code.setLogger(&stringLogger); } -#endif - - printf("[Test] %s", test->name()); - -#ifndef ASMJIT_NO_LOGGING - if (_verbose) - printf("\n"); -#endif +#endif // !ASMJIT_NO_LOGGING } + std::unique_ptr cc; -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 - x86::Compiler cc(&code); -#endif +#ifndef ASMJIT_NO_X86 + if (code.arch() == Arch::kX86 || code.arch() == Arch::kX64) + cc = std::unique_ptr(new x86::Compiler(&code)); +#endif // !ASMJIT_NO_X86 -#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64 - a64::Compiler cc(&code); -#endif +#ifndef ASMJIT_NO_AARCH64 + if (code.arch() == Arch::kAArch64) + cc = std::unique_ptr(new a64::Compiler(&code)); +#endif // !ASMJIT_NO_AARCH64 + + if (!cc) + continue; #ifndef ASMJIT_NO_LOGGING - cc.addDiagnosticOptions(DiagnosticOptions::kRAAnnotate | DiagnosticOptions::kRADebugAll); -#endif + cc->addDiagnosticOptions(DiagnosticOptions::kRAAnnotate | DiagnosticOptions::kRADebugAll); +#endif // !ASMJIT_NO_LOGGING compileTimer.start(); - test->compile(cc); + test->compile(*cc); compileTimer.stop(); - void* func = nullptr; Error err = errorHandler._err; - if (!err) { finalizeTimer.start(); - err = cc.finalize(); + err = cc->finalize(); finalizeTimer.stop(); } @@ -150,72 +261,85 @@ int TestApp::run() { #ifndef ASMJIT_NO_LOGGING if (_dumpAsm) { - if (!_verbose) - printf("\n"); - String sb; - Formatter::formatNodeList(sb, formatOptions, &cc); - printf("%s", sb.data()); + Formatter::formatNodeList(sb, formatOptions, cc.get()); + printf(" [Assembly]\n"); + printIndented(sb.data(), 4); } -#endif +#endif // !ASMJIT_NO_LOGGING - if (err == kErrorOk) - err = runtime.add(&func, &code); +#ifndef ASMJIT_NO_JIT + if (runnable) { + void* func = nullptr; + if (err == kErrorOk) + err = runtime.add(&func, &code); - if (err == kErrorOk && _dumpHex) { - String sb; - sb.appendHex((void*)func, code.codeSize()); - printf("\n (HEX: %s)\n", sb.data()); - } + if (err == kErrorOk && _dumpHex) { + String sb; + sb.appendHex((void*)func, code.codeSize()); + printf(" [Hex Dump]:\n"); + for (size_t i = 0; i < sb.size(); i += 76) { + printf(" %.60s\n", sb.data() + i); + } + } - if (_verbose) - fflush(stdout); + if (_verbose) + fflush(stdout); - if (err == kErrorOk) { - _outputSize += code.codeSize(); + if (err == kErrorOk) { + _outputSize += code.codeSize(); - StringTmp<128> result; - StringTmp<128> expect; + StringTmp<128> result; + StringTmp<128> expect; - if (test->run(func, result, expect)) { - if (!_verbose) - printf(" [OK]\n"); + if (test->run(func, result, expect)) { + if (!_verbose) + printf("%s[RUN OK]\n", statusSeparator); + } + else { + if (!_verbose) + printf("%s[RUN FAILED]\n", statusSeparator); + + printStringLoggerContent(); + printf(" [Output]\n"); + printf(" Returned: %s\n", result.data()); + printf(" Expected: %s\n", expect.data()); + _nFailed++; + } + + if (_dumpAsm) + printf("\n"); + + runtime.release(func); } else { if (!_verbose) - printf(" [FAILED]\n"); - -#ifndef ASMJIT_NO_LOGGING - if (!_verbose) - printf("%s", stringLogger.data()); -#endif - - printf("[Status]\n"); - printf(" Returned: %s\n", result.data()); - printf(" Expected: %s\n", expect.data()); + printf("%s[COMPILE FAILED]\n", statusSeparator); + printStringLoggerContent(); + printf(" [Status]\n"); + printf(" ERROR 0x%08X: %s\n", unsigned(err), errorHandler._message.data()); _nFailed++; } - - if (_dumpAsm) - printf("\n"); - - runtime.release(func); } - else { - if (!_verbose) - printf(" [FAILED]\n"); +#endif // !ASMJIT_NO_JIT + + if (!runnable) { + if (err) { + printf(" [Status]\n"); + printf(" ERROR 0x%08X: %s\n", unsigned(err), errorHandler._message.data()); + _nFailed++; + } + else { + printf("%s[COMPILE OK]\n", statusSeparator); + } + } #ifndef ASMJIT_NO_LOGGING - if (!_verbose) - printf("%s", stringLogger.data()); -#endif - - printf("[Status]\n"); - printf(" ERROR 0x%08X: %s\n", unsigned(err), errorHandler._message.data()); - - _nFailed++; + if (_verbose || _dumpAsm || _dumpHex) { + printf("\n"); } +#endif // !ASMJIT_NO_LOGGING } } @@ -232,7 +356,6 @@ int TestApp::run() { printf("** FAILURE: %u of %u tests failed **\n", _nFailed, unsigned(_tests.size())); return _nFailed == 0 ? 0 : 1; -#endif } int main(int argc, char* argv[]) { @@ -241,13 +364,24 @@ int main(int argc, char* argv[]) { app.handleArgs(argc, argv); app.showInfo(); -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 +#if !defined(ASMJIT_NO_X86) compiler_add_x86_tests(app); -#endif +#endif // !ASMJIT_NO_X86 -#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64 +#if !defined(ASMJIT_NO_AARCH64) compiler_add_a64_tests(app); -#endif +#endif // !ASMJIT_NO_AARCH64 return app.run(); } + +#else + +int main(int argc, char* argv[]) { + DebugUtils::unused(argc, argv); + + printf("AsmJit Compiler Test suite is disabled when compiling with ASMJIT_NO_COMPILER\n\n"); + return 0; +} + +#endif // !ASMJIT_NO_COMPILER diff --git a/test/asmjit_test_compiler.h b/test/asmjit_test_compiler.h index e694b37..79414d0 100644 --- a/test/asmjit_test_compiler.h +++ b/test/asmjit_test_compiler.h @@ -29,33 +29,39 @@ public: //! A test case interface for testing AsmJit's Compiler. class TestCase { public: - TestCase(const char* name = nullptr) { + TestCase(const char* name, asmjit::Arch arch) { if (name) _name.assign(name); + _arch = arch; } virtual ~TestCase() {} inline const char* name() const { return _name.data(); } + inline asmjit::Arch arch() const { return _arch; } virtual void compile(asmjit::BaseCompiler& cc) = 0; virtual bool run(void* func, asmjit::String& result, asmjit::String& expect) = 0; asmjit::String _name; + asmjit::Arch _arch; }; class TestApp { public: std::vector> _tests; - unsigned _nFailed = 0; - size_t _outputSize = 0; - + const char* _arch = nullptr; + bool _helpOnly = false; bool _verbose = false; bool _dumpAsm = false; bool _dumpHex = false; - TestApp() noexcept {} + unsigned _nFailed = 0; + size_t _outputSize = 0; + + TestApp() noexcept + : _arch("all") {} ~TestApp() noexcept {} void add(TestCase* test) noexcept { diff --git a/test/asmjit_test_compiler_a64.cpp b/test/asmjit_test_compiler_a64.cpp index 4fc362e..17eb7b4 100644 --- a/test/asmjit_test_compiler_a64.cpp +++ b/test/asmjit_test_compiler_a64.cpp @@ -4,7 +4,7 @@ // SPDX-License-Identifier: Zlib #include -#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64 +#if !defined(ASMJIT_NO_COMPILER) && !defined(ASMJIT_NO_AARCH64) #include #include @@ -21,7 +21,7 @@ using namespace asmjit; class A64TestCase : public TestCase { public: A64TestCase(const char* name = nullptr) - : TestCase(name) {} + : TestCase(name, Arch::kAArch64) {} virtual void compile(BaseCompiler& cc) override { compile(static_cast(cc)); @@ -687,4 +687,4 @@ void compiler_add_a64_tests(TestApp& app) { app.addT(); } -#endif // !ASMJIT_NO_AARCH64 && ASMJIT_ARCH_ARM == 64 +#endif // !ASMJIT_NO_COMPILER && !ASMJIT_NO_AARCH64 diff --git a/test/asmjit_test_compiler_x86.cpp b/test/asmjit_test_compiler_x86.cpp index bc867eb..2539d16 100644 --- a/test/asmjit_test_compiler_x86.cpp +++ b/test/asmjit_test_compiler_x86.cpp @@ -4,7 +4,7 @@ // SPDX-License-Identifier: Zlib #include -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 +#if !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_COMPILER) #include #include @@ -12,8 +12,10 @@ #include #include -// Required for function tests that pass / return XMM registers. -#include +#if ASMJIT_ARCH_X86 + // Required for function tests that pass / return XMM registers. + #include +#endif #include "asmjit_test_misc.h" #include "asmjit_test_compiler.h" @@ -31,7 +33,7 @@ using namespace asmjit; class X86TestCase : public TestCase { public: X86TestCase(const char* name = nullptr) - : TestCase(name) {} + : TestCase(name, Arch::kHost == Arch::kX86 ? Arch::kX86 : Arch::kX64) {} virtual void compile(BaseCompiler& cc) override { compile(static_cast(cc)); @@ -1888,6 +1890,7 @@ public: // x86::Compiler - X86Test_AllocArgsVec // ==================================== +#if ASMJIT_ARCH_X86 class X86Test_AllocArgsVec : public X86TestCase { public: X86Test_AllocArgsVec() : X86TestCase("AllocArgsVec") {} @@ -1937,6 +1940,7 @@ public: return result == expect; } }; +#endif // ASMJIT_ARCH_X86 // x86::Compiler - X86Test_AllocRetFloat1 // ====================================== @@ -2615,6 +2619,7 @@ public: // x86::Compiler - X86Test_FuncCallSIMD // ==================================== +#if ASMJIT_ARCH_X86 class X86Test_FuncCallSIMD : public X86TestCase { public: bool _useVectorCall; @@ -2701,6 +2706,7 @@ public: } #endif }; +#endif // ASMJIT_ARCH_X86 // x86::Compiler - X86Test_FuncCallLight // ===================================== @@ -4390,7 +4396,9 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); app.addT(); app.addT(); +#if ASMJIT_ARCH_X86 app.addT(); +#endif app.addT(); app.addT(); app.addT(); @@ -4405,7 +4413,9 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); app.addT(); app.addT(); +#if ASMJIT_ARCH_X86 app.addT(); +#endif app.addT(); app.addT(); app.addT(); @@ -4436,4 +4446,4 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); } -#endif // !ASMJIT_NO_X86 && ASMJIT_ARCH_X86 +#endif // !ASMJIT_NO_X86 && !ASMJIT_NO_COMPILER diff --git a/test/asmjit_test_emitters.cpp b/test/asmjit_test_emitters.cpp index 74db996..7436bf5 100644 --- a/test/asmjit_test_emitters.cpp +++ b/test/asmjit_test_emitters.cpp @@ -5,7 +5,7 @@ #include -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 +#if ASMJIT_ARCH_X86 && !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_JIT) #include #include @@ -191,7 +191,7 @@ int main() { } #else int main() { - printf("AsmJit X86 Emitter Test is disabled on non-x86 host\n\n"); + printf("AsmJit X86 Emitter Test is disabled on non-x86 hosts or when compiled with ASMJIT_NO_JIT option\n\n"); return 0; } -#endif // !ASMJIT_NO_X86 && ASMJIT_ARCH_X86 +#endif // ASMJIT_ARCH_X86 && !ASMJIT_NO_X86 && !ASMJIT_NO_JIT diff --git a/test/asmjit_test_x86_sections.cpp b/test/asmjit_test_x86_sections.cpp index 353b5e4..6e4d573 100644 --- a/test/asmjit_test_x86_sections.cpp +++ b/test/asmjit_test_x86_sections.cpp @@ -17,7 +17,7 @@ // ---------------------------------------------------------------------------- #include -#if !defined(ASMJIT_NO_X86) && ASMJIT_ARCH_X86 +#if ASMJIT_ARCH_X86 && !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_JIT) #include #include @@ -136,16 +136,15 @@ int main() { // Relocate to the base-address of the allocated memory. code.relocateToBase(uint64_t(uintptr_t(rxPtr))); - VirtMem::protectJitMemory(VirtMem::ProtectJitAccess::kReadWrite); + { + VirtMem::ProtectJitReadWriteScope scope(rxPtr, code.codeSize()); - // Copy the flattened code into `mem.rw`. There are two ways. You can either copy - // everything manually by iterating over all sections or use `copyFlattenedData`. - // This code is similar to what `copyFlattenedData(p, codeSize, 0)` would do: - for (Section* section : code.sectionsByOrder()) - memcpy(static_cast(rwPtr) + size_t(section->offset()), section->data(), section->bufferSize()); - - VirtMem::protectJitMemory(VirtMem::ProtectJitAccess::kReadExecute); - VirtMem::flushInstructionCache(rwPtr, code.codeSize()); + // Copy the flattened code into `mem.rw`. There are two ways. You can either copy + // everything manually by iterating over all sections or use `copyFlattenedData`. + // This code is similar to what `copyFlattenedData(p, codeSize, 0)` would do: + for (Section* section : code.sectionsByOrder()) + memcpy(static_cast(rwPtr) + size_t(section->offset()), section->data(), section->bufferSize()); + } // Execute the function and test whether it works. typedef size_t (*Func)(size_t idx); @@ -166,7 +165,7 @@ int main() { #else int main() { - printf("AsmJit X86 Sections Test is disabled on non-x86 host\n\n"); + printf("AsmJit X86 Sections Test is disabled on non-x86 host or when compiled with ASMJIT_NO_JIT\n\n"); return 0; } -#endif // !ASMJIT_NO_X86 && ASMJIT_ARCH_X86 +#endif // ASMJIT_ARCH_X86 && !ASMJIT_NO_X86 && !ASMJIT_NO_JIT diff --git a/test/asmjitutils.h b/test/asmjitutils.h index d84d3d4..525227e 100644 --- a/test/asmjitutils.h +++ b/test/asmjitutils.h @@ -8,6 +8,7 @@ #include +ASMJIT_MAYBE_UNUSED static const char* asmjitArchAsString(asmjit::Arch arch) noexcept { switch (arch) { case asmjit::Arch::kX86 : return "X86"; @@ -35,4 +36,21 @@ static const char* asmjitArchAsString(asmjit::Arch arch) noexcept { } } +ASMJIT_MAYBE_UNUSED +static void printIndented(const char* str, size_t indent) noexcept { + const char* start = str; + while (*str) { + if (*str == '\n') { + size_t size = (size_t)(str - start); + printf("%*s%.*s\n", size ? int(indent) : 0, "", int(size), start); + start = str + 1; + } + str++; + } + + size_t size = (size_t)(str - start); + if (size) + printf("%*s%.*s\n", int(indent), "", int(size), start); +} + #endif // ASMJITUTILS_H_INCLUDED