Harden library linking

Resolves: rhbz#2038853

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
This commit is contained in:
Michael Petlan 2022-01-12 18:28:22 +01:00
parent 72c0012e0f
commit 48095317fc
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,11 @@
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -56,7 +56,7 @@
do_compile_shared_library = \
($(print_shared_lib_compile) \
- $(CC) --shared $^ '-Wl,-soname,$(1),-rpath=$$ORIGIN' -o $@ $(LIBS))
+ $(CC) --shared $^ '-Wl,-soname,$(1),-rpath=$$ORIGIN' -o $@ $(GCCLDFLAGS) $(LIBS))
do_compile_plugin_obj = \
($(print_plugin_obj_compile) \

View File

@ -11,7 +11,7 @@
Name: libtracefs
Version: 1.0.2
Release: 5%{?dist}
Release: 6%{?dist}
License: LGPLv2+ and GPLv2+
Summary: Library for access kernel tracefs
@ -23,6 +23,7 @@ URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
#Source0: libtracefs-%%{version}.tar.gz
#Source0: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/libtracefs-%%{commit}.tar.gz
Source0: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/libtracefs-%{version}.tar.gz
Patch0: libtracefs-1.0.2-harden-linking.patch
BuildRequires: gcc
BuildRequires: make
BuildRequires: pkgconfig(libtraceevent)
@ -41,9 +42,11 @@ Development headers of %{name}
%prep
%setup -q
%patch0 -p1
%build
%set_build_flags
export GCCLDFLAGS="-Wl,-z,now"
%make_build prefix=%{_prefix} libdir=%{_libdir} all
%install
@ -62,6 +65,10 @@ rm -rf %{buildroot}/%{_libdir}/libtracefs.a
%{_libdir}/%{name}.so
%changelog
* Wed Jan 12 2022 Michael Petlan <mpetlan@redhat.com> - 1.0.2-6
- Harden library linking
Related: rhbz#2038853
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.2-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688