diff --git a/annobin-Add-LoongArch-support.patch b/annobin-Add-LoongArch-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..d7a5dec4fd3c824f78448997cd6adc986e63cdbb --- /dev/null +++ b/annobin-Add-LoongArch-support.patch @@ -0,0 +1,179 @@ +From 81d06a904ac6eeebdc6d11b1a5cc215e52b0ac20 Mon Sep 17 00:00:00 2001 +From: Lixing +Date: Wed, 2 Aug 2023 11:35:41 +0800 +Subject: [PATCH] annobin: Add LoongArch support + +--- + configure | 3 ++ + configure.ac | 3 ++ + gcc-plugin/Makefile.am | 2 +- + gcc-plugin/Makefile.in | 2 +- + gcc-plugin/configure | 3 ++ + gcc-plugin/configure.ac | 3 ++ + gcc-plugin/loongarch64.annobin.cc | 58 +++++++++++++++++++++++++++++++ + gcc-plugin/meson.build | 2 ++ + 8 files changed, 74 insertions(+), 2 deletions(-) + create mode 100644 gcc-plugin/loongarch64.annobin.cc + +diff --git a/configure b/configure +index 9415d38..766e753 100755 +--- a/configure ++++ b/configure +@@ -17821,6 +17821,9 @@ case ${target} in + i*86-*-*) + target_plugin="i686.annobin.lo" + ;; ++ loongarch64*-*-*) ++ target_plugin="loongarch64.annobin.lo" ++ ;; + powerpc*-*-*) + target_plugin="powerpc.annobin.lo" + ;; +diff --git a/configure.ac b/configure.ac +index 108cdf5..d8332bb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -39,6 +39,9 @@ case ${target} in + i*86-*-*) + target_plugin="i686.annobin.lo" + ;; ++ loongarch64*-*-*) ++ target_plugin="loongarch64.annobin.lo" ++ ;; + powerpc*-*-*) + target_plugin="powerpc.annobin.lo" + ;; +diff --git a/gcc-plugin/Makefile.am b/gcc-plugin/Makefile.am +index 4ee6e5f..87039db 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 arm.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc ++EXTRA_annobin_la_SOURCES = aarch64.annobin.cc arm.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc loongarch64.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 f0368e7..2bc64af 100644 +--- a/gcc-plugin/Makefile.in ++++ b/gcc-plugin/Makefile.in +@@ -354,7 +354,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 arm.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc ++EXTRA_annobin_la_SOURCES = aarch64.annobin.cc arm.annobin.cc dummy.annobin.cc powerpc.annobin.cc s390.annobin.cc x86_64.annobin.cc i686.annobin.cc riscv.annobin.cc loongarch64.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 a5fe7a0..ddbb912 100755 +--- a/gcc-plugin/configure ++++ b/gcc-plugin/configure +@@ -5158,6 +5158,9 @@ case ${target} in + i*86*-*-*) + target_plugin="i686.annobin.lo" + ;; ++ loongarch64*-*-*) ++ target_plugin="loongarch64.annobin.lo" ++ ;; + powerpc*-*-*) + target_plugin="powerpc.annobin.lo" + ;; +diff --git a/gcc-plugin/configure.ac b/gcc-plugin/configure.ac +index 6d51a3e..9256b54 100644 +--- a/gcc-plugin/configure.ac ++++ b/gcc-plugin/configure.ac +@@ -66,6 +66,9 @@ case ${target} in + i*86*-*-*) + target_plugin="i686.annobin.lo" + ;; ++ loongarch64*-*-*) ++ target_plugin="loongarch64.annobin.lo" ++ ;; + powerpc*-*-*) + target_plugin="powerpc.annobin.lo" + ;; +diff --git a/gcc-plugin/loongarch64.annobin.cc b/gcc-plugin/loongarch64.annobin.cc +new file mode 100644 +index 0000000..c5f32d8 +--- /dev/null ++++ b/gcc-plugin/loongarch64.annobin.cc +@@ -0,0 +1,58 @@ ++/* dummy.annobin - Empty target specific parts of the annobin plugin. ++ Copyright (c) 2019-2021 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) ++{ ++#if defined(__loongarch64) ++ return 64; ++#else ++ return 32; ++#endif ++} ++ ++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/gcc-plugin/meson.build b/gcc-plugin/meson.build +index 4a54107..6d5b3db 100644 +--- a/gcc-plugin/meson.build ++++ b/gcc-plugin/meson.build +@@ -34,6 +34,8 @@ if target == 'aarch64' + target_plugin = 'aarch64.annobin.cc' + elif target.startswith('arm') + target_plugin = 'arm.annobin.cc' ++elif target.startswith('loongarch64') ++ target_plugin = 'loongarch64.annobin.cc' + elif target.startswith('ppc') + target_plugin = 'powerpc.annobin.cc' + elif target.startswith('riscv64') +-- +2.39.3 + diff --git a/annobin.spec b/annobin.spec index 2bdce12c22ae3a879c84b80d25f8761bbbdf22a5..8157b5a0478c8939f8ea5cbf57176b5a6500f42f 100644 --- a/annobin.spec +++ b/annobin.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 Name: annobin Summary: Annotate and examine compiled binary files Version: 10.94 @@ -9,7 +9,6 @@ License: GPLv3+ # Watermark Protocol: https://fedoraproject.org/wiki/Toolchain/Watermark #--------------------------------------------------------------------------------- -Excludearch: loongarch64 # Use "--without tests" to disable the testsuite. %bcond_without tests @@ -66,6 +65,7 @@ Source: https://nickc.fedorapeople.org/%{annobin_sources} # Insert patches here, if needed. Patch01: annobin-nop.patch Patch02: annobin-annocheck-no-debuginfod.patch +Patch03: annobin-Add-LoongArch-support.patch #--------------------------------------------------------------------------------- @@ -265,6 +265,8 @@ export LDFLAGS="$LDFLAGS %build_ldflags" export CFLAGS="$CFLAGS -DAARCH64_BRANCH_PROTECTION_SUPPORTED=1" %endif +%_update_config_guess +%_update_config_sub CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CXXFLAGS="$CFLAGS" %configure ${CONFIG_ARGS} || cat config.log %ifarch %{ix86} x86_64 @@ -391,6 +393,9 @@ fi #--------------------------------------------------------------------------------- %changelog +* Wed Aug 02 2023 lixing - 10.94-1.0.2 +- Enable loongarch64 Support(Lixing) + * Thu Jun 01 2023 Liwei Ge - 10.94-1.0.1 - Parse Anolis GCC version - Remove loongarch64 arch (Zhao Hang)