From c962a10580c682b9ebf49dc5015156a0332f3ced Mon Sep 17 00:00:00 2001 From: Simon Dassow Date: Mon, 5 Oct 2026 19:02:30 +0200 Subject: [PATCH 1/3] Drop _FORTIFY_SOURCE on Ubuntu/gcc completely since higher versions still have the same issue --- cmd/fyne/internal/commands/hardening_flags.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/fyne/internal/commands/hardening_flags.go b/cmd/fyne/internal/commands/hardening_flags.go index 9ae015b7..1ba1119e 100644 --- a/cmd/fyne/internal/commands/hardening_flags.go +++ b/cmd/fyne/internal/commands/hardening_flags.go @@ -22,9 +22,9 @@ type hardeningFlags struct { // specific flags go first, generic flags last var hardeningFlagsTable = []hardeningFlags{ //revive:disable:add-constant - {"ubuntu", "amd64", "gcc", "*", "11.4.0", "-fcf-protection -fstack-protector-strong"}, // Ubuntu 22.04/gcc 11.4.0 fails with _FORTIFY_SOURCE redefined error - {"windows", "*", "gcc", "*", "*", "-D_FORTIFY_SOURCE=3 -fstack-protector-strong"}, // mingw doesn't support -fcf-protection -- XXX: double check for better conditions - {"*", "arm64", "*", "*", "*", "-D_FORTIFY_SOURCE=3 -fstack-protector-strong"}, // -fcf-protection unsupported on arm64 + {"ubuntu", "amd64", "gcc", "*", "*", "-fcf-protection -fstack-protector-strong"}, // Ubuntu/gcc fails with _FORTIFY_SOURCE redefined error + {"windows", "*", "gcc", "*", "*", "-D_FORTIFY_SOURCE=3 -fstack-protector-strong"}, // mingw doesn't support -fcf-protection -- XXX: double check for better conditions + {"*", "arm64", "*", "*", "*", "-D_FORTIFY_SOURCE=3 -fstack-protector-strong"}, // -fcf-protection unsupported on arm64 //revive:enable:add-constant } From 820b216e0aec0089a70d4d3c92f07305874192e8 Mon Sep 17 00:00:00 2001 From: Simon Dassow Date: Mon, 5 Oct 2026 19:07:09 +0200 Subject: [PATCH 2/3] Adjust tests as well --- cmd/fyne/internal/commands/hardening_flags_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/fyne/internal/commands/hardening_flags_test.go b/cmd/fyne/internal/commands/hardening_flags_test.go index 45bc8812..df69e25b 100644 --- a/cmd/fyne/internal/commands/hardening_flags_test.go +++ b/cmd/fyne/internal/commands/hardening_flags_test.go @@ -11,11 +11,12 @@ func Test_hardeningCFlagsLookup(t *testing.T) { assert.Equal(t, "", hardeningCFlagsLookup("", "ubuntu", "amd64")) // compiler version lower or equal - assert.Equal(t, "-fcf-protection -fstack-protector-strong", hardeningCFlagsLookup("cc (Ubuntu) 11.3.0", "ubuntu", "amd64")) - assert.Equal(t, "-fcf-protection -fstack-protector-strong", hardeningCFlagsLookup("cc (Ubuntu) 11.4.0", "ubuntu", "amd64")) + ubuntuGccHardeningCFLAGS :="-fcf-protection -fstack-protector-strong" + assert.Equal(t, ubuntuGccHardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.3.0", "ubuntu", "amd64")) + assert.Equal(t, ubuntuGccHardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.4.0", "ubuntu", "amd64")) // compiler version higher - assert.Equal(t, hardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.4.1", "ubuntu", "amd64")) + assert.Equal(t, ubuntuGccHardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.4.1", "ubuntu", "amd64")) // different compiler assert.Equal(t, hardeningCFLAGS, hardeningCFlagsLookup("clang version 11.3.0", "ubuntu", "amd64")) From ee85cad37f8f7e3addc8c7ab68170b4b7e444753 Mon Sep 17 00:00:00 2001 From: Simon Dassow Date: Fri, 16 Oct 2026 19:03:41 +0200 Subject: [PATCH 3/3] Format --- cmd/fyne/internal/commands/hardening_flags_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/fyne/internal/commands/hardening_flags_test.go b/cmd/fyne/internal/commands/hardening_flags_test.go index df69e25b..eed5e7a8 100644 --- a/cmd/fyne/internal/commands/hardening_flags_test.go +++ b/cmd/fyne/internal/commands/hardening_flags_test.go @@ -11,7 +11,7 @@ func Test_hardeningCFlagsLookup(t *testing.T) { assert.Equal(t, "", hardeningCFlagsLookup("", "ubuntu", "amd64")) // compiler version lower or equal - ubuntuGccHardeningCFLAGS :="-fcf-protection -fstack-protector-strong" + ubuntuGccHardeningCFLAGS := "-fcf-protection -fstack-protector-strong" assert.Equal(t, ubuntuGccHardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.3.0", "ubuntu", "amd64")) assert.Equal(t, ubuntuGccHardeningCFLAGS, hardeningCFlagsLookup("cc (Ubuntu) 11.4.0", "ubuntu", "amd64"))