aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-rs6000.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-08-21 11:54:29 +0930
committerAlan Modra <amodra@gmail.com>2018-08-21 14:59:53 +0930
commit706704c88344314646e4edcc0840cb18a9cb4c82 (patch)
treeae2cd087b3be38471edaa968d45fccaf026fa886 /bfd/coff-rs6000.c
parent487096bf0bd5499b1d23ecbe5fd64f9f0079c0b5 (diff)
downloadgdb-706704c88344314646e4edcc0840cb18a9cb4c82.zip
gdb-706704c88344314646e4edcc0840cb18a9cb4c82.tar.gz
gdb-706704c88344314646e4edcc0840cb18a9cb4c82.tar.bz2
Pack reloc_howto_struct
This patch uses bitfields in reloc_howto_struct, reducing its size from 80 to 40 bytes on 64-bit hosts and from 52 to 32 bytes on 32-bit hosts (with a 32-bit bfd_vma). I've also added a new "negate" field rather than making the encoded "size" field do double duty as both a size and a flag. There was just one use of an encoded size of 8, which according to bfd_get_reloc_size meant 16 bytes, in vms-alpha.c ALPHA_R_LINKAGE. See git commit c3d8e071bf adding ALPHA_R_LINKAGE and git commit 8612a388f7 decoding size 8 in bfd_get_reloc_size. Since no other part of BFD handles 16 byte relocs, I've removed that encoding and special cased the ALPHA_R_LINKAGE size in vms-alpha.c. * reloc.c (reloc_howto_type): Typedef. (bfd_symbol): Delete forward declaration. (struct reloc_howto_struct): Add "negate" field. Make "size", "bitsize", "rightshift", "bitpos", "complain_on_overflow", "pc_relative", "partial_inplace", and "pcrel_offset" bitfields. Rearrange for better packing. Revise comments. (HOWTO): Map to rearranged reloc_howto_struct. (bfd_get_reloc_size): Delete now unused cases. (read_reloc, write_reloc): Likewise. (apply_reloc, _bfd_relocate_contents): Test howto->negate rather than howto->size < 0 for negated relocation values. * coff-rs6000.c (xcoff_complain_overflow_bitfield_func): Avoid signed/unsigned warning. (xcoff_ppc_relocate_section): Delete "condition is always false" code. * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise. * cpu-ns32k.c (do_ns32k_reloc): Adjust to suit reloc_howto_struct changes. * vms-alpha.c (_bfd_vms_write_etir, alpha_vms_slurp_relocs): Use size 16 for ALPHA_R_LINKAGE. (alpha_howto_table <ALPHA_R_LINKAGE>): Set encoded size and bitsize to zero. * bfd-in.h (reloc_howto_type): Delete. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/coff-rs6000.c')
-rw-r--r--bfd/coff-rs6000.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index ab282df..edff50d 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -3090,7 +3090,7 @@ xcoff_complain_overflow_bitfield_func (bfd *input_bfd,
relies on it, and it is the only way to write assembler
code which can run when loaded at a location 0x80000000
away from the location at which it is linked. */
- if (howto->bitsize + howto->rightshift
+ if ((unsigned) howto->bitsize + howto->rightshift
== bfd_arch_bits_per_address (input_bfd))
return FALSE;
@@ -3458,10 +3458,6 @@ xcoff_ppc_relocate_section (bfd *output_bfd,
operation, which would be tedious, or we must do the computations
in a type larger than bfd_vma, which would be inefficient. */
- if ((unsigned int) howto.complain_on_overflow
- >= XCOFF_MAX_COMPLAIN_OVERFLOW)
- abort ();
-
if (((*xcoff_complain_overflow[howto.complain_on_overflow])
(input_bfd, value_to_relocate, relocation, &howto)))
{