Annocheck: Fix memory corruption. (#1996963)

spec file: Add the creation of a gcc-plugin version info file in /usr/lib/rpm/redhat.
This commit is contained in:
Nick Clifton 2021-08-24 17:16:30 +01:00
parent 5e4c738a8f
commit 1d5918a750
3 changed files with 38 additions and 34 deletions

View File

@ -1,27 +0,0 @@
From bda340f0754972944ec115a72f1a8547ffa21f1c Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Mon, 16 Aug 2021 18:04:53 +0000
Subject: [PATCH] llvm-plugin: Add -flegacy-pass-manager option to the test
case
The plugin does not work with the new pass manager yet.
---
llvm-plugin/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm-plugin/Makefile.in b/llvm-plugin/Makefile.in
index bdd8b19..92bcc9a 100644
--- a/llvm-plugin/Makefile.in
+++ b/llvm-plugin/Makefile.in
@@ -48,7 +48,7 @@ PLUGIN_TEST_OPTIONS = \
# -fcf-protection \
check: @srcdir@/hello.c
- @ $(CLANG) -Xclang -load -Xclang $(PLUGIN) $(PLUGIN_TEST_OPTIONS) -c @srcdir@/hello.c
+ @ $(CLANG) -flegacy-pass-manager -Xclang -load -Xclang $(PLUGIN) $(PLUGIN_TEST_OPTIONS) -c @srcdir@/hello.c
@ $(READELF) --wide --notes hello.o > llvm-plugin-test.out
@ grep --silent -e "annobin built by llvm version" llvm-plugin-test.out
@ grep --silent -e "running on LLVM version" llvm-plugin-test.out
--
2.26.2

View File

@ -1,7 +1,7 @@
Name: annobin Name: annobin
Summary: Annotate and examine compiled binary files Summary: Annotate and examine compiled binary files
Version: 9.90 Version: 9.92
Release: 1%{?dist} Release: 1%{?dist}
License: GPLv3+ License: GPLv3+
# Maintainer: nickc@redhat.com # Maintainer: nickc@redhat.com
@ -231,6 +231,15 @@ Requires: (gcc >= %{gcc_major} with gcc < %{gcc_next})
Requires: gcc Requires: gcc
%endif %endif
# The next line has been stolen from redhat-rpm-config.spec.
# We install a version info file into this directory, rather than gcc's plugin
# directory, because there is no reliable way for redhat-rpm-config to
# determine the name of gcc's plugin directory.
%global rrcdir /usr/lib/rpm/redhat
# Information about the gcc plugin is recorded in this file.
%global aver %{rrcdir}/annobin-plugin-version-info
%description plugin-gcc %description plugin-gcc
Installs an annobin plugin that can be used by gcc. Installs an annobin plugin that can be used by gcc.
@ -279,6 +288,7 @@ Installs an annobin plugin that can be used by Clang.
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
%prep %prep
if [ -z "%{gcc_vr}" ]; then if [ -z "%{gcc_vr}" ]; then
echo "*** Missing gcc_vr spec file macro, cannot continue." >&2 echo "*** Missing gcc_vr spec file macro, cannot continue." >&2
exit 1 exit 1
@ -339,7 +349,7 @@ CONFIG_ARGS="$CONFIG_ARGS --without-annocheck"
%else %else
# Fedora supports AArch64's -mbranch-protection=bti, RHEL does not. # Fedora supports AArch64's -mbranch-protection=bti, RHEL does not.
%if 0%{?fedora} != 0 %if 0%{?fedora} != 0
export CFLAGS="$CFLAGS -DAARCh64_BRANCH_PROTECTION_SUPPORTED=1" export CFLAGS="$CFLAGS -DAARCH64_BRANCH_PROTECTION_SUPPORTED=1"
%endif %endif
%endif %endif
@ -354,8 +364,6 @@ export CLANG_TARGET_OPTIONS="-fcf-protection"
%make_build %make_build
#---------------------------------------------------------------------------------
%if %{with plugin_rebuild} %if %{with plugin_rebuild}
# Rebuild the plugin(s), this time using the plugin itself! This # Rebuild the plugin(s), this time using the plugin itself! This
# ensures that the plugin works, and that it contains annotations # ensures that the plugin works, and that it contains annotations
@ -397,15 +405,28 @@ make -C llvm-plugin all CXXFLAGS="%{optflags} $BUILD_FLAGS"
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# PLUGIN_INSTALL_DIR is used by the Clang and LLVM makefiles...
%install %install
# PLUGIN_INSTALL_DIR is used by the Clang and LLVM makefiles...
%make_install PLUGIN_INSTALL_DIR=%{buildroot}/%{llvm_plugin_dir} %make_install PLUGIN_INSTALL_DIR=%{buildroot}/%{llvm_plugin_dir}
%if %{with clangplugin} %if %{with clangplugin}
# Move clang plugin to a seperate directory. # Move the clang plugin to a seperate directory.
mkdir -p %{buildroot}/%{clang_plugin_dir} mkdir -p %{buildroot}/%{clang_plugin_dir}
mv %{buildroot}/%{llvm_plugin_dir}/annobin-for-clang.so %{buildroot}/%{clang_plugin_dir} mv %{buildroot}/%{llvm_plugin_dir}/annobin-for-clang.so %{buildroot}/%{clang_plugin_dir}
%endif %endif
%if %{with gccplugin}
# Record the version of gcc that built this plugin.
mkdir -p %{buildroot}%{rrcdir}
rm -f %{buildroot}%{aver}
# Note - the comparison logic in redhat-rpm-config's %%triggger macros require
# that the plugin builder information appear as the first three numbers in the file.
echo %{gcc_vr} > %{buildroot}%{aver}
# Provide a more complete version information string on the second line.
echo "%{ANNOBIN_GCC_PLUGIN_DIR}/annobin.so.0.0.0 was built by gcc version %{gcc_vr} from the %{version} sources" >> %{buildroot}%{aver}
%endif
rm -f %{buildroot}%{_infodir}/dir rm -f %{buildroot}%{_infodir}/dir
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -414,6 +435,8 @@ rm -f %{buildroot}%{_infodir}/dir
%check %check
# Change the following line to "make check || :" on RHEL7 or if you need to see the # Change the following line to "make check || :" on RHEL7 or if you need to see the
# test suite logs in order to diagnose a test failure. # test suite logs in order to diagnose a test failure.
# Change the following line to: make check CLANG_TESTS="check-pre-clang-13"
# if you need to run the tests on a machine with an earlier version of Clang installed.
make -k check make -k check
if [ -f tests/test-suite.log ]; then if [ -f tests/test-suite.log ]; then
cat tests/test-suite.log cat tests/test-suite.log
@ -447,6 +470,7 @@ fi
%if %{with gccplugin} %if %{with gccplugin}
%files plugin-gcc %files plugin-gcc
%{ANNOBIN_GCC_PLUGIN_DIR} %{ANNOBIN_GCC_PLUGIN_DIR}
%{aver}
%endif %endif
%if %{with annocheck} %if %{with annocheck}
@ -458,6 +482,13 @@ fi
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
%changelog %changelog
* Tue Aug 24 2021 Nick Clifton <nickc@redhat.com> - 9.92-1
- Annocheck: Fix memory corruption. (#1996963)
- spec file: Add the creation of a gcc-plugin version info file in /usr/lib/rpm/redhat.
* Wed Aug 18 2021 Nick Clifton <nickc@redhat.com> - 9.91-1
- Annocheck: Fix conditionalization of AArch64's PAC+BTI detection.
* Wed Aug 18 2021 Nick Clifton <nickc@redhat.com> - 9.90-1 * Wed Aug 18 2021 Nick Clifton <nickc@redhat.com> - 9.90-1
- Annocheck: Add linker generated function for ppc64le exceptions. (#1981410) - Annocheck: Add linker generated function for ppc64le exceptions. (#1981410)
- LLVM Plugin: Allow checks to be selected from the command line. - LLVM Plugin: Allow checks to be selected from the command line.

View File

@ -1 +1 @@
SHA512 (annobin-9.90.tar.xz) = 1dd320ad25f14d17c3a6973582a2c58912e3d5ffba51d459a09fc423bef2465fecb54c5a9d9202df8d68071cb5205eef2e2175d02c91fd7ba85abc103d324585 SHA512 (annobin-9.92.tar.xz) = 6edd56c7959b80254ecf08ff3aa2a59ff31146494cd20856e52f1f632bfd0e7d5a264dcf7227215f74b5e036aaad3d7c56d40ff4d57929446eafd33620e17b50