Merge remote-tracking branch 'up/main' into main-riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
commit
8acac96087
@ -290,6 +290,16 @@ For example, this can be required if shared objects are used for their
|
||||
side effects in ELF constructors, or for making them available to
|
||||
dynamically loaded plugins.
|
||||
|
||||
### Switching to legacy relative relocations
|
||||
|
||||
By default, ELF objects use the architecture-independent `DT_RELR`
|
||||
mechanism for relative relocations. To switch to the older,
|
||||
architecture-specific relocation scheme, add this to the RPM spec file:
|
||||
|
||||
%undefine _ld_pack_relocs
|
||||
|
||||
This adds `-Wl,-z,pack-relative-relocs` to the linker flags (`LDFLAGS`).
|
||||
|
||||
### Specifying the build-id algorithm
|
||||
|
||||
If you want to specify a different build-id algorithm for your builds, you
|
||||
@ -631,6 +641,10 @@ to the compiler driver `gcc`, and not directly to the link editor
|
||||
for shared objects that actually provide symbols required by the link.
|
||||
Shared objects which are not needed to fulfill symbol dependencies
|
||||
are essentially ignored due to this flag.
|
||||
* `-z pack-relative-relocs`: Use the portable `DT_RELR` scheme for
|
||||
relative relocations, resulting in reduced startup time compared to
|
||||
legacy architecture-specific relocations. (`-z pack-relative-relocs`
|
||||
is currently disabled on aarch64 and s390x due to toolchain limitations.)
|
||||
* `-z defs`: Refuse to link shared objects (DSOs) with undefined symbols
|
||||
(optional, see above).
|
||||
|
||||
|
11
macros
11
macros
@ -79,20 +79,21 @@
|
||||
# the flags, while intended for ld, are still passed through the gcc
|
||||
# compiler driver. At the beginning of %%build, the environment
|
||||
# variable RPM_LD_FLAGS to this value.
|
||||
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} %{?_distro_extra_ldflags}
|
||||
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_ld_pack_relocs_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} %{?_distro_extra_ldflags}
|
||||
|
||||
# Expands to shell code to set the compiler/linker environment
|
||||
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, VALAFLAGS, LDFLAGS if they
|
||||
# have not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
|
||||
# been set implicitly at the start of the %%build section.
|
||||
# LT_SYS_LIBRARY_PATH is used by libtool script.
|
||||
# RUSTFLAGS is only set when %%{build_rustflags} is available.
|
||||
%set_build_flags \
|
||||
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
|
||||
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
|
||||
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
|
||||
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
|
||||
VALAFLAGS="${VALAFLAGS:-%{build_valaflags}}" ; export VALAFLAGS ; \
|
||||
RUSTFLAGS="${RUSTFLAGS:-%{build_rustflags}}" ; export RUSTFLAGS ; \
|
||||
VALAFLAGS="${VALAFLAGS:-%{build_valaflags}}" ; export VALAFLAGS ;%{?build_rustflags:
|
||||
RUSTFLAGS="${RUSTFLAGS:-%{build_rustflags}}" ; export RUSTFLAGS ;} \
|
||||
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
|
||||
LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH ; \
|
||||
CC="${CC:-%{__cc}}" ; export CC ; \
|
||||
@ -372,6 +373,10 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
|
||||
%_ld_as_needed 1
|
||||
%_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed}
|
||||
|
||||
# aarch64 and s390x currently do not support packed relocations.
|
||||
%_ld_pack_relocs %[ "%{_arch}" == "x86_64" || "%{_arch}" == "i386" || "%{_arch}" == "ppc64le" ]
|
||||
%_ld_pack_relocs_flags %[0%{?_ld_pack_relocs} ? "-Wl,-z,pack-relative-relocs" : ""]
|
||||
|
||||
# LTO is the default in Fedora.
|
||||
# "%define _lto_cflags %{nil}" to opt out
|
||||
#
|
||||
|
@ -4,12 +4,12 @@
|
||||
# 2) When making changes, increment the version (in baserelease) by 1.
|
||||
# rpmdev-bumpspec and other tools update the macro below, which is used
|
||||
# in Version: to get the desired effect.
|
||||
%global baserelease 271
|
||||
%global baserelease 275
|
||||
|
||||
Summary: Red Hat specific rpm configuration files
|
||||
Name: redhat-rpm-config
|
||||
Version: %{baserelease}
|
||||
Release: 1.1.riscv64%{?dist}
|
||||
Release: 1.0.riscv64%{?dist}
|
||||
# config.guess, config.sub are GPL-3.0-or-later WITH Autoconf-exception-generic
|
||||
License: GPL-1.0-or-later AND GPL-2.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic AND Boehm-GC
|
||||
URL: https://src.fedoraproject.org/rpms/redhat-rpm-config
|
||||
@ -114,6 +114,7 @@ Requires: pyproject-srpm-macros
|
||||
Requires: fpc-srpm-macros
|
||||
Requires: gnat-srpm-macros
|
||||
Requires: ansible-srpm-macros
|
||||
Requires: zig-srpm-macros
|
||||
%endif
|
||||
|
||||
Requires: rpm >= 4.11.0
|
||||
@ -255,15 +256,25 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua
|
||||
%doc buildflags.md
|
||||
|
||||
%changelog
|
||||
* Thu Nov 30 2023 David Abdurachmanov <davidlt@rivosinc.com> - 271-1.1.riscv64
|
||||
* Tue Jan 09 2024 David Abdurachmanov <davidlt@rivosinc.com> - 275-1.0.riscv64
|
||||
- Set all LTO macros (_lto_cflags, _gcc_lto_cflags, _clang_lto_cflags) to nil
|
||||
as we want to increase build times for packages.
|
||||
|
||||
* Thu Nov 30 2023 David Abdurachmanov <davidlt@rivosinc.com> - 271-1.0.riscv64
|
||||
- Add riscv64 to %%gap_arches, %%java_arches, and %%nodejs_arches
|
||||
- Set %%_clang_lto_cflags to %%nil as ld.gold is not implemented for riscv64
|
||||
and thus LTO with Clang doesn't work.
|
||||
|
||||
* Fri Jan 05 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 275-1
|
||||
- Define RUSTFLAGS only when rust macros are installed
|
||||
|
||||
* Wed Jan 3 2024 Florian Weimer <fweimer@redhat.com> - 274-1
|
||||
- Missing packed relative relocation support on aarch64, s390x (#2256645)
|
||||
|
||||
* Tue Jan 2 2024 Florian Weimer <fweimer@redhat.com> - 273-1
|
||||
- Pack relative ELF relocations by default
|
||||
|
||||
* Tue Dec 26 2023 Jan Drögehoff <sentrycraft123@gmail.com> - 272-1
|
||||
- Add zig-srpm-macros
|
||||
|
||||
* Fri Nov 03 2023 Stephen Gallagher <sgallagh@redhat.com> - 271-1
|
||||
- ELN: Enable frame pointers for RHEL 11+ (for now)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user