diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-05-03 13:25:12 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-05-03 13:25:12 +0200 |
commit | 4c398cc06d333fcb04772c04ea18db68587e8a1f (patch) | |
tree | e8f0dcc93460fdf17621e9d37ed13ec6beb9bff2 /bfd/elf32-i386.c | |
parent | d389a1a7692d247b6153fc6a98ebc43d7070fc2e (diff) | |
download | gdb-4c398cc06d333fcb04772c04ea18db68587e8a1f.zip gdb-4c398cc06d333fcb04772c04ea18db68587e8a1f.tar.gz gdb-4c398cc06d333fcb04772c04ea18db68587e8a1f.tar.bz2 |
x86: don't request useless overflow checking
Relocations with a bitsize matching the architecture's address width
can't usefully use an overflow checking approach other than "dont" or
"signed": All others involve perhaps complex calculations in
_bfd_relocate_contents() (or, not as severe, in bfd_check_overflow())
without ever finding anything to complain about - because of the address
width masking applied. Avoid this unnecessary overhead and switch all
such reloc types to "dont".
Note that "signed" checking with rela relocations (i.e. x86-64 here) is
only going to be useful if the addend actually got passed to
_bfd_relocate_contents() (and maybe others) instead of bogusly adding in
prior section contents (which apparently is assumed to be zero, and
hence again no overflow would ever be detected). See
https://sourceware.org/pipermail/binutils/2021-April/116164.html.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ffe7644..4451f9b 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -33,34 +33,34 @@ static reloc_howto_type elf_howto_table[]= HOWTO(R_386_NONE, 0, 3, 0, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_NONE", true, 0x00000000, 0x00000000, false), - HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield, + HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_PC32", true, 0xffffffff, 0xffffffff, true), - HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_GOT32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield, + HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_PLT32", true, 0xffffffff, 0xffffffff, true), - HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_COPY", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_GLOB_DAT", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_JUMP_SLOT", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_RELATIVE", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_GOTOFF", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield, + HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_GOTPC", true, 0xffffffff, 0xffffffff, true), @@ -72,22 +72,22 @@ static reloc_howto_type elf_howto_table[]= #define R_386_ext_offset (R_386_TLS_TPOFF - R_386_standard) /* These relocs are a GNU extension. */ - HOWTO(R_386_TLS_TPOFF, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_TPOFF, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_TPOFF", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_IE, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_IE, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_IE", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_GOTIE, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_GOTIE, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_GOTIE", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_LE", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_GD, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_GD, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_GD", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_LDM, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_LDM, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_LDM", true, 0xffffffff, 0xffffffff, false), HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield, @@ -106,40 +106,40 @@ static reloc_howto_type elf_howto_table[]= #define R_386_ext (R_386_PC8 + 1 - R_386_ext_offset) #define R_386_tls_offset (R_386_TLS_LDO_32 - R_386_ext) /* These are common with Solaris TLS implementation. */ - HOWTO(R_386_TLS_LDO_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_LDO_32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_LDO_32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_IE_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_IE_32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_IE_32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_LE_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_LE_32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_LE_32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_DTPMOD32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_DTPOFF32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_TPOFF32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_SIZE32, 0, 2, 32, false, 0, complain_overflow_unsigned, + HOWTO(R_386_SIZE32, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_SIZE32", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_TLS_GOTDESC, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_GOTDESC, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_GOTDESC", true, 0xffffffff, 0xffffffff, false), HOWTO(R_386_TLS_DESC_CALL, 0, 3, 0, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_DESC_CALL", false, 0, 0, false), - HOWTO(R_386_TLS_DESC, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_TLS_DESC, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_TLS_DESC", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_IRELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_IRELATIVE, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_IRELATIVE", true, 0xffffffff, 0xffffffff, false), - HOWTO(R_386_GOT32X, 0, 2, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_386_GOT32X, 0, 2, 32, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_386_GOT32X", true, 0xffffffff, 0xffffffff, false), |