User:Aslantis/Lesser known optimization flags for make.conf

This is my list of certain optimization flags you can set in your. I decided to start this after learning about optimization flags that I didn't know you could set for rust, and got curious about other possibilities so decided to start a running list!!

If you know any other flags you can set for further optimizations, I'd appreciate if you added them to this page!! (or at least let me know about them in my talk page.)

I have specific info about each variable/language at the bottom. I have the sane optimization levels uncommented, and if applicable the most "aggressive" optimizations commented out directly below. Please read the warnings at the bottom about these "aggressive" optimizations, and please reproduce bugs without these flags before reporting.

For (Free) Pascal optimizations create/edit this file:

More info on flags
COMMON_FLAGS: * GCC_optimization <- Read this in its entirety, at least before setting any flags higher than. I'm not going to paraphrase, the devs have done a good job at explaining :) * Safe_CFLAGS has a list of -march and other flags for almost all consumer CPUs, if you still have it set to native look at this.

LDFLAGS: * It's never a good idea to override LDFLAGS. At the least include the variable in itself (as shown above) to not override your profile's default settings for this. * Portage by default strips binaries, so having --strip-all in LDFLAGS is redundant, using portage's FEATURES var would be a better way to manipulate this.

Rust: *  *   * https://users.rust-lang.org/t/error-lto-can-only-be-run-for-executables-cdylibs-and-static-library-outputs/73369 <- Forum about LTO

Go:

* https://go.dev/doc/install/source#environment <- This will explain what you need to set to optimize for your specific arch * https://forum.golangbridge.org/t/how-to-generate-code-for-a-particular-cpu/26852 <- Relevant forum thread * https://github.com/golang/go/wiki/MinimumRequirements#amd64 Want to know which value to set for amd64? Good luck, this is all I can find.

Free Pascal: * https://wiki.freepascal.org/Optimization

TODO
Ada: * Ada's `gprbuild` build system seems to not have any standardized way to handle (optimization) flags via environment variables. This implies that there are several different environment vars formatted different ways. In the future I'll find the most common and see if I can implement them.

Zig: * Zig also has (optimization) flags, but the way Zig programs are built (build.zig) doesn't seem to have a standard way to listen to environment vars for individual flags. I've done an unnecessary amount of thinking of how to accomplish this, perhaps an official zig eclass, maybe some kind of patch to build.zig that makes it listen to user-chosen flags?

Haskell: * shoot I forgot how haskell worked I'll be back