Commit Graph

57 Commits

Author SHA1 Message Date
Charalampos Stratakis 7331757cf1 Strip all extension builder flags except -fexceptions and -fcf-protection
This preserves binary compatibility with the main interpreters
the extensions are built against while removing Fedora's flags
that are not required to be inherited on user built extensions.

This implements https://fedoraproject.org/wiki/Changes/Python_Extension_Flags_Reduction
2023-08-04 12:58:12 +02:00
Florian Weimer 246107d5f6 Implement the %build_type_safety_c macro (#2218019)
The default remains at 0 (no change) until the corresponding Fedora
change proposal is accepted:

  <https://fedoraproject.org/wiki/Changes/GNUToolchainF39>
2023-07-05 14:28:21 +02:00
Florian Weimer 7692bbaf45 Filter out C, C++ build flags from Fortran build flags (#2177253)
And pave the way for future front-end-specific compiler flags.
2023-07-05 13:04:12 +02:00
Davide Cavalca 990cc89b1b Do not include frame pointers on i686 and s390x for now 2023-01-10 12:53:06 -08:00
Davide Cavalca 9ce7719338 Set arch specific flags for frame pointers support 2023-01-05 08:00:20 -08:00
Davide Cavalca f080fb9562 Enable frame pointers by default 2023-01-05 07:59:43 -08:00
Siddhesh Poyarekar 4c05f3cfa2 Enable _FORTIFY_SOURCE=3 by default
Make the _FORTIFY_SOURCE flags configurable so that the command line is
not cluttered with _FORTIFY_SOURCE definitions and undefines.  Introduce
a %_fortify_level variable that a package may override by either
undefining or defining to a specific value.

Also bump the default value to 3, to implement the systemwide proposal
for Fedora 38:

https://fedoraproject.org/wiki/Changes/Add_FORTIFY_SOURCE%3D3_to_distribution_build_flags
2023-01-03 10:33:35 -05:00
Davide Cavalca 04a4350d3e Add conditional support for always including frame pointers
If `%_include_frame_pointers` is defined, add `-fno-omit-frame-pointer`
and `-mno-omit-leaf-frame-pointer` to the compiler flags to ensure frame
pointers are always included.

This is in preparation for
https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
2022-12-28 13:12:39 -08:00
Florian Weimer f857d65cdd Add %_configure_use_runstatedir to disable --runstatedir 2022-12-10 13:39:25 +01:00
Michael Catanzaro d0970582ad Set -g when building Vala applications
This requires the build system support VALAFLAGS. At least Meson and
Automake do.

Using -g is desired because it allows us to see Vala source files and
line numbers in backtraces when possible, falling back to generated C
code otherwise. Line numbers for generated C are almost always less
useful when debugging crashes.
2022-09-13 12:44:51 -05:00
Timm Bäder ccc728db6d Add %__brp_remove_la_files to __os_install_post 2022-02-21 09:19:27 +01:00
Zbigniew Jędrzejewski-Szmek 68d400e374 docs: add more quoting
Also some minor grammar fixups and "s/link editor/linker/" when
talking about ld.
2022-01-20 22:04:59 +01:00
Zbigniew Jędrzejewski-Szmek 38fc865990 ELF notes: rework the description of disabling
I changed the definitions in package-notes to not do anything if
%_package_note_file is undefined. The other macros won't work if it is
not defined anyway, so this is quite natural. With this, undefining
%_package_note_file becomes the most comprehensive mechanism to disable
the feature. (Undefining %_package_note_flags still works so backwards
compat is preserved.)

The new mechanism will work once
https://src.fedoraproject.org/rpms/package-notes/pull-request/1 is merged.
But I don't think it is necessary to add a version requirement here, since
we're only providing the docs here.
2022-01-20 22:03:18 +01:00
Zbigniew Jędrzejewski-Szmek 57edf0cad7 Inject linker script to generate package notes
https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
Macros are used only if defined. Definitions are provided in the
package-notes-srpm-macros, which is now Required (on Fedora).
2022-01-17 09:20:00 +01:00
Tom Stellard 9183c1c8d4 Call %set_build_flags before %build, %check, and %install stages
https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck
2022-01-14 20:57:22 +00:00
Zbigniew Jędrzejewski-Szmek 0732587e7b Change %define to %global
The packaging guidelines say that %global should is preferred.
2022-01-13 14:05:59 +01:00
Zbigniew Jędrzejewski-Szmek 1aa0c42cd3 buildflags: use consistent indentation and other minor fixes 2022-01-13 14:05:59 +01:00
Tom Stellard 95f28bd10b Add -Wl,--build-id=sha1 to the default LDFLAGS
This is already the default for ld.bfd, so this is effectively a no-op
for most packages.  However, lld defaults different build-id algorithm
that the RPM build process does not support, so it needs this flag.

This flag can be overriden by setting the %_build_id_flags macro,
which packages could do if they wanted to use a more secure build-id
algorithm.
2021-12-15 01:24:25 +00:00
Florian Weimer d1702bd08e buildflags.md: Fix formatting issue in %build_fflags documentation 2021-12-07 21:25:40 +01:00
Florian Weimer aee37a70c1 buildflags.md: Document source tree patching during %configure 2021-11-16 17:43:36 +01:00
Florian Weimer 69360e1d57 buildflags.md: Fix typo introduced in commit 65028a4d 2021-11-16 17:12:32 +01:00
Florian Weimer f33780a5e7 buildflags.md: Fix typos introduce in commit a3cf0d66 2021-11-16 17:05:39 +01:00
Florian Weimer ff647eda53 buildflags.md: Document the post-processing on ELF files 2021-11-16 14:51:13 +01:00
Florian Weimer 65028a4d00 buildflags.md: Document -fasynchronous-unwind-tables as generic option
And mention it is disabled on armhfp.
2021-11-15 15:59:36 +01:00
Florian Weimer 23e5f0dbd6 buildflags.md: Mentioned that annobin is only on for gcc, !armhpf 2021-11-15 15:58:09 +01:00
Florian Weimer a3cf0d66a7 buildflags.md: Treat -fstack-clash-protection as a generic flag
And mention the two exceptions (armhfp, and for clang, aarch64).
2021-11-15 15:51:29 +01:00
Florian Weimer f824dc72a1 buildflags.md: Document LTO and how to disable it 2021-11-15 15:44:56 +01:00
Florian Weimer 4a0c38832e buildflags.md: Document build_cc, build_cxx, build_cpp 2021-11-15 15:34:32 +01:00
Florian Weimer a9123ea1ac buildflags.md: Move toolchain selection documentation from macros file 2021-11-15 15:34:15 +01:00
Florian Weimer ac57cc99aa buildflags.md: Mention optional -fcommon under compiler flags 2021-11-15 15:26:05 +01:00
Florian Weimer 92959df563 buildflags.md: Document _ld_as_needed, --as-needed 2021-11-15 15:25:49 +01:00
Florian Weimer 76114fa60e buildflags.md: Document -mbranch-protection=standard for aarch64 2021-11-15 12:32:38 +01:00
Florian Weimer 92261d7c20 buildflags.md: Drop mentions of ppc64
The ppc64 architecture is no longer built.
2021-11-15 12:31:16 +01:00
Jeff Law 3e759e70ac Allow conditionally adding -fcommon to CFLAGS by defining %_legacy_common_support
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2020-01-23 14:25:11 +01:00
Pavel Raiskup e345575f97 %set_build_flags: define LT_SYS_LIBRARY_PATH
This config is to let libtool recognize that our 64bit variant of
%_libdir is actually on the standard/default library path, so libtool
doesn't think it has to be hard-wired as RPATH.  This is proper solution
for libtool RPATH issues described in:

  https://docs.fedoraproject.org/en-US/packaging-guidelines/#_removing_rpath

The libtool script/macros (new enough, v2.4.6+) honor this variable when
it isn't possible to detect the system-wide default library path.  It is
e.g. able to parse /etc/ld.so.* configuration, but there's no info about
/usr/lib64 on Fedora.

So to not force everybody to do:

   %configure LT_SYS_LIBRARY_PATH=...

... rather set this system-wide.  This is low-risk change since
older libtool scripts don't use this variable, and really no other
tools should.
2019-12-03 15:04:51 +01:00
Miro Hrončok f29acc639b buildflags.md: Fix the packaging guidelines link 2019-01-18 22:38:59 +01:00
Florian Weimer e80fa1344a Build flags: Add support for extension builders (#1543394) 2018-12-20 11:34:27 +01:00
David Hugh Malcolm 521c1a9dd5 buildflags.md: fix typo 2018-07-11 13:43:53 +00:00
Florian Weimer a5c98437e2 Build flags: Require SSE2 on i686 (#1592212) 2018-06-18 11:48:31 +02:00
Florian Weimer f25f1b7627 Reflect -fasynchronous-unwind-tables GCC default on POWER (#1550914) 2018-05-02 11:55:12 +02:00
Florian Weimer 6b620c91fb Use plain -fcf-protection compiler flag, without -mcet (#1570823) 2018-05-02 11:39:39 +02:00
Florian Weimer d5133f9acc Use -funwind-tables on POWER
Ideally, the GCC defaults should change as well, but let's put this into
redhat-rpm-config, too, similarly to -fasynchronous-unwind-tables.
2018-02-28 10:45:12 +01:00
Florian Weimer 0448c23b73 Document the use of -Wl,z,lazy 2018-02-24 21:46:59 +01:00
Igor Gnatenko 6bc9480501
buildflags.md: add missing quote
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-09 17:42:37 +01:00
Florian Weimer ddb845537c Fix typo 2018-02-05 14:40:59 +01:00
Florian Weimer fa08f0e5a1 Add RPM macros for compiler/linker flags 2018-02-04 18:00:40 +01:00
Florian Weimer 8d6c6d0761 Build flags: Disable -z defs again (#1535422) 2018-01-29 15:18:11 +01:00
Florian Weimer 1b296f01fc Build flags: Enable CET on i686, x86_64 (#1538725) 2018-01-29 15:18:11 +01:00
Florian Weimer 6e5a75d61e Build flags: Switch to generic tuning on i686 (#1538693)
This matches what the gcc package already does by default.
2018-01-25 16:22:54 +01:00
Florian Weimer a013956e4f Build flags: Mention -fplugin-arg-annobin-disable 2018-01-23 16:25:52 +01:00