buildflags: use consistent indentation and other minor fixes

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-01-13 13:09:38 +01:00
parent 95f28bd10b
commit 1aa0c42cd3

View File

@ -11,10 +11,10 @@ this:
%configure %configure
This will invoke the `./configure` with arguments (such as This will invoke `./configure` with arguments (such as
`--prefix=/usr`) to adjust the paths to the packaging defaults. `--prefix=/usr`) to adjust the paths to the packaging defaults. Prior
Prior to that, some common problems in autotools scripts are to that, some common problems in autotools scripts are automatically
automatically patched across the source tree. patched across the source tree.
As a side effect, this will set the environment variables `CFLAGS`, As a side effect, this will set the environment variables `CFLAGS`,
`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH`, `CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH`,
@ -50,7 +50,7 @@ Individual build flags are also available through RPM macros:
variable `RPM_LD_FLAGS` is set to this value. variable `RPM_LD_FLAGS` is set to this value.
The variable `LT_SYS_LIBRARY_PATH` is defined here to prevent the `libtool` The variable `LT_SYS_LIBRARY_PATH` is defined here to prevent the `libtool`
script (v2.4.6+) from hardcoding %_libdir into the binaries' RPATH. script (v2.4.6+) from hardcoding `%_libdir` into the binaries' `RPATH`.
These RPM macros do not alter shell environment variables. These RPM macros do not alter shell environment variables.
@ -198,7 +198,7 @@ dynamically loaded plugins.
### Specifying the build-id algorithm ### Specifying the build-id algorithm
If you want to specify a different build-id algorithm for your builds, you If you want to specify a different build-id algorithm for your builds, you
can use the %_build_id_flags macro: can use the `%_build_id_flags` macro:
%_build_id_flags -Wl,--build-id=sha1 %_build_id_flags -Wl,--build-id=sha1
@ -319,7 +319,8 @@ Compiler flags end up in the environment variables `CFLAGS`,
The general (architecture-independent) build flags are: The general (architecture-independent) build flags are:
* `-O2`: Turn on various GCC optimizations. See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-O2). * `-O2`: Turn on various GCC optimizations. See the
[GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-O2).
Optimization improves performance, the accuracy of warnings, and the Optimization improves performance, the accuracy of warnings, and the
reach of toolchain-based hardening, but it makes debugging harder. reach of toolchain-based hardening, but it makes debugging harder.
* `-g`: Generate debugging information (DWARF). In Fedora, this data * `-g`: Generate debugging information (DWARF). In Fedora, this data
@ -334,7 +335,7 @@ The general (architecture-independent) build flags are:
* `-Werror=format-security`: Turn on format string warnings and treat * `-Werror=format-security`: Turn on format string warnings and treat
them as errors. them as errors.
See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-security). See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-security).
This can occasionally result in compilation errors. In this case, This can occasionally result in compilation errors. In that case,
the best option is to rewrite the source code so that only constant the best option is to rewrite the source code so that only constant
format strings (string literals) are used. format strings (string literals) are used.
* `-Wp,-D_FORTIFY_SOURCE=2`: Source fortification activates various * `-Wp,-D_FORTIFY_SOURCE=2`: Source fortification activates various
@ -445,25 +446,24 @@ tuning in the `gcc` package. These settings are:
* **armhfp**: `-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard` * **armhfp**: `-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard`
selects an Arm subarchitecture based on the ARMv7-A architecture selects an Arm subarchitecture based on the ARMv7-A architecture
with 16 64-bit floating point registers. `-mtune=cortex-8a` selects with 16 64-bit floating point registers. `-mtune=cortex-8a` selects
tuning for the Cortex-A8 implementation (while preserving compatibility tuning for the Cortex-A8 implementation (while preserving
with other ARMv7-A implementations). `-mabi=aapcs-linux` switches to compatibility with other ARMv7-A implementations).
the AAPCS ABI for GNU/Linux. `-mabi=aapcs-linux` switches to the AAPCS ABI for GNU/Linux.
* **i686**: `-march=i686` is used to select a minmum support CPU level * **i686**: `-march=i686` is used to select a minmum support CPU level
of i686 (corresponding to the Pentium Pro). SSE2 support is of i686 (corresponding to the Pentium Pro). SSE2 support is enabled
enabled with `-msse2` (so only CPUs with SSE2 support can run the with `-msse2` (so only CPUs with SSE2 support can run the compiled
compiled code; SSE2 was introduced first with the Pentium 4). code; SSE2 was introduced first with the Pentium 4).
`-mtune=generic` activates tuning for a current blend of CPUs `-mtune=generic` activates tuning for a current blend of CPUs (under
(under the assumption that most users of i686 packages obtain them the assumption that most users of i686 packages obtain them through
through an x86_64 installation on current hardware). an x86_64 installation on current hardware). `-mfpmath=sse`
`-mfpmath=sse` instructs GCC to use the SSE2 unit for floating instructs GCC to use the SSE2 unit for floating point math to avoid
point math to avoid excess precision issues. `-mstackrealign` excess precision issues. `-mstackrealign` avoids relying on the
avoids relying on the stack alignment guaranteed by the current stack alignment guaranteed by the current version of the i386 ABI.
version of the i386 ABI. * **ppc64le**: `-mcpu=power8 -mtune=power8` selects a minimum
* **ppc64le**: `-mcpu=power8 -mtune=power8` selects a minimum supported supported CPU level of POWER8 (the first CPU with ppc64le support)
CPU level of POWER8 (the first CPU with ppc64le support) and tunes and tunes for POWER8.
for POWER8. * **s390x**: `-march=zEC12 -mtune=z13` specifies a minimum supported
* **s390x**: `-march=zEC12 -mtune=z13` specifies a minimum supported CPU CPU level of zEC12, while optimizing for a subsequent CPU generation
level of zEC12, while optimizing for a subsequent CPU generation
(z13). (z13).
* **x86_64**: `-mtune=generic` selects tuning which is expected to * **x86_64**: `-mtune=generic` selects tuning which is expected to
beneficial for a broad range of current CPUs. beneficial for a broad range of current CPUs.