1 Star 0 Fork 26

renping000/binutils

forked from src-anolis-os/binutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
binutils-strip-unknown-relocs.patch 4.00 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:04 . import binutils-2.30-73.el8.src.rpm
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2018-02-27 17:25:53.961140597 +0000
+++ binutils-2.30/bfd/elf32-i386.c 2018-02-27 17:27:14.115133477 +0000
@@ -383,7 +383,7 @@ elf_i386_rtype_to_howto (bfd *abfd, unsi
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- indx = R_386_NONE;
+ return NULL;
}
/* PR 17512: file: 0f67f69d. */
if (elf_howto_table [indx].type != r_type)
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2018-02-27 17:25:53.969140496 +0000
+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-27 17:27:56.213604518 +0000
@@ -2516,9 +2516,10 @@ ppc64_elf_info_to_howto (bfd *abfd, arel
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) type);
- type = R_PPC64_NONE;
+ cache_ptr->howto = NULL;
}
- cache_ptr->howto = ppc64_elf_howto_table[type];
+ else
+ cache_ptr->howto = ppc64_elf_howto_table[type];
}
/* Handle the R_PPC64_ADDR16_HA and similar relocs. */
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2018-02-27 17:25:53.968140509 +0000
+++ binutils-2.30/bfd/elf64-s390.c 2018-02-27 17:28:24.632247443 +0000
@@ -372,9 +372,10 @@ elf_s390_info_to_howto (bfd *abfd ATTRIB
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- r_type = R_390_NONE;
+ cache_ptr->howto = NULL;
}
- cache_ptr->howto = &elf_howto_table[r_type];
+ else
+ cache_ptr->howto = &elf_howto_table[r_type];
}
}
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
--- binutils.orig/bfd/elf64-x86-64.c 2018-02-27 17:25:53.964140559 +0000
+++ binutils-2.30/bfd/elf64-x86-64.c 2018-02-27 17:29:12.554645307 +0000
@@ -284,7 +284,7 @@ elf_x86_64_rtype_to_howto (bfd *abfd, un
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- r_type = R_X86_64_NONE;
+ return NULL;
}
i = r_type;
}
@@ -347,8 +347,6 @@ elf_x86_64_info_to_howto (bfd *abfd ATTR
&& r_type != (unsigned int) R_X86_64_GNU_VTENTRY)
r_type &= ~R_X86_64_converted_reloc_bit;
cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type);
-
- BFD_ASSERT (r_type == cache_ptr->howto->type || cache_ptr->howto->type == R_X86_64_NONE);
}
/* Support for core dump NOTE sections. */
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2018-02-27 17:25:53.964140559 +0000
+++ binutils-2.30/bfd/elfcode.h 2018-02-27 17:26:57.234345581 +0000
@@ -1474,6 +1474,12 @@ elf_slurp_reloc_table_from_section (bfd
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
else
(*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
+
+ if (relent->howto == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
}
if (allocated != NULL)
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2018-02-27 17:25:53.185150347 +0000
+++ binutils-2.30/binutils/objcopy.c 2018-02-27 17:30:05.806976202 +0000
@@ -3022,10 +3022,19 @@ copy_object (bfd *ibfd, bfd *obfd, const
haven't been set yet. mark_symbols_used_in_relocations will
ignore input sections which have no corresponding output
section. */
+ bfd_set_error (bfd_error_no_error);
if (strip_symbols != STRIP_ALL)
- bfd_map_over_sections (ibfd,
- mark_symbols_used_in_relocations,
- isympp);
+ {
+ bfd_map_over_sections (ibfd,
+ mark_symbols_used_in_relocations,
+ isympp);
+ if (bfd_get_error () != bfd_error_no_error)
+ {
+ status = 1;
+ return FALSE;
+ }
+ }
+
osympp = (asymbol **) xmalloc ((symcount + add_symbols + 1) * sizeof (asymbol *));
symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/renping000/binutils.git
git@gitee.com:renping000/binutils.git
renping000
binutils
binutils
a8

搜索帮助