From fb54fe721c69e3c493b4692ec672a5c9a5704f9c Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Feb 18 2024 22:59:38 +0000 Subject: remove redundant / outdated flags from RUSTFLAGS Support for "Full" RELRO (i.e. RELRO and BIND_NOW) has been enabled in rustc by default on all architectures for a while. The "--cap-lints=warn" flag only downgrades some compiler errors to warnings, but those issues should likely be actual errors. --- diff --git a/macros.d/macros.rust b/macros.d/macros.rust index f5fd0a1..063805b 100644 --- a/macros.d/macros.rust +++ b/macros.d/macros.rust @@ -32,10 +32,6 @@ # -Cforce-frame-pointers: force inclusion of frame pointers (default: enabled # on x86_64 and aarch64 on Fedora 37+) # -# Additionally, some linker flags are set which correspond to the default -# Fedora compiler flags for hardening and for embedding package versions into -# compiled binaries. -# # ref. https://doc.rust-lang.org/rustc/codegen-options/index.html %build_rustflags %{shrink: -Copt-level=%rustflags_opt_level @@ -43,9 +39,6 @@ -Ccodegen-units=%rustflags_codegen_units -Cstrip=none %{expr:0%{?_include_frame_pointers} && ("%{_arch}" != "ppc64le" && "%{_arch}" != "s390x" && "%{_arch}" != "i386") ? "-Cforce-frame-pointers=yes" : ""} - -Clink-arg=-Wl,-z,relro - -Clink-arg=-Wl,-z,now %[0%{?_package_note_status} ? "-Clink-arg=%_package_note_flags" : ""] - --cap-lints=warn } diff --git a/tests/test_macros_rust.py b/tests/test_macros_rust.py index 7e7544e..8b09637 100644 --- a/tests/test_macros_rust.py +++ b/tests/test_macros_rust.py @@ -31,12 +31,9 @@ def test_build_rustflags(evaluater): f"-Cdebuginfo={rustflags_debuginfo}", f"-Ccodegen-units={rustflags_codegen_units}", "-Cstrip=none", - "-Clink-arg=-Wl,-z,relro", - "-Clink-arg=-Wl,-z,now", - "--cap-lints=warn", ] if rustflags_force_frame_pointers: - expected.insert(4, rustflags_force_frame_pointers) + expected.append(rustflags_force_frame_pointers) assert evaluater("%build_rustflags")[0] == " ".join(expected)