-
Notifications
You must be signed in to change notification settings - Fork 1.7k
V5 Fix big endian and 32bit builds #2943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+611
−100
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
51a2cd0
Crossbuilds for big endian
radare e18cb96
Fix warnings in the tests
radare f917bff
Fix m68k disassembler UB on 32bit hosts
radare cf503d0
Fix the same bug for mos65xx
radare eccc5a7
Fix x86 SIB scale printing on 32-bit BE hosts
radare 544f06a
Upgrade the checkout action
radare 75721b1
Update .github/workflows/CrossBuilds.yml
trufae d9af0b3
Update .github/workflows/CrossBuilds.yml
trufae c6ae43d
Move the toolchain cmake file away from the yaml
radare cef6709
More fixes
radare 72c03a5
Build mocka from source in the crossbuilds
radare 81696a6
Support SH and TMS in the testsuite
radare 51b7ddd
Improve testsuite
radare 995be72
More fixes for the cstestuite
radare b9eee0d
Fix another cstest bug
radare beeb468
more suite fixes
radare 79a8571
Missing ldlibrary to help the suite find the lib
radare 95c9209
One last 32bit UB bug fixes for arm64
radare 6375f48
Merge branch 'v5' into v5-be
Rot127 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,252 @@ | ||
| name: Cross Build Tests | ||
| on: | ||
| push: | ||
| paths-ignore: | ||
| - ".gitignore" | ||
| - "docs/**" | ||
| - "ChangeLog" | ||
| - "CREDITS.TXT" | ||
| - "COMPILE.TXT" | ||
| - "COMPILE_CMAKE.TXT" | ||
| - "COMPILE_MSVC.TXT" | ||
| - "HACK.TXT" | ||
| - "LICENSE.TXT" | ||
| - "LICENSE_LLVM.TXT" | ||
| - "README.md" | ||
| - "RELEASE_NOTES" | ||
| - "SPONSORS.TXT" | ||
| pull_request: | ||
|
|
||
| # Stop previous runs on the same branch on new push | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| CI: true | ||
|
|
||
| jobs: | ||
| Linux: | ||
| runs-on: ${{ matrix.config.os }} | ||
| name: ${{ matrix.config.name }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - { | ||
| name: 'QEMU Linux s390x', | ||
| os: ubuntu-24.04, | ||
| system: 'Linux', | ||
| processor: 's390x', | ||
| cc: 's390x-linux-gnu-gcc', | ||
| cxx: 's390x-linux-gnu-g++', | ||
| sysroot: '/usr/s390x-linux-gnu', | ||
| qemu: 'qemu-s390x-static', | ||
| build_type: 'Debug', | ||
| packages: 'gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-dev-s390x-cross qemu-user-static', | ||
| build_tests: 'ON', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: 'QEMU Linux MIPS 32 BE', | ||
| os: ubuntu-24.04, | ||
| system: 'Linux', | ||
| processor: 'mips', | ||
| cc: 'mips-linux-gnu-gcc', | ||
| cxx: 'mips-linux-gnu-g++', | ||
| sysroot: '/usr/mips-linux-gnu', | ||
| qemu: 'qemu-mips-static', | ||
| build_type: 'Debug', | ||
| packages: 'gcc-mips-linux-gnu g++-mips-linux-gnu binutils-mips-linux-gnu libc6-dev-mips-cross qemu-user-static', | ||
| build_tests: 'ON', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: 'QEMU Linux Mips64el', | ||
| os: ubuntu-24.04, | ||
| system: 'Linux', | ||
| processor: 'mips64el', | ||
| cc: 'mips64el-linux-gnuabi64-gcc', | ||
| cxx: 'mips64el-linux-gnuabi64-g++', | ||
| sysroot: '/usr/mips64el-linux-gnuabi64', | ||
| qemu: 'qemu-mips64el-static', | ||
| build_type: 'Debug', | ||
| packages: 'gcc-mips64el-linux-gnuabi64 g++-mips64el-linux-gnuabi64 binutils-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross qemu-user-static', | ||
| build_tests: 'ON', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: 'QEMU Linux PPC64', | ||
| os: ubuntu-24.04, | ||
| system: 'Linux', | ||
| processor: 'ppc64', | ||
| cc: 'powerpc64-linux-gnu-gcc', | ||
| cxx: 'powerpc64-linux-gnu-g++', | ||
| sysroot: '/usr/powerpc64-linux-gnu', | ||
| qemu: 'qemu-ppc64-static', | ||
| build_type: 'Debug', | ||
| packages: 'gcc-powerpc64-linux-gnu g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu libc6-dev-ppc64-cross qemu-user-static', | ||
| build_tests: 'ON', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: 'QEMU Linux ARM', | ||
| os: ubuntu-24.04, | ||
| system: 'Linux', | ||
| processor: 'arm', | ||
| cc: 'arm-linux-gnueabihf-gcc', | ||
| cxx: 'arm-linux-gnueabihf-g++', | ||
| sysroot: '/usr/arm-linux-gnueabihf', | ||
| qemu: 'qemu-arm-static', | ||
| build_type: 'Debug', | ||
| packages: 'gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross qemu-user-static', | ||
| build_tests: 'ON', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: '[BUILD ONLY] Windows i686 mingw', | ||
| os: ubuntu-24.04, | ||
| system: 'Windows', | ||
| processor: 'i686', | ||
| cc: 'i686-w64-mingw32-gcc', | ||
| cxx: 'i686-w64-mingw32-g++', | ||
| rc: 'i686-w64-mingw32-windres', | ||
| find_root: '/usr/i686-w64-mingw32', | ||
| build_type: 'Debug', | ||
| skip_tests: true, | ||
| packages: 'gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools', | ||
| build_tests: 'OFF', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'toolchain.cmake', | ||
| } | ||
| - { | ||
| name: '[BUILD ONLY] Android 35 (arm64_v8a) NDK 29', | ||
| os: ubuntu-24.04, | ||
| system: 'Android', | ||
| processor: 'aarch64', | ||
| build_option: '-DANDROID_PLATFORM=android-35 -DANDROID_ABI=arm64-v8a', | ||
| build_type: 'Debug', | ||
| # QEMU alone can't emulate the binaries, because the NDK doesn't | ||
| # provide dynamic linker. | ||
| skip_tests: true, | ||
| packages: 'qemu-user-static unzip wget', | ||
| ndk_version: 'r29', | ||
| build_tests: 'OFF', | ||
| diet_build: 'OFF', | ||
| toolchain_file: 'ndk/build/cmake/android.toolchain.cmake', | ||
| } | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install cross build dependencies | ||
| if: ${{ matrix.config.packages != '' }} | ||
| env: | ||
| packages: ${{ matrix.config.packages }} | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y ${packages} | ||
|
|
||
| - name: Setup Android NDK | ||
| if: contains(matrix.config.name, 'Android') | ||
| env: | ||
| ndk_version: ${{ matrix.config.ndk_version }} | ||
| run: | | ||
| wget -q https://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip | ||
| unzip -q android-ndk-${ndk_version}-linux.zip | ||
| mv android-ndk-${ndk_version} ndk | ||
| cat ndk/source.properties | ||
|
|
||
| - name: Build cmocka | ||
| if: ${{ matrix.config.skip_tests != true }} | ||
| env: | ||
| system: ${{ matrix.config.system }} | ||
| processor: ${{ matrix.config.processor }} | ||
| cc: ${{ matrix.config.cc }} | ||
| cxx: ${{ matrix.config.cxx }} | ||
| sysroot: ${{ matrix.config.sysroot }} | ||
| qemu: ${{ matrix.config.qemu }} | ||
| build_type: ${{ matrix.config.build_type }} | ||
| toolchain_file: ${{ matrix.config.toolchain_file }} | ||
| run: | | ||
| git clone --depth 1 https://git.cryptomilk.org/projects/cmocka.git suite/cstest/cmocka | ||
| cmake -S suite/cstest/cmocka \ | ||
| -B build/cmocka \ | ||
| -DCMAKE_BUILD_TYPE=${build_type} \ | ||
| -DCMAKE_TOOLCHAIN_FILE="${PWD}/${toolchain_file}" \ | ||
| -DCMAKE_INSTALL_PREFIX="${PWD}/build/cmocka-install" \ | ||
| -DCMAKE_INSTALL_LIBDIR=lib \ | ||
| -DBUILD_SHARED_LIBS=OFF \ | ||
| -DWITH_STATIC_LIB=ON \ | ||
| -DWITH_EXAMPLES=OFF \ | ||
| -DUNIT_TESTING=OFF | ||
| cmake --build build/cmocka --config ${build_type} --parallel | ||
| cmake --install build/cmocka --config ${build_type} | ||
|
|
||
| - name: cmake (cross build) | ||
| env: | ||
| system: ${{ matrix.config.system }} | ||
| processor: ${{ matrix.config.processor }} | ||
| cc: ${{ matrix.config.cc }} | ||
| cxx: ${{ matrix.config.cxx }} | ||
| rc: ${{ matrix.config.rc }} | ||
| find_root: ${{ matrix.config.find_root }} | ||
| sysroot: ${{ matrix.config.sysroot }} | ||
| qemu: ${{ matrix.config.qemu }} | ||
| build_option: ${{ matrix.config.build_option }} | ||
| build_type: ${{ matrix.config.build_type }} | ||
| build_tests: ${{ matrix.config.build_tests }} | ||
| diet_build: ${{ matrix.config.diet_build }} | ||
| toolchain_file: ${{ matrix.config.toolchain_file }} | ||
| run: | | ||
| cmake -DCMAKE_BUILD_TYPE=${build_type} \ | ||
| -DBUILD_STATIC_LIBS=ON \ | ||
| -DBUILD_SHARED_LIBS=OFF \ | ||
| -DCAPSTONE_BUILD_TESTS=${build_tests} \ | ||
| -DCAPSTONE_BUILD_CSTOOL=ON \ | ||
| -DCAPSTONE_BUILD_CSTEST=OFF \ | ||
| -S . \ | ||
| -DCAPSTONE_BUILD_DIET=${diet_build} \ | ||
| -DCMAKE_TOOLCHAIN_FILE=${toolchain_file} \ | ||
| ${build_option} \ | ||
| -B build | ||
| cmake --build build --config ${build_type} --parallel | ||
|
|
||
| - name: C tests | ||
| if: ${{ matrix.config.skip_tests != true }} | ||
| run: | | ||
| ctest --test-dir build --output-on-failure -R '^capstone_' | ||
|
|
||
| - name: cstest | ||
| if: ${{ matrix.config.skip_tests != true }} | ||
| shell: 'script -q -e -c "bash -e {0}"' | ||
| env: | ||
| cc: ${{ matrix.config.cc }} | ||
| qemu: ${{ matrix.config.qemu }} | ||
| sysroot: ${{ matrix.config.sysroot }} | ||
| run: | | ||
| cmocka_lib="$(find build/cmocka build/cmocka-install -type f \( -name 'libcmocka*.a' -o -name 'libcmocka*.so' \) | sort | head -n 1)" | ||
| test -n "${cmocka_lib}" | ||
| ${cc} suite/cstest/src/*.c \ | ||
| -Iinclude \ | ||
| -Isuite/cstest/include \ | ||
| -Ibuild/cmocka-install/include \ | ||
| -o build/cstest \ | ||
| build/libcapstone.a \ | ||
| "${cmocka_lib}" \ | ||
| -pthread | ||
| cat > build/run-cstest <<'EOF' | ||
| #!/bin/sh | ||
| export LD_LIBRARY_PATH="${CMOCKA_PREFIX}/lib:${CMOCKA_PREFIX}/lib64:${LD_LIBRARY_PATH}" | ||
| exec "${qemu}" -L "${sysroot}" "${cstest_bin}" "$@" | ||
| EOF | ||
| chmod +x build/run-cstest | ||
| export CMOCKA_PREFIX="${PWD}/build/cmocka-install" | ||
| export cstest_bin="${PWD}/build/cstest" | ||
| python suite/cstest/cstest_report.py -D -t build/run-cstest -d suite/MC | ||
| python suite/cstest/cstest_report.py -D -t build/run-cstest -f suite/cstest/issues.cs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.