summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2026-03-13 01:07:17 +0100
committerjvoisin2026-03-13 01:11:26 +0100
commitc1642e5a43de3affa75d52c3577ee1be4c874a5d (patch)
tree2684196a7af91ff9b6c97a91e94fb92eb6ef9f24
parent9db427391bb5dc5b2722345cb91edbba65c10623 (diff)
Fixes compilation with clang and -D_FORTIFY_SOURCE=2
This commit fixes the typo pass_object_size__ for pass_object_size. It also adds tests in the CI to prevent this from happening again. Ref https://clang.llvm.org/docs/AttributeReference.html#pass-object-size-pass-dynamic-object-size Co-Authored-By: Sertonix
Diffstat (limited to '')
-rw-r--r--.github/workflows/testsuite.yaml27
-rw-r--r--include/fortify-headers.h2
-rw-r--r--tests/Makefile4
3 files changed, 31 insertions, 2 deletions
diff --git a/.github/workflows/testsuite.yaml b/.github/workflows/testsuite.yaml
index 8de273c..3185f0c 100644
--- a/.github/workflows/testsuite.yaml
+++ b/.github/workflows/testsuite.yaml
@@ -104,3 +104,30 @@ jobs:
104 - name: Building with gcc 104 - name: Building with gcc
105 shell: bash 105 shell: bash
106 run: CFLAGS=-std=${{ matrix.version }} make -C tests clean gcc run 106 run: CFLAGS=-std=${{ matrix.version }} make -C tests clean gcc run
107
108 fortify_level:
109 runs-on: ubuntu-latest
110 strategy:
111 matrix:
112 level: [2, 3]
113 steps:
114 - name: Checking out the code
115 uses: actions/checkout@v3
116 - name: Cache musl toolchain
117 uses: actions/cache@v3
118 id: cache-musl
119 with:
120 path: x86_64-linux-musl-native
121 key: musl
122 - name: Downloading musl-based toolchain
123 if: steps.cache-musl.outputs.cache-hit != 'true'
124 run: wget --quiet https://dustri.org/x86_64-linux-musl-native.tgz
125 - name: Extracting musl-based toolchain
126 if: steps.cache-musl.outputs.cache-hit != 'true'
127 run: tar xzf ./x86_64-linux-musl-native.tgz
128 - name: Building with clang
129 shell: bash
130 run: _FORTIFY_SOURCE=${{ matrix.level }} make -C tests clean clang
131 - name: Building with gcc
132 shell: bash
133 run: _FORTIFY_SOURCE=${{ matrix.level }} make -C tests clean gcc
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
index c32d5fb..3dc33b7 100644
--- a/include/fortify-headers.h
+++ b/include/fortify-headers.h
@@ -23,7 +23,7 @@
23#define _FORTIFY_POSN(n) const __attribute__((pass_dynamic_object_size(n))) 23#define _FORTIFY_POSN(n) const __attribute__((pass_dynamic_object_size(n)))
24#else 24#else
25/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */ 25/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */
26#define _FORTIFY_POSN(n) const __attribute__((pass_object_size__(n))) 26#define _FORTIFY_POSN(n) const __attribute__((pass_object_size(n)))
27#endif 27#endif
28 28
29/* we can't use extern inline with overloads without making them external */ 29/* we can't use extern inline with overloads without making them external */
diff --git a/tests/Makefile b/tests/Makefile
index b71c004..f2428f8 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,7 +1,9 @@
1MACHINE := $(shell uname -m) 1MACHINE := $(shell uname -m)
2_FORTIFY_SOURCE ?= 3
2CFLAGS ?= -std=gnu99 3CFLAGS ?= -std=gnu99
3CFLAGS += -I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -Wall -Wextra -Werror -Werror=pointer-arith 4CFLAGS += -I../include/ -D_FORTIFY_SOURCE=$(_FORTIFY_SOURCE) -static -O2 -Wall -Wextra -Werror -Werror=pointer-arith
4CFLAGS += -Wno-format -Wno-array-bounds -Wno-shift-count-negative -Wno-unused-variable -Wno-unused-parameter 5CFLAGS += -Wno-format -Wno-array-bounds -Wno-shift-count-negative -Wno-unused-variable -Wno-unused-parameter
6CXXFLAGS += -D_FORTIFY_SOURCE=$(_FORTIFY_SOURCE)
5 7
6RUNTIME_TARGETS= \ 8RUNTIME_TARGETS= \
7 test_FD_CLR_SETSIZE \ 9 test_FD_CLR_SETSIZE \