From 9f46ccb4ce9da45fa0ba74f29d399ac19929c2e4 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 15 Jun 2020 17:33:58 +0100 Subject: [PATCH] Add (optional) llvm plugin. --- .gitignore | 1 + annobin.spec | 61 +++++++++++++++++++++++++++++++++++----------------- sources | 2 +- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 2e7539f..0f2e0c5 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,4 @@ /annobin-9.19.tar.xz /annobin-9.20.tar.xz /annobin-9.21.tar.xz +/annobin-9.22.tar.xz diff --git a/annobin.spec b/annobin.spec index 5773b3a..1e0f656 100644 --- a/annobin.spec +++ b/annobin.spec @@ -1,7 +1,7 @@ Name: annobin Summary: Annotate and examine compiled binary files -Version: 9.21 +Version: 9.22 Release: 1%{?dist} License: GPLv3+ # ProtocolURL: https://fedoraproject.org/wiki/Toolchain/Watermark @@ -22,9 +22,12 @@ License: GPLv3+ # time check for debuginfod support. %bcond_with debuginfod -# Use "--with clangplugin" to build the annobin plugin for clang. +# Use "--with clangplugin" to build the annobin plugin for Clang. %bcond_with clangplugin +# Use "--with llvmplugin" to build the annobin plugin for LLVM. +%bcond_with llvmplugin + # Set this to zero to disable the requirement for a specific version of gcc. # This should only be needed if there is some kind of problem with the version # checking logic or when building on RHEL-7 or earlier. @@ -109,7 +112,10 @@ Requires: gcc BuildRequires: gcc gcc-plugin-devel gcc-c++ %if %{with clangplugin} -BuildRequires: clang clang-devel llvm llvm-devel +BuildRequires: clang clang-devel llvm llvm-devel compiler-rt +%endif +%if %{with llvmplugin} +BuildRequires: clang clang-devel llvm llvm-devel compiler-rt %endif %description @@ -120,7 +126,11 @@ Note - the plugin is automatically enabled in gcc builds via flags provided by the redhat-rpm-macros package. %if %{with clangplugin} -Also provides a plugin for clang which performs a similar function. +Also provides a plugin for Clang which performs a similar function. +%endif + +%if %{with llvmplugin} +Also provides a plugin for LLVM which performs a similar function. %endif #--------------------------------------------------------------------------------- @@ -162,6 +172,8 @@ hardening options. # Instead it just uses dlopen() with no pathname prefix. So we # construct a (hopefully good) path and rely upon users of annobin # knowing about this location. +# FIXME2: Currently this same path is hardcoded into the Makefile.in +# files in the clang-plugin and llvm-plugin source directories... %global ANNOBIN_CLANG_PLUGIN_DIR /usr/lib64/clang/%(clang -dumpversion)/lib %endif @@ -189,13 +201,30 @@ touch doc/annobin.info %build +CONFIG_ARGS= + %if %{with debuginfod} -%configure --quiet --with-gcc-plugin-dir=%{ANNOBIN_GCC_PLUGIN_DIR} --with-debuginfod || cat config.log +CONFIG_ARGS="$CONFIG_ARGS --with-debuginfod" %else -%configure --quiet --with-gcc-plugin-dir=%{ANNOBIN_GCC_PLUGIN_DIR} || cat config.log +CONFIG_ARGS="$CONFIG_ARGS --without-debuginfod" %endif +%if %{with clangplugin} +CONFIG_ARGS="$CONFIG_ARGS --with-clang" +%endif + +%if %{with llvmplugin} +CONFIG_ARGS="$CONFIG_ARGS --with-llvm" +%endif + +%if %{without tests} +CONFIG_ARGS="$CONFIG_ARGS --without-test" +%endif + +%configure --quiet --with-gcc-plugin-dir=%{ANNOBIN_GCC_PLUGIN_DIR} ${CONFIG_ARGS} || cat config.log + %make_build + # Rebuild the plugin, this time using the plugin itself! This # ensures that the plugin works, and that it contains annotations # of its own. This could mean that we end up with a plugin with @@ -210,22 +239,12 @@ BUILD_FLAGS="-fplugin=%{_tmppath}/tmp_annobin.so -fplugin-arg-tmp_annobin-rename make -C gcc-plugin CXXFLAGS="%{optflags} $BUILD_FLAGS" rm %{_tmppath}/tmp_annobin.so -%if %{with clangplugin} -# FIXME: The symbolic link should not be needed. -ln -f -s ../annobin-global.h clang-plugin -make -C clang-plugin annobin.so -%endif - #--------------------------------------------------------------------------------- %install %make_install rm -f %{buildroot}%{_infodir}/dir -%if %{with clangplugin} -install -Dpm0755 -t %{buildroot}%{ANNOBIN_CLANG_PLUGIN_DIR} clang-plugin/annobin.so -%endif - #--------------------------------------------------------------------------------- %if %{with tests} @@ -246,10 +265,6 @@ fi %files %{ANNOBIN_GCC_PLUGIN_DIR} -%{_bindir}/built-by -%{_bindir}/check-abi -%{_bindir}/hardened -%{_bindir}/run-on-binaries-in %license COPYING3 LICENSE %exclude %{_datadir}/doc/annobin-plugin/COPYING3 %exclude %{_datadir}/doc/annobin-plugin/LICENSE @@ -264,6 +279,9 @@ fi %if %{with clangplugin} %{ANNOBIN_CLANG_PLUGIN_DIR} %endif +%if %{with llvmplugin} +%{ANNOBIN_CLANG_PLUGIN_DIR} +%endif %if %{with annocheck} %files annocheck @@ -274,6 +292,9 @@ fi #--------------------------------------------------------------------------------- %changelog +* Mon Jun 15 2020 Nick Clifton - 9.22-1 +- Add (optional) llvm plugin. + * Wed Apr 22 2020 Nick Clifton - 9.21-1 - Annobin: Fall back on using the flags if the option cannot be found in cl_options. (#1817659) diff --git a/sources b/sources index fed9b7a..c19b106 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (annobin-9.21.tar.xz) = baf1c9f90b6bcfdc5db865a5f897edcac4abe6449cf520cdec856bbca9741a937798196603b486259d0981216b2e8363ee003a9c5d1cfffe5a2a65284ab53e34 +SHA512 (annobin-9.22.tar.xz) = c39e6086993acca320db5e02aa72d1bfe4428bec18c98e38fad5d67afe617b7f06c2c5b9c7bad09d0df9d3b2585411e88598c9ab5e4930f5e0c27b36a5c4fc69