From 3f5262f8d9b40e2daac81f99a0c75e0c23438a46 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Mar 2025 17:13:57 +0100 Subject: [PATCH 01/18] Refactor of CI and solved issues with osx implementation. --- .github/workflows/run-tests.yml | 139 ++++++++++++++++---------------- plthook_osx.c | 2 - test/.gitignore | 2 + test/run-test.bat | 4 +- 4 files changed, 72 insertions(+), 75 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 56d7a8e..916e2a4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,6 +26,11 @@ jobs: tests_on_ubuntu: name: Tests on Ubuntu (x86_64 and i686) if: github.event.inputs.tests_on_ubuntu == 'true' || github.event.inputs.tests_on_ubuntu == '' + strategy: + matrix: + fail-fast: false + optimization: ["", "-O3"] + sanitize: ["", "-fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest defaults: run: @@ -39,43 +44,34 @@ jobs: sudo dpkg --add-architecture i386 sudo apt update sudo apt install -y libc6-dbg:i386 libgcc-s1:i386 - - name: x86_64 without optimization - run: | - make relro_pie_tests - - name: i686 without optimization - run: | - make relro_pie_m32_tests - - name: x86_64 on valgrind without optimization - run: | - make relro_pie_tests_on_valgrind - - name: uclibc x86_64 without optimization - run: | - ./uclibc-test.sh x86_64 - - name: uclibc i686 without optimization - run: | - ./uclibc-test.sh i686 - name: set OPT_CLFAGS run: | - echo OPT_CFLAGS=-O3 >> $GITHUB_ENV - - name: x86_64 with optimization + echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV + - name: x86_64 run: | make relro_pie_tests - - name: i686 with optimization + - name: i686 run: | make relro_pie_m32_tests - - name: x86_64 on valgrind with optimization + - name: x86_64 on valgrind + if: ${{ matrix.sanitize == '' }} # Run without sanitizers only run: | make relro_pie_tests_on_valgrind - - name: uclib x86_64 with optimization + - name: uclibc x86_64 run: | ./uclibc-test.sh x86_64 - - name: uclibc i686 with optimization + - name: uclibc i686 run: | ./uclibc-test.sh i686 tests_on_qemu: name: Tests on Qemu (arm, armhf, arm64, ppc, ppc64le and riscv64) if: github.event.inputs.tests_on_qemu == 'true' || github.event.inputs.tests_on_qemu == '' + strategy: + matrix: + fail-fast: false + optimization: ["", "-O3"] + sanitize: ["", "-fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest defaults: run: @@ -86,53 +82,61 @@ jobs: run: | sudo apt update sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - - name: arm-linux-gnueabi without optimization + - name: set OPT_CLFAGS + run: | + echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV + - name: arm-linux-gnueabi run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - - name: arm-linux-gnueabihf without optimization + - name: arm-linux-gnueabihf run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - - name: aarch64-linux-gnu without optimization + - name: aarch64-linux-gnu run: | make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - - name: powerpc-linux-gnu without optimization + - name: powerpc-linux-gnu run: | make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc - - name: powerpc64le-linux-gnu without optimization + - name: powerpc64le-linux-gnu run: | make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le - - name: riscv64-linux-gnu without optimization + - name: riscv64-linux-gnu run: | make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 - - name: set OPT_CLFAGS - run: | - echo OPT_CFLAGS=-O3 >> $GITHUB_ENV - - name: arm-linux-gnueabi with optimization - run: | - make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - - name: arm-linux-gnueabihf with optimization - run: | - make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - # TODO: https://github.com/kubo/plthook/issues/51 - # - name: aarch64-linux-gnu with optimization + + + # - name: set OPT_CLFAGS # run: | - # make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - - name: powerpc-linux-gnu with optimization - run: | - make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc - - name: powerpc64le-linux-gnu with optimization - run: | - make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le - - name: riscv64-linux-gnu with optimization - run: | - make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 + # echo OPT_CFLAGS=-O3 >> $GITHUB_ENV + # - name: arm-linux-gnueabi with optimization + # run: | + # make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi + # - name: arm-linux-gnueabihf with optimization + # run: | + # make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf + # # TODO: https://github.com/kubo/plthook/issues/51 + # # - name: aarch64-linux-gnu with optimization + # # run: | + # # make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu + # - name: powerpc-linux-gnu with optimization + # run: | + # make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc + # - name: powerpc64le-linux-gnu with optimization + # run: | + # make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le + # - name: riscv64-linux-gnu with optimization + # run: | + # make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 tests_on_macos: name: Tests on macOS if: github.event.inputs.tests_on_macos == 'true' || github.event.inputs.tests_on_macos == '' strategy: matrix: + fail-fast: false os: [macos-13, macos-14, macos-15] + optimization: ["", "-O3"] + sanitize: ["", "-fsanitize=address -fsanitize=undefined"] runs-on: ${{ matrix.os }} defaults: run: @@ -155,20 +159,28 @@ jobs: - name: dyld_info run: | for arg in -segments -dependents -inits -exports -imports -objc -fixups -fixup_chains -fixup_chain_details -symbolic_fixups; do echo "======== $arg ========"; xcrun dyld_info $arg libtest.so; done; true - - name: tests without optimization - run: | - make run_tests - name: set OPT_CLFAGS run: | - echo OPT_CFLAGS=-O3 >> $GITHUB_ENV - - name: tests with optimization + echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV + - name: tests run: | make run_tests tests_on_windows: name: Tests on Windows (x64 and x86) if: github.event.inputs.tests_on_windows == 'true' || github.event.inputs.tests_on_windows == '' - runs-on: windows-latest + strategy: + matrix: + fail-fast: false + os: [2019, 2022, 2025] + architecture: [x86, amd64] + options: [ + { dll: "/LD /MD", exe: "/MD" }, + { dll: "/LD /MD /O2", exe: "/MD /O2" }, + { dll: "/LDd /MDd", exe: "/MDd" } + ] + sanitize: ["", "/fsanitize=address"] + runs-on: windows-${{ matrix.os }} defaults: run: shell: cmd @@ -176,21 +188,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - - name: x64 without optimization - run: | - run-test.bat amd64 "-LD -MD" "-MD" - - name: x86 without optimization - run: | - run-test.bat x86 "-LD -MD" "-MD" - - name: x64 with optimization - run: | - run-test.bat amd64 "-LD -MD -O2" "-MD -O2" - - name: x86 with optimization - run: | - run-test.bat x86 "-LD -MD -O2" "-MD -O2" - - name: x64 with debug - run: | - run-test.bat amd64 "-LDd -MDd" "-MDd" - - name: x86 with debug + - name: test run: | - run-test.bat x86 "-LDd -MDd" "-MDd" + run-test.bat ${{ matrix.os }} ${{ matrix.architecture }} "${{ matrix.options.dll }} ${{ matrix.sanitize }}" "${{ matrix.options.exe }} ${{ matrix.sanitize }}" diff --git a/plthook_osx.c b/plthook_osx.c index 35c38a9..ba6f757 100644 --- a/plthook_osx.c +++ b/plthook_osx.c @@ -248,8 +248,6 @@ int plthook_open(plthook_t **plthook_out, const char *filename) } cnt = _dyld_image_count(); namelen = strlen(filename); - namelen = strlen(filename); - cnt = _dyld_image_count(); for (idx = 0; idx < cnt; idx++) { const char *image_name = _dyld_get_image_name(idx); diff --git a/test/.gitignore b/test/.gitignore index 717715c..c316569 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -5,3 +5,5 @@ libtest.lib libtest.so testprog testprog.exe +dummy.c +dummy.o diff --git a/test/run-test.bat b/test/run-test.bat index edf5983..0c4e73c 100644 --- a/test/run-test.bat +++ b/test/run-test.bat @@ -1,2 +1,2 @@ -call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %1 -nmake /f Makefile.win32 check clean DLL_CFLAGS=%2 EXE_CFLAGS=%3 +call "c:\Program Files (x86)\Microsoft Visual Studio\%1\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 +nmake /f Makefile.win32 check clean DLL_CFLAGS=%3 EXE_CFLAGS=%4 From 20759ea7767cd89f9c7d38878e7a8a9da5fed94d Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Mar 2025 17:17:52 +0100 Subject: [PATCH 02/18] Minor issue fail-fast. --- .github/workflows/run-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 916e2a4..4889ad8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,8 +27,8 @@ jobs: name: Tests on Ubuntu (x86_64 and i686) if: github.event.inputs.tests_on_ubuntu == 'true' || github.event.inputs.tests_on_ubuntu == '' strategy: + fail-fast: false matrix: - fail-fast: false optimization: ["", "-O3"] sanitize: ["", "-fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest @@ -68,8 +68,8 @@ jobs: name: Tests on Qemu (arm, armhf, arm64, ppc, ppc64le and riscv64) if: github.event.inputs.tests_on_qemu == 'true' || github.event.inputs.tests_on_qemu == '' strategy: + fail-fast: false matrix: - fail-fast: false optimization: ["", "-O3"] sanitize: ["", "-fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest @@ -132,8 +132,8 @@ jobs: name: Tests on macOS if: github.event.inputs.tests_on_macos == 'true' || github.event.inputs.tests_on_macos == '' strategy: + fail-fast: false matrix: - fail-fast: false os: [macos-13, macos-14, macos-15] optimization: ["", "-O3"] sanitize: ["", "-fsanitize=address -fsanitize=undefined"] @@ -170,8 +170,8 @@ jobs: name: Tests on Windows (x64 and x86) if: github.event.inputs.tests_on_windows == 'true' || github.event.inputs.tests_on_windows == '' strategy: + fail-fast: false matrix: - fail-fast: false os: [2019, 2022, 2025] architecture: [x86, amd64] options: [ From 6282301a7498f1f143a5079ed4d0c77b49aa82c3 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Mar 2025 17:45:33 +0100 Subject: [PATCH 03/18] Solve more issues. --- .github/workflows/oracle-client.yml | 2 +- .github/workflows/run-tests.yml | 15 ++++++++------- test/Makefile | 7 ++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/oracle-client.yml b/.github/workflows/oracle-client.yml index 83d6ade..d737b01 100644 --- a/.github/workflows/oracle-client.yml +++ b/.github/workflows/oracle-client.yml @@ -1,4 +1,4 @@ -name: oracle_client +name: Oracle Client Test on: push: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4889ad8..b71c446 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -82,10 +82,12 @@ jobs: run: | sudo apt update sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - - name: set OPT_CLFAGS + - name: Set OPT_CLFAGS run: | echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV - name: arm-linux-gnueabi + env: + OPT_CFLAGS: "-latomic" run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - name: arm-linux-gnueabihf @@ -104,7 +106,6 @@ jobs: run: | make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 - # - name: set OPT_CLFAGS # run: | # echo OPT_CFLAGS=-O3 >> $GITHUB_ENV @@ -162,7 +163,7 @@ jobs: - name: set OPT_CLFAGS run: | echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV - - name: tests + - name: Tests run: | make run_tests @@ -177,9 +178,9 @@ jobs: options: [ { dll: "/LD /MD", exe: "/MD" }, { dll: "/LD /MD /O2", exe: "/MD /O2" }, - { dll: "/LDd /MDd", exe: "/MDd" } + { dll: "/LDd /MDd", exe: "/MDd" }, + { dll: "/LDd /MDd /fsanitize=address", exe: "/MDd /fsanitize=address" } ] - sanitize: ["", "/fsanitize=address"] runs-on: windows-${{ matrix.os }} defaults: run: @@ -188,6 +189,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - - name: test + - name: Test run: | - run-test.bat ${{ matrix.os }} ${{ matrix.architecture }} "${{ matrix.options.dll }} ${{ matrix.sanitize }}" "${{ matrix.options.exe }} ${{ matrix.sanitize }}" + run-test.bat ${{ matrix.os }} ${{ matrix.architecture }} "${{ matrix.options.dll }}" "${{ matrix.options.exe }}" diff --git a/test/Makefile b/test/Makefile index 98c0f6a..bc90ed4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,8 +5,9 @@ UNAME_S := $(shell uname -s) CFLAGS_SHARED = -shared -fPIC -CFLAGS = $(CFLAGS_WARNING) $(EXTRA_CFLAGS) $(OPT_CFLAGS) CFLAGS_WARNING = -Wall +CFLAGS = $(CFLAGS_WARNING) $(EXTRA_CFLAGS) $(OPT_CFLAGS) +LDFLAGS = $(EXTRA_LDFLAGS) $(OPT_LDFLAGS) EXEEXT = SOEXT = so LIBS = -ldl -lm @@ -58,10 +59,10 @@ endif all: libtest.$(SOEXT) testprog$(EXEEXT) libtest.$(SOEXT): libtest.c libtest.h - $(CC) $(CFLAGS_SHARED) $(CFLAGS) -DLIBTEST_DLL -o libtest.$(SOEXT) libtest.c -lm + $(CC) $(CFLAGS_SHARED) $(CFLAGS) -DLIBTEST_DLL -o libtest.$(SOEXT) libtest.c -lm $(LDFLAGS) testprog$(EXEEXT): testprog.c ../$(PLTHOOK_C) libtest.h - $(CC) $(CFLAGS_EXE) $(CFLAGS) -o testprog$(EXEEXT) -I.. testprog.c ../$(PLTHOOK_C) -L. -ltest $(LIBS) + $(CC) $(CFLAGS_EXE) $(CFLAGS) -o testprog$(EXEEXT) -I.. testprog.c ../$(PLTHOOK_C) -L. -ltest $(LIBS) $(LDFLAGS) run_tests: clean libtest.$(SOEXT) testprog$(EXEEXT) LD_LIBRARY_PATH=. $(KICK_CMD) ./testprog$(EXEEXT) open From 15aee47c35f81b9c930b6a45b785fb4e2d9944c9 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Mar 2025 20:44:47 +0100 Subject: [PATCH 04/18] Remove sanitizers for uclibc. --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b71c446..865b332 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -58,9 +58,11 @@ jobs: run: | make relro_pie_tests_on_valgrind - name: uclibc x86_64 + if: ${{ matrix.sanitize == '' }} # Run without sanitizers only run: | ./uclibc-test.sh x86_64 - name: uclibc i686 + if: ${{ matrix.sanitize == '' }} # Run without sanitizers only run: | ./uclibc-test.sh i686 From 4532e8da8f5642579e23df1629e227032d1af6a8 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Mar 2025 20:48:02 +0100 Subject: [PATCH 05/18] Add debug info. --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 865b332..2cc6791 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -93,6 +93,8 @@ jobs: run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - name: arm-linux-gnueabihf + env: + LSAN_OPTIONS: "verbosity=1:log_threads=1" run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu From 9a1e45864b10933d29d90266dffe8f9eeed80af5 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 04:29:05 +0100 Subject: [PATCH 06/18] Add debug symbols to sanitizers. --- .github/workflows/run-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2cc6791..132998e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -30,7 +30,7 @@ jobs: fail-fast: false matrix: optimization: ["", "-O3"] - sanitize: ["", "-fsanitize=address -fsanitize=undefined"] + sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest defaults: run: @@ -73,7 +73,7 @@ jobs: fail-fast: false matrix: optimization: ["", "-O3"] - sanitize: ["", "-fsanitize=address -fsanitize=undefined"] + sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest defaults: run: @@ -141,7 +141,7 @@ jobs: matrix: os: [macos-13, macos-14, macos-15] optimization: ["", "-O3"] - sanitize: ["", "-fsanitize=address -fsanitize=undefined"] + sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] runs-on: ${{ matrix.os }} defaults: run: From 1dea993848172dd511605a4390411de2cc7bbf63 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 04:46:48 +0100 Subject: [PATCH 07/18] Trying valgrind on arm. --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 132998e..ab512a2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -84,6 +84,7 @@ jobs: run: | sudo apt update sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross + sudo apt install -y valgrind:armhf - name: Set OPT_CLFAGS run: | echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV @@ -96,6 +97,7 @@ jobs: env: LSAN_OPTIONS: "verbosity=1:log_threads=1" run: | + make relro_pie_tests_on_valgrind TARGET_PLATFORM=arm-linux-gnueabihf make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu run: | From 872319712fd9e8696a4479c795845f15eb7b4566 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 04:52:02 +0100 Subject: [PATCH 08/18] Try again. --- .github/workflows/run-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ab512a2..75779da 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -82,9 +82,10 @@ jobs: - uses: actions/checkout@v4 - name: Install packages run: | + sudo dpkg --add-architecture armhf sudo apt update - sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross sudo apt install -y valgrind:armhf + sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - name: Set OPT_CLFAGS run: | echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV From 86efbc92052e6c64eab7e0b13e9dc0ed2e86dcca Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 04:55:39 +0100 Subject: [PATCH 09/18] Try again. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 75779da..d4239df 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -83,7 +83,7 @@ jobs: - name: Install packages run: | sudo dpkg --add-architecture armhf - sudo apt update + sudo apt update || true sudo apt install -y valgrind:armhf sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - name: Set OPT_CLFAGS From 8da946118529c802cc1f962e383b051b8ab10177 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:28:30 +0100 Subject: [PATCH 10/18] Reset. --- .github/workflows/run-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d4239df..132998e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -82,9 +82,7 @@ jobs: - uses: actions/checkout@v4 - name: Install packages run: | - sudo dpkg --add-architecture armhf - sudo apt update || true - sudo apt install -y valgrind:armhf + sudo apt update sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - name: Set OPT_CLFAGS run: | @@ -98,7 +96,6 @@ jobs: env: LSAN_OPTIONS: "verbosity=1:log_threads=1" run: | - make relro_pie_tests_on_valgrind TARGET_PLATFORM=arm-linux-gnueabihf make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu run: | From f8d504f392bfc0e70f2488dc6fca0ca4f96c293c Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:31:31 +0100 Subject: [PATCH 11/18] Test. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 132998e..4ac2a98 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -94,7 +94,7 @@ jobs: make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - name: arm-linux-gnueabihf env: - LSAN_OPTIONS: "verbosity=1:log_threads=1" + LSAN_OPTIONS: "verbosity=1:log_threads=1:detect_leaks=0" run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu From 76b76fb3e24b963443dd2c683b87d84fc56f1623 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:41:41 +0100 Subject: [PATCH 12/18] Workaround for issues. --- .github/workflows/run-tests.yml | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4ac2a98..872d323 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -73,7 +73,8 @@ jobs: fail-fast: false matrix: optimization: ["", "-O3"] - sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] + # TODO: Sanitizer fails in armhf and aarch64 + # sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest defaults: run: @@ -86,7 +87,9 @@ jobs: sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross - name: Set OPT_CLFAGS run: | - echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV + echo OPT_CFLAGS="${{ matrix.optimization }}" >> $GITHUB_ENV + # TODO: Sanitizer fails in armhf and aarch64 + # echo OPT_CFLAGS="${{ matrix.optimization }} ${{ matrix.sanitize }}" >> $GITHUB_ENV - name: arm-linux-gnueabi env: OPT_CFLAGS: "-latomic" @@ -94,10 +97,13 @@ jobs: make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - name: arm-linux-gnueabihf env: + # TODO: detect_leaks=0 because it fails to create the ptrace thread LSAN_OPTIONS: "verbosity=1:log_threads=1:detect_leaks=0" run: | make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu + # TODO: aarch64 fails with optimizations https://github.com/kubo/plthook/issues/51 + if: ${{ matrix.optimization == '' }} run: | make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - name: powerpc-linux-gnu @@ -110,29 +116,6 @@ jobs: run: | make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 - # - name: set OPT_CLFAGS - # run: | - # echo OPT_CFLAGS=-O3 >> $GITHUB_ENV - # - name: arm-linux-gnueabi with optimization - # run: | - # make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi - # - name: arm-linux-gnueabihf with optimization - # run: | - # make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - # # TODO: https://github.com/kubo/plthook/issues/51 - # # - name: aarch64-linux-gnu with optimization - # # run: | - # # make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - # - name: powerpc-linux-gnu with optimization - # run: | - # make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc - # - name: powerpc64le-linux-gnu with optimization - # run: | - # make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le - # - name: riscv64-linux-gnu with optimization - # run: | - # make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 - tests_on_macos: name: Tests on macOS if: github.event.inputs.tests_on_macos == 'true' || github.event.inputs.tests_on_macos == '' From 1cb26931460a180ebfe0fcc8b79ec2cdb631a713 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:43:45 +0100 Subject: [PATCH 13/18] Testing optimization level. --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 872d323..be4588b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -72,7 +72,7 @@ jobs: strategy: fail-fast: false matrix: - optimization: ["", "-O3"] + optimization: ["", "-O2", "-O3"] # TODO: Sanitizer fails in armhf and aarch64 # sanitize: ["", "-g -fsanitize=address -fsanitize=undefined"] runs-on: ubuntu-latest @@ -103,7 +103,7 @@ jobs: make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu # TODO: aarch64 fails with optimizations https://github.com/kubo/plthook/issues/51 - if: ${{ matrix.optimization == '' }} + if: ${{ matrix.optimization != '-O3' }} run: | make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - name: powerpc-linux-gnu From 2354cc70acc3aa242febe060d9cb1f731164d3e2 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:45:23 +0100 Subject: [PATCH 14/18] Restore optimization. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index be4588b..faffea2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -103,7 +103,7 @@ jobs: make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf - name: aarch64-linux-gnu # TODO: aarch64 fails with optimizations https://github.com/kubo/plthook/issues/51 - if: ${{ matrix.optimization != '-O3' }} + if: ${{ matrix.optimization == '' }} run: | make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu - name: powerpc-linux-gnu From 1d691713dcf85715b050c5f1b4afe8fea8ca11d6 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:55:23 +0100 Subject: [PATCH 15/18] Solve windows issues. --- .github/workflows/run-tests.yml | 6 +++--- test/run-test.bat | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index faffea2..a82208a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -163,10 +163,10 @@ jobs: os: [2019, 2022, 2025] architecture: [x86, amd64] options: [ - { dll: "/LD /MD", exe: "/MD" }, + { dll: "/LD /MD", exe: "/MD" }, { dll: "/LD /MD /O2", exe: "/MD /O2" }, - { dll: "/LDd /MDd", exe: "/MDd" }, - { dll: "/LDd /MDd /fsanitize=address", exe: "/MDd /fsanitize=address" } + { dll: "/LDd /MDd", exe: "/MDd" }, + { dll: "/LDd /MDd /Z7 /fsanitize=address", exe: "/MDd /Z7 /fsanitize=address" } ] runs-on: windows-${{ matrix.os }} defaults: diff --git a/test/run-test.bat b/test/run-test.bat index 0c4e73c..6f55903 100644 --- a/test/run-test.bat +++ b/test/run-test.bat @@ -1,2 +1,6 @@ -call "c:\Program Files (x86)\Microsoft Visual Studio\%1\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 +if "%1" == "2019" ( + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 +) else ( + call "C:\Program Files\Microsoft Visual Studio\%1\Community\VC\Auxiliary\Build\vcvarsall.bat" %2 +) nmake /f Makefile.win32 check clean DLL_CFLAGS=%3 EXE_CFLAGS=%4 From 16765e69812a3594200669ea610febb9bcfda6fe Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 05:58:27 +0100 Subject: [PATCH 16/18] Remove newer versions of msvc. --- .github/workflows/run-tests.yml | 2 +- test/run-test.bat | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a82208a..660e33e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -160,7 +160,7 @@ jobs: strategy: fail-fast: false matrix: - os: [2019, 2022, 2025] + os: [2019] # TODO: vcvarsall.bat not working on ", 2022, 2025]" architecture: [x86, amd64] options: [ { dll: "/LD /MD", exe: "/MD" }, diff --git a/test/run-test.bat b/test/run-test.bat index 6f55903..c25916f 100644 --- a/test/run-test.bat +++ b/test/run-test.bat @@ -1,6 +1,7 @@ if "%1" == "2019" ( call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 ) else ( + @rem "TODO: This seems not to work, it cannot find the vcvarsall.bat" call "C:\Program Files\Microsoft Visual Studio\%1\Community\VC\Auxiliary\Build\vcvarsall.bat" %2 ) nmake /f Makefile.win32 check clean DLL_CFLAGS=%3 EXE_CFLAGS=%4 From 29ce6e598bb64ff188238c9eaccd35b24877f061 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 06:00:54 +0100 Subject: [PATCH 17/18] Add versions again. --- .github/workflows/run-tests.yml | 2 +- test/run-test.bat | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 660e33e..a82208a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -160,7 +160,7 @@ jobs: strategy: fail-fast: false matrix: - os: [2019] # TODO: vcvarsall.bat not working on ", 2022, 2025]" + os: [2019, 2022, 2025] architecture: [x86, amd64] options: [ { dll: "/LD /MD", exe: "/MD" }, diff --git a/test/run-test.bat b/test/run-test.bat index c25916f..8cc7193 100644 --- a/test/run-test.bat +++ b/test/run-test.bat @@ -1,7 +1,6 @@ if "%1" == "2019" ( call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 ) else ( - @rem "TODO: This seems not to work, it cannot find the vcvarsall.bat" - call "C:\Program Files\Microsoft Visual Studio\%1\Community\VC\Auxiliary\Build\vcvarsall.bat" %2 + call "C:\Program Files\Microsoft Visual Studio\%1\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 ) nmake /f Makefile.win32 check clean DLL_CFLAGS=%3 EXE_CFLAGS=%4 From 9171b2886ca16c76ed10d635b63647b7b0b50ed5 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 14 Mar 2025 06:02:28 +0100 Subject: [PATCH 18/18] Solve other issues. --- test/run-test.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/run-test.bat b/test/run-test.bat index 8cc7193..b22f014 100644 --- a/test/run-test.bat +++ b/test/run-test.bat @@ -1,6 +1,7 @@ if "%1" == "2019" ( call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 ) else ( - call "C:\Program Files\Microsoft Visual Studio\%1\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 + @rem "TODO: Implement 2025 support in the future" + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %2 ) nmake /f Makefile.win32 check clean DLL_CFLAGS=%3 EXE_CFLAGS=%4