aboutsummaryrefslogtreecommitdiff
path: root/bfd/vms-alpha.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/vms-alpha.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/vms-alpha.c')
-rw-r--r--bfd/vms-alpha.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index fc45260..8f22a31 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -4001,6 +4001,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
break;
case ALPHA_R_LINKAGE:
+ size = 16;
etir_output_check (abfd, section, curr_addr, 64);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_LP_PSB);
_bfd_vms_output_long
@@ -5157,6 +5158,7 @@ alpha_vms_slurp_relocs (bfd *abfd)
asection *sec;
struct vms_section_data_struct *vms_sec;
arelent *reloc;
+ bfd_size_type size;
/* Get section to which the relocation applies. */
if (cur_psect < 0 || cur_psect > (int)PRIV (section_count))
@@ -5237,7 +5239,11 @@ alpha_vms_slurp_relocs (bfd *abfd)
reloc->address = cur_address;
reloc->addend = cur_addend;
- vaddr += bfd_get_reloc_size (reloc->howto);
+ if (reloc_code == ALPHA_R_LINKAGE)
+ size = 16;
+ else
+ size = bfd_get_reloc_size (reloc->howto);
+ vaddr += size;
}
cur_addend = 0;
@@ -5496,8 +5502,8 @@ static reloc_howto_type alpha_howto_table[] =
/* Hack. Linkage is done by linker. */
HOWTO (ALPHA_R_LINKAGE, /* Type. */
0, /* Rightshift. */
- 8, /* Size (0 = byte, 1 = short, 2 = long). */
- 256, /* Bitsize. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */