51 Commits

Author SHA1 Message Date
Matthias Reichl
4436ef2626 config/optimize: add -gdwarf-4 for split debug info builds
Since gcc 11 -gsplit-dwarf no longer implicitly enables -g and needs
a separate -g option. For some yet unknown reasons the default DWARF 5
format doesn't work, gdb doesn't show debug info, but DWARF 4 works fine
so use that.

Signed-off-by: Matthias Reichl <hias@horus.com>
2023-02-23 21:13:03 +01:00
SupervisedThinking
e485a16a8d build system: add support for mold & linker PKG_BUILD_FLAGS 2022-10-06 19:39:45 +02:00
Matthias Reichl
4bcc171bd2 buildsystem: support choosing default linker
Default linker can be set with DEFAULT_LINKER in options.

Packages can influence linker selection both by positive and/or
negative PKG_BUILD_FLAGS, eg +bfd or -gold.

Positive build flags take priority over the default linker so eg
DEFAULT_LINKER="gold" and PKG_BUILD_FLAGS="+bfd" will select bfd.

Negative flags mean a specific linker should not be used, eg -gold
prevents using gold.

If the default linker is disabled via a build flag then any other
available linker will be used.

Optional linkers like gold have to be enabled with eg GOLD_SUPPORT="yes"
in options. If an optional linker is not enabled it won't be a candidate
for linker selection. So eg "+mold" will have no effect if MOLD_SUPPORT
isn't set to "yes".

Signed-off-by: Matthias Reichl <hias@horus.com>
2022-09-27 19:00:27 +02:00
Matthias Reichl
bb7c110320 config/optimize: drop unused MACHINE_HARDWARE_CPU/PLATFORM variables
uname options -p and -i are non portable and return "unknown" on
Linux with GNU coreutils as there's no OS support for it.

Note: some distributions like Fedora or Ubunto patch coreutils so
that uname -p (more or less) returns the machine name (uname -m output).
But that should not be used and fails on distributions like Debian
that don't add that patch.

Signed-off-by: Matthias Reichl <hias@horus.com>
2022-06-30 16:35:04 +02:00
SupervisedThinking
8893cf7106 config/optimize: build debug with -Og instead of -0s
If we build with `-Os` some vars are missing in backtraces and will be listed as `<optimized out>`

- https://github.com/PCSX2/pcsx2/issues/5226#issuecomment-1036987320

```
Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than -O0 for producing debuggable code because some compiler passes that collect debug information are disabled at -O0.

Like -O0, -Og completely disables a number of optimization passes so that individual options controlling them have no effect. Otherwise -Og enables all -O1 optimization flags except for those that may interfere with debugging:
```

- https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
2022-02-17 15:39:30 +01:00
SupervisedThinking
ec1d61ce43 config/optimize: add MACHINE_HARDWARE_CPU for meson conf 2021-11-29 17:31:58 +01:00
rschupp
8781ccb0d5 build: fix detection of multiarch lib and include directories 2021-10-18 09:29:43 +02:00
mglae
131654d937 buildsystem: use -DNDEBUG not only for cmake release builds 2021-09-17 18:20:08 +02:00
Matthias Reichl
3524d12878 allow building with separate debug info
Add SPLIT_DEBUG_INFO option, when it's set to yes the debug info is
stored in separate .dwo files.

This is mainly useful for remote debugging and reduces image size a lot.

See also https://gcc.gnu.org/wiki/DebugFission

Signed-off-by: Matthias Reichl <hias@horus.com>
2020-04-22 20:28:23 +02:00
Andre Heider
2d12b7ebe8 build: add load average limit to reduce CPU overcommitment
For make and ninja based build systems, no new jobs are started if the load
average is greater than number_of_cores * 1.5.
2020-01-17 09:16:37 +01:00
MilhouseVH
f03406f33b buildsystem: fix BUILD_WITH_DEBUG usage in config/optimize (v2) 2019-11-04 16:42:14 +00:00
MilhouseVH
021a47be35 buildsystem: fix BUILD_WITH_DEBUG usage in config/optimize 2019-11-04 16:34:55 +00:00
Ian Leonard
c5e535505c buildsystem: add package flags to set compiler optimization
speed: use O3
size: use Os
default: use O2

The priority order is to use speed if set, then size, and fallback
to default when neither are set.

Signed-off-by: Ian Leonard <antonlacon@gmail.com>
2019-05-21 01:00:29 +00:00
MilhouseVH
f9ed478992 setup_toolchain: add CMAKE_SYSTEM_PROCESSOR to host/bootstrap config
libjpeg-turbo:host fails without this.
2018-12-29 15:53:49 +00:00
Ian Leonard
ae689aa0a5 config/optimize: add march=native to host cflags
Relies on the assumption that the machine that will build the toolchain will
also be the machine to use said toolchain.

Signed-off-by: Ian Leonard <antonlacon@gmail.com>
2018-10-27 21:39:58 +00:00
Ian Leonard
c7952a9539 build: set hash-style to gnu via gcc default
Builds use a mix of styles for the hash table in the ELF header. Only
one style of table is necessary, and the GNU one is more performant
for lookups. Eliminating the SysV style hash table trims ~450kb. This
is done via setting the default linker in gcc instead of LDFLAGS as
some packages ignore LDFLAGS.

Note that if MIPS is ever added as a supported architecture, it
does not support hash-style=gnu at this time.

Signed-off-by: Ian Leonard <antonlacon@gmail.com>
2018-06-09 21:17:31 +00:00
Matthias Reichl
b03cb4cc2f config/optimize, config/functions: refactor lto flags
Split up the LTO flags in config/optimize and assemble
full C/CXX/LDFLAGS in config/functions.

Add flags for parallel/single-threaded lto and fat/non-fat
lto object creation.

Change the default lto build flag to use non-fat lto objects.

Signed-off-by: Matthias Reichl <hias@horus.com>
2018-06-04 19:54:29 +02:00
Sascha Kuehndel (InuSasha)
b7b1a67723
place options at a more consistent place 2018-05-07 21:55:07 +02:00
Sascha Kuehndel (InuSasha)
8827a540aa
buildsystem: add BUILD_FLAG support
- replace strip_lto/strip_gold (only allowed to disable)
- add flag for PIC feature
- add flag to stop build parallel
- add support for hardening option (initial copy from debian 9)

All build parameters, are added in setup_toolchain.
`PKG_[FLAG]_[HOST/TARGET]_ENABLED` variable is introduced for checking the flag (yes/no) in the package.mk

Thanks to @MilhouseVH, for support and fixing
2018-03-07 18:35:01 +01:00
MilhouseVH
a3af8427f3 config/optmize: use BUILD_WITH_DEBUG variable 2018-02-19 07:08:48 +00:00
MilhouseVH
9928350609 buildsystem: eliminate other unecessary sub process usage 2017-10-10 01:34:46 +01:00
MilhouseVH
03366a102c TOOLCHAIN: drop $ROOT, convert to absolute path 2017-02-17 18:17:13 +00:00
Lukas Rusak
4df4ea789c
buildsys: remove optimizations=normal 2016-09-09 09:17:20 -07:00
Lukas Rusak
59bf03a90a config/optimize: do not strip at link 2016-01-31 00:21:33 +01:00
Stephan Raue
fd77c34d95 config/optimize: cleanup
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2014-09-03 22:59:33 +02:00
Stephan Raue
36251c397f config/optimize: dont build with '-ffast-math'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2014-04-25 23:11:23 +02:00
Stephan Raue
40add36fb9 gcc: update to gcc-4.9.0
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2014-04-23 18:33:34 +02:00
Stefan Saraev
a12e313f81 config/optimize: remove fast/speed 2014-02-24 14:40:33 +02:00
Stephan Raue
70e22eb090 config/optimize: force building with -Wno-format-security which causes buildissues on gettext:host and other packages, see also https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wformat_-Wformat-security
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2013-12-25 18:14:33 +01:00
Stephan Raue
3438a903b6 binutils, gcc: readd GOLD support, currently disabled
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2013-05-13 13:32:49 +02:00
Stephan Raue
f7c3f693eb config/optimize: add some more optimizations to the 'size' optimization
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2012-07-08 19:13:06 +02:00
Stephan Raue
b59fa7f7cc config/optimize: dont build with -fPIC support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2012-05-25 09:07:14 +02:00
Stephan Raue
ff84723996 projects/*/options: make prelink support optional
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2012-05-22 15:41:14 +02:00
Stephan Raue
83cd009af2 config/optimize: remove GOLD support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2012-03-29 17:02:32 +02:00
Stephan Raue
270110c88c config/optimize: remove Graphite and LOOP optimizations in preparing to update to gcc-4.7 support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2012-03-29 16:48:03 +02:00
Stephan Raue
14ab6a420f config/arch.*: dont set -fPIC globally
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-12-04 16:09:17 +01:00
Stephan Raue
338149fdb4 config/optimize: fix $LDFLAGS
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-09-16 06:55:47 +02:00
Stephan Raue
7a56fa1d27 config/optimize: fix LDFLAGS
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-09-09 09:44:42 +02:00
Stephan Raue
8d83bdc481 config/optimize: simplyfing
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-16 22:24:07 +02:00
Stephan Raue
a3c5e63efa config/optimize: use -ffast-math with -O3 optimization
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-16 14:32:18 +02:00
Stephan Raue
61e01cf703 config/optimize: dont use host libdirs in LDFLAGS, use in LIBDIR instead
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-13 22:04:29 +02:00
Stephan Raue
e83551cf71 config/optimize: add distribution specific libdirs to HOST_LDFLAGS
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-13 03:09:12 +02:00
Stephan Raue
4f54bf2e18 config/optimize: add support to en/disable LTO, GOLD, LOOP, GRAPHITE support via project files
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-12 01:47:26 +02:00
Stephan Raue
c7c0f31e70 config/optimize: reenable loop and graphite optimizations
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-11 21:39:05 +02:00
Stephan Raue
b00b854302 config/optimize: reenable excess-precision=fast and GOLD support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-11 18:24:39 +02:00
Stephan Raue
0ef03b77df config/optimize: disable loop, graphite, GOLD, LTO and excess-precision=fast support for now
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-10 23:24:31 +02:00
Stephan Raue
7a47517ff9 config/optimize: add support for -Ofast optimization
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-07-10 23:14:08 +02:00
Stephan Raue
2a2653191b config/path: move some optimizations to config/optimize
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-03-23 03:07:20 +01:00
Stephan Raue
43c8e9bc00 config/optimize: cosmetics
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2011-03-06 16:59:00 +01:00
Stephan Raue
fffd4090ee config/optimize: use -O3 for speed optimizing
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-12-23 17:15:32 +01:00