diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6404e1d..b1cbcf68 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,6 @@ on: env: BUILD_TYPE: Release - BUILD_STATIC: false jobs: build: @@ -15,9 +14,10 @@ jobs: strategy: matrix: sys: - - { os: windows-latest, shell: pwsh } - - { os: ubuntu-latest, shell: 'alpine.sh --root {0}' } - - { os: macos-latest, shell: bash } + - { name: linux-glibc, os: ubuntu-latest, shell: bash } + - { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' } + - { name: windows, os: windows-latest, shell: pwsh } + - { name: mac, os: macos-latest, shell: bash } defaults: run: shell: ${{ matrix.sys.shell }} @@ -29,7 +29,7 @@ jobs: - name: Setup latest Alpine Linux uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d - if: ${{ matrix.sys.os == 'ubuntu-latest' }} + if: ${{ matrix.sys.name == 'linux-musl' }} with: arch: x86_64 packages: > @@ -46,8 +46,8 @@ jobs: - name: Configure CMake env: - BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }} - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}} -DZIP_RELEASE=1 + USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}} -DZIP_RELEASE=1 - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80787153..f6072230 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,6 @@ on: env: BUILD_TYPE: Release - BUILD_STATIC: false jobs: build: @@ -16,9 +15,10 @@ jobs: strategy: matrix: sys: - - { os: windows-latest, shell: pwsh } - - { os: ubuntu-latest, shell: 'alpine.sh --root {0}' } - - { os: macos-latest, shell: bash } + - { name: linux-glibc, os: ubuntu-latest, shell: bash } + - { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' } + - { name: windows, os: windows-latest, shell: pwsh } + - { name: mac, os: macos-latest, shell: bash } defaults: run: shell: ${{ matrix.sys.shell }} @@ -30,7 +30,7 @@ jobs: - name: Setup latest Alpine Linux uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d - if: ${{ matrix.sys.os == 'ubuntu-latest' }} + if: ${{ matrix.sys.name == 'linux-musl' }} with: arch: x86_64 packages: > @@ -47,8 +47,8 @@ jobs: - name: Configure CMake env: - BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }} - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}} + USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/unstable.yml b/.github/workflows/unstable.yml index 30ec8ed6..38d00fd5 100644 --- a/.github/workflows/unstable.yml +++ b/.github/workflows/unstable.yml @@ -6,7 +6,6 @@ on: env: BUILD_TYPE: Release - BUILD_STATIC: false jobs: build: @@ -14,9 +13,10 @@ jobs: strategy: matrix: sys: - - { os: windows-latest, shell: pwsh } - - { os: ubuntu-latest, shell: 'alpine.sh --root {0}' } - - { os: macos-latest, shell: bash } + - { name: linux-glibc, os: ubuntu-latest, shell: bash } + - { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' } + - { name: windows, os: windows-latest, shell: pwsh } + - { name: mac, os: macos-latest, shell: bash } defaults: run: shell: ${{ matrix.sys.shell }} @@ -28,7 +28,7 @@ jobs: - name: Setup latest Alpine Linux uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d - if: ${{ matrix.sys.os == 'ubuntu-latest' }} + if: ${{ matrix.sys.name == 'linux-musl' }} with: arch: x86_64 packages: > @@ -45,8 +45,8 @@ jobs: - name: Configure CMake env: - BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }} - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}} -DZIP_RELEASE=1 + USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}} -DZIP_RELEASE=1 - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/CHANGELOG.md b/CHANGELOG.md index d243cb17..e553d2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ ## v2.1 -- The offsets of stack variables will now be relative to the value of the stack pointer register for the current function rather than the caller by default. +- Stack variable offsets will now be relative to the value of the stack pointer register for the current function. - Variable symbols are no longer incorrectly deduplicated as if they were types. - The static keyword is no longer missing from the output for static global variables. - Structs defined inside global variable definitions are now printed with the correct C++ syntax. - Fixed an issue where in some cases null addresses would be handled incorrectly. +- Glibc-based Linux builds are now provided in addition to musl-based builds. - stdump: Added `--procedures` option. - stdump: Added `--sort-by-address` option. - stdump: Added `--caller-stack-offsets` option. diff --git a/CMakeLists.txt b/CMakeLists.txt index 00fc317b..320662ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,15 +15,13 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -if(BUILD_STATIC) +if(USE_MUSL_LIBC) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static") endif() -if(MSVC) - # TODO -else() +if(NOT MSVC) set(CMAKE_CXX_FLAGS_DEBUG "-O3 -ggdb -Wall") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall") add_link_options($<$:-s>) diff --git a/cmake/release_crafter.cmake b/cmake/release_crafter.cmake index 85863385..d46beafa 100644 --- a/cmake/release_crafter.cmake +++ b/cmake/release_crafter.cmake @@ -8,7 +8,16 @@ if(ZIP_RELEASE) set(RELEASE_VERSION ${GIT_TAG}) endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(RELEASE_OS "linux") + if(USE_MUSL_LIBC) + set(RELEASE_OS "linux-musl") + else() + execute_process( + COMMAND bash -c "ldd --version | sed -n 's/ldd (Ubuntu GLIBC //p' | sed 's/).*//'" + OUTPUT_VARIABLE GLIBC_VERSION_STRING + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + set(RELEASE_OS "linux-glibc${GLIBC_VERSION_STRING}") + endif() elseif(APPLE) set(RELEASE_OS "mac") elseif(WIN32)