Skip to content

Compiler/platform based optimisation flags#144

Open
sdassow wants to merge 10 commits into
fyne-io:mainfrom
sdassow:feature/compiler-based-optimizations
Open

Compiler/platform based optimisation flags#144
sdassow wants to merge 10 commits into
fyne-io:mainfrom
sdassow:feature/compiler-based-optimizations

Conversation

@sdassow

@sdassow sdassow commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Add function to detect compiler information and use it for a lookup table with platform specific optimisation flags. Should fix #137.

@andydotxyz andydotxyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks, just a few notes on naming

}

var hardeningFlagsTable = []hardeningFlags{
{"ubuntu", "amd64", "gcc", "*", "11.4.0", "-fcf-protection -fstack-protector-strong"}, // https://github.com/fyne-io/tools/issues/137

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably deserves at least a hint at the headline. I'd put a few words and then just "issue #137" instead of using space for the URL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully aggree, fixed.

return string(out)
}

func hardeningFlagsLookup(out, goos, arch string) string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it should be hardeningCFlagsLookup for avoidance of doubt?

os, arch, cc, minVer, maxVer, cflags string
}

var hardeningFlagsTable = []hardeningFlags{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardeningCFlagsTable I think - to avoid ldflags confusion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends I think. Would ldflags fit in there if needed or would they get a separate table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails with _FORTIFY_SOURCE redefined error on Ubuntu 22.04

2 participants