Skip to content

Commit 9b8188c

Browse files
committed
build: use distro CFLAGS
Instead of using the default settings, use the ones used to build the distros. This should also catch more bugs due to FORTIFY and friends being enabled. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 5ab3524 commit 9b8188c

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,35 @@ jobs:
2525
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
2626
- name: build
2727
run: |
28+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
29+
if [ "${{ matrix.buildtype }}" = "release" ]; then
30+
if [ "${{ matrix.distro }}" = "tumbleweed" ]; then
31+
export CFLAGS="-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \
32+
-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables \
33+
-fstack-clash-protection -Werror=return-type -flto=auto -g"
34+
export CXXFLAGS="$CFLAGS"
35+
export LDFLAGS="-flto=auto"
36+
# TODO: The RH build depends on environment varibles/settings which prevent
37+
# the compiler from working.
38+
#
39+
# elif [ "${{ matrix.distro }}" = "fedora" ]; then
40+
# export CFLAGS="-O2 -flto=auto -ffat-lto-objects -fexceptions -g \
41+
# -grecord-gcc-switches -pipe -Wall -Werror=format-security \
42+
# -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS \
43+
# -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong \
44+
# -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic \
45+
# -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables \
46+
# -fstack-clash-protection"
47+
# export CXXFLAGS="$CFLAGS"
48+
# export LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs \
49+
# -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
50+
# -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors \
51+
# -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
52+
# -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes'
53+
fi
54+
fi
55+
fi
56+
2857
scripts/build.sh -b ${{ matrix.buildtype }} -c ${{ matrix.compiler }} -x
2958
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
3059
name: upload logs

0 commit comments

Comments
 (0)