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 } diff --git a/cmd/fyne/internal/commands/hardening_flags_test.go b/cmd/fyne/internal/commands/hardening_flags_test.go index 45bc8812..eed5e7a8 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"))