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).
This commit is contained in:
parent
9183c1c8d4
commit
57edf0cad7
@ -246,6 +246,22 @@ it is possible to add `-fcommon` to the flags by defining `%_legacy_common_suppo
|
|||||||
|
|
||||||
Properly fixing the failure is always preferred!
|
Properly fixing the failure is always preferred!
|
||||||
|
|
||||||
|
### Package note on ELF objects
|
||||||
|
|
||||||
|
A note that describes the package name, version, and architecture is
|
||||||
|
inserted via a linker script (`%_package_note_file`). The script is
|
||||||
|
generated when `%set_build_flags` is called. The linker option that
|
||||||
|
injects the linker script is added to `%{build_ldflags}` via the
|
||||||
|
`%{_package_note_flags}` macro.
|
||||||
|
|
||||||
|
To opt out of the use of the linker script, include this in the spec file:
|
||||||
|
|
||||||
|
%undefine _package_note_flags
|
||||||
|
|
||||||
|
To opt out of generation of the linker script, include this in the spec file:
|
||||||
|
|
||||||
|
%undefine _generate_package_note_file
|
||||||
|
|
||||||
### Post-build ELF object processing
|
### Post-build ELF object processing
|
||||||
|
|
||||||
By default, DWARF debugging information is separated from installed
|
By default, DWARF debugging information is separated from installed
|
||||||
|
3
macros
3
macros
@ -72,7 +72,7 @@
|
|||||||
# When clang is used as a linker driver, it does not auto-detect the LTO
|
# When clang is used as a linker driver, it does not auto-detect the LTO
|
||||||
# bytecode and neither does bfd, so we need to explicitly pass the -flto
|
# bytecode and neither does bfd, so we need to explicitly pass the -flto
|
||||||
# flag when linking.
|
# flag when linking.
|
||||||
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ] %{_build_id_flags}
|
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ] %{_build_id_flags} %{?_package_note_flags}
|
||||||
|
|
||||||
# Expands to shell code to set the compiler/linker environment
|
# Expands to shell code to set the compiler/linker environment
|
||||||
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
|
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
|
||||||
@ -80,6 +80,7 @@
|
|||||||
# been set implicitly at the start of the %%build section.
|
# been set implicitly at the start of the %%build section.
|
||||||
# LT_SYS_LIBRARY_PATH is used by libtool script.
|
# LT_SYS_LIBRARY_PATH is used by libtool script.
|
||||||
%set_build_flags \
|
%set_build_flags \
|
||||||
|
%{?_generate_package_note_file} ; \
|
||||||
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
|
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
|
||||||
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
|
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
|
||||||
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
|
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Summary: Red Hat specific rpm configuration files
|
Summary: Red Hat specific rpm configuration files
|
||||||
Name: redhat-rpm-config
|
Name: redhat-rpm-config
|
||||||
Version: 208
|
Version: 209
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
# No version specified.
|
# No version specified.
|
||||||
License: GPL+
|
License: GPL+
|
||||||
@ -102,6 +102,7 @@ Requires: rpmautospec-rpm-macros
|
|||||||
Requires: fpc-srpm-macros
|
Requires: fpc-srpm-macros
|
||||||
Requires: gnat-srpm-macros
|
Requires: gnat-srpm-macros
|
||||||
Requires: nim-srpm-macros
|
Requires: nim-srpm-macros
|
||||||
|
Requires: package-notes-srpm-macros
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Requires: rpm >= 4.11.0
|
Requires: rpm >= 4.11.0
|
||||||
@ -190,6 +191,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||||||
%doc buildflags.md
|
%doc buildflags.md
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jan 13 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 209-1
|
||||||
|
- Add package ELF note to the default LDFLAGS
|
||||||
|
|
||||||
* Tue Jan 04 2022 Tom Stellard <tstellar@redhat.com> - 208-1
|
* Tue Jan 04 2022 Tom Stellard <tstellar@redhat.com> - 208-1
|
||||||
- Call %%set_build_flags before %%build, %%check, and %%install stages
|
- Call %%set_build_flags before %%build, %%check, and %%install stages
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user