Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/fyne/internal/commands/hardening_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/fyne/internal/commands/hardening_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Loading