diff --git a/annobin-add-riscv-support.patch b/annobin-add-riscv-support.patch new file mode 100644 index 0000000..a5158e3 --- /dev/null +++ b/annobin-add-riscv-support.patch @@ -0,0 +1,114 @@ +diff --git a/gcc-plugin/Makefile.am b/gcc-plugin/Makefile.am +index 4df5c14..b3e061e 100644 +--- a/gcc-plugin/Makefile.am ++++ b/gcc-plugin/Makefile.am +@@ -9,7 +9,7 @@ AM_CPPFLAGS = -I'$(top_builddir)' -I'$(top_srcdir)' + AUTOMAKE_OPTIONS = no-dependencies + + annobin_la_SOURCES = annobin.cc +-EXTRA_annobin_la_SOURCES = aarch64.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc ++EXTRA_annobin_la_SOURCES = aarch64.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc + annobin_la_LIBADD = @target_plugin@ + annobin_la_DEPENDENCIES = @target_plugin@ + +diff --git a/gcc-plugin/Makefile.in b/gcc-plugin/Makefile.in +index b273612..159c4de 100644 +--- a/gcc-plugin/Makefile.in ++++ b/gcc-plugin/Makefile.in +@@ -352,7 +352,7 @@ plugin_LTLIBRARIES = annobin.la + AM_CPPFLAGS = -I'$(top_builddir)' -I'$(top_srcdir)' + AUTOMAKE_OPTIONS = no-dependencies + annobin_la_SOURCES = annobin.cc +-EXTRA_annobin_la_SOURCES = aarch64.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc ++EXTRA_annobin_la_SOURCES = aarch64.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc + annobin_la_LIBADD = @target_plugin@ + annobin_la_DEPENDENCIES = @target_plugin@ + annobin_la_LDFLAGS = -module +diff --git a/gcc-plugin/configure b/gcc-plugin/configure +index 2b9fe61..a0a64ee 100755 +--- a/gcc-plugin/configure ++++ b/gcc-plugin/configure +@@ -5158,6 +5158,9 @@ case ${target} in + x86_64-*-*) + target_plugin="x86_64.annobin.lo" + ;; ++ riscv*-*-*) ++ target_plugin="riscv.annobin.lo" ++ ;; + *) + target_plugin="dummy.annobin.lo" + ;; +diff --git a/gcc-plugin/configure.ac b/gcc-plugin/configure.ac +index 15ecb4a..967fd8f 100644 +--- a/gcc-plugin/configure.ac ++++ b/gcc-plugin/configure.ac +@@ -72,6 +72,9 @@ case ${target} in + s390*-*-*) + target_plugin="s390.annobin.lo" + ;; ++ riscv*-*-*) ++ target_plugin="riscv.annobin.lo" ++ ;; + *) + target_plugin="dummy.annobin.lo" + ;; +diff --git a/gcc-plugin/riscv.annobin.cc b/gcc-plugin/riscv.annobin.cc +new file mode 100644 +index 0000000..8a7c641 +--- /dev/null ++++ b/gcc-plugin/riscv.annobin.cc +@@ -0,0 +1,54 @@ ++/* riscv.annobin - Empty target specific parts of the annobin plugin. ++ Copyright (c) 2019-2020 Red Hat. ++ Created by Nick Clifton. ++ ++ This is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ It is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. */ ++ ++#include "annobin-global.h" ++#include "annobin.h" ++ ++/* The target specific part of the plugin must prodive the ++ following four functions: ++ ++ annobin_save_target_specific_information - Called during plugin_init() ++ annobin_target_start_symbol_bias - Called during plugin_init() ++ annobin_record_global_target_notes - Called during PLUGIN_START_UNIT ++ annobin_get_target_pointer_size - Called during PLUGIN_START_UNIT ++ annobin_target_specific_function_notes - Called during PLUGIN_ALL_PASSES_START ++ annobin_target_specific_loader_notes - Called during PLUGIN_FINISH_UNIT. */ ++ ++signed int ++annobin_target_start_symbol_bias (void) ++{ ++ return 0; ++} ++ ++unsigned int ++annobin_get_target_pointer_size (void) ++{ ++ return GET_INT_OPTION_BY_NAME (riscv_abi) >= ABI_LP64 ? 64 : 32; ++} ++ ++int ++annobin_save_target_specific_information (void) ++{ ++ return 0; ++} ++ ++void ++annobin_record_global_target_notes (annobin_function_info * info ATTRIBUTE_UNUSED) ++{ ++} ++ ++void ++annobin_target_specific_function_notes (annobin_function_info * info, bool force) ++{ ++} diff --git a/annobin.spec b/annobin.spec index 2d65abb..9d4bff0 100644 --- a/annobin.spec +++ b/annobin.spec @@ -2,7 +2,7 @@ Name: annobin Summary: Annotate and examine compiled binary files Version: 9.49 -Release: 1%{?dist} +Release: 1.0.riscv64%{?dist} License: GPLv3+ # ProtocolURL: https://fedoraproject.org/wiki/Toolchain/Watermark # Maintainer: nickc@redhat.com @@ -56,6 +56,9 @@ Source: https://nickc.fedorapeople.org/annobin-%{version}.tar.xz # Insert patches here, if needed. # Patch01: annobin-xxx.patch +# RISC-V +Patch0: annobin-add-riscv-support.patch + #--------------------------------------------------------------------------------- # [Stolen from gcc-python-plugin] @@ -311,6 +314,9 @@ fi #--------------------------------------------------------------------------------- %changelog +* Wed Apr 14 2021 David Abdurachmanov - 9.49-1.0.riscv64 +- Add support for RISC-V + * Wed Dec 09 2020 Nick Clifton - 9.49-1 - Rebase to 9.49. - annocheck: Fix notes analyzer to accept empty PPC64 notes.