Blame SOURCES/gdb-rhbz795424-bitpos-23of25.patch

190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Fedora GDB patches <invalid@email.com>
190f2a
Date: Fri, 27 Oct 2017 21:07:50 +0200
190f2a
Subject: gdb-rhbz795424-bitpos-23of25.patch
190f2a
190f2a
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
190f2a
;; (RH BZ 795424).
190f2a
;;=push
190f2a
190f2a
http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html
190f2a
190f2a
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
190f2a
Content-Type: text/plain; charset=US-ASCII
190f2a
Content-Transfer-Encoding: 7bit
190f2a
Content-Disposition: inline
190f2a
190f2a
Hi,
190f2a
190f2a
This is the last part of the bitpos change.  This patch does the same
190f2a
thing that patch 1/4 does, except that it does so in the *-tdep files
190f2a
wherever necessary.  I separated these changes mainly because they are
190f2a
related and can be reviewed independently.  Tested on Fedora 16 x86_64.
190f2a
190f2a
Regards,
190f2a
Siddhesh
190f2a
190f2a
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
190f2a
Content-Type: text/plain
190f2a
Content-Transfer-Encoding: quoted-printable
190f2a
Content-Disposition: attachment; filename=ChangeLog-tdep
190f2a
190f2a
gdb/ChangeLog
190f2a
190f2a
	* alpha-tdep.c (alpha_push_dummy_call): Expand ACCUMULATE_SIZE,
190f2a
	REQUIRED_ARG_REGS, OFFSET, LEN, TLEN to ssize_t.
190f2a
	(struct alpha_arg): Expand members LEN, OFFSET to ssize_t.
190f2a
	* amd64-tdep.c (amd64_push_arguments): Expand NUM_ELEMENTS,
190f2a
	ELEMENT and LEN to LONGEST.
190f2a
	(amd64_return_value): Expand LEN to LONGEST.
190f2a
	* amd64-windows-tdep.c (amd64_windows_return_value): Expand LEN
190f2a
	to LONGEST.
190f2a
	* arm-tdep.c (arm_vfp_cprc_sub_candidate): Return LONGEST.
190f2a
	Expand COUNT, SUB_COUNT to LONGEST.
190f2a
	(arm_vfp_call_candidate): Expand C to LONGEST.
190f2a
	(arm_push_dummy_call): Expand LEN to LONGEST.
190f2a
	* avr-tdep.c (struct stack_item): Expand member LEN to ssize_t.
190f2a
	(push_stack_item): Expand parameter LEN to ssize_t.
190f2a
	(avr_push_dummy_call): Expand LAST_REGNUM, J, LEN to ssize_t.
190f2a
	* bfin-tdep.c (bfin_push_dummy_call): Expand TOTAL_LEN,
190f2a
	CONTAINER_LEN to ssize_t.
190f2a
	* cris-tdep.c (struct stack_item): Expand member LEN to ssize_t.
190f2a
	(push_stack_item): Expand parameter LEN to ssize_t.
190f2a
	(cris_push_dummy_call): Expand LEN, REG_DEMAND, I to ssize_t.
190f2a
	* h8300-tdep.c (h8300_push_dummy_call): Expand STACK_ALLOC,
190f2a
	STACK_OFFSET to LONGEST.  Expand LEN, PADDED_LEN, OFFSET to
190f2a
	ssize_t.
190f2a
	* hppa-tdep.c (hppa64_push_dummy_call): Expand LEN to LONGEST.
190f2a
	(hppa64_return_value): Likewise.
190f2a
	* i386-darwin-tdep.c (i386_darwin_push_dummy_call): Expand
190f2a
	ARGS_SPACE to LONGEST.
190f2a
	* i386-tdep.c (i386_push_dummy_call): Expand ARG_SPACE,
190f2a
	ARG_SPACE_USED, LEN to LONGEST.
190f2a
	(i386_reg_struct_return_p): Expand LEN to LONGEST.
190f2a
	(i386_convert_register_p): Likewise.
190f2a
	(i386_register_to_value): Likewise.
190f2a
	(i386_value_to_register): Likewise.
190f2a
	* ia64-tdep.c (ia64_push_dummy_call): Expand ARGOFFSET, LEN,
190f2a
	NSLOTS, MEMSLOTS to LONGEST.
190f2a
	* iq2000-tdep.c (iq2000_push_dummy_call): Expand TYPELEN,
190f2a
	STACKSPACE to LONGEST.
190f2a
	* m32r-tdep.c (m32r_push_dummy_call): Expand LEN to LONGEST.
190f2a
	* m68k-tdep.c (m68k_reg_struct_return_p): Expand LEN to LONGEST.
190f2a
	(m68k_push_dummy_call): Expand LEN, CONTAINER_LEN, OFFSET to
190f2a
	LONGEST.
190f2a
	* m88k-tdep.c (m88k_store_arguments): Expand NUM_STACK_WORDS,
190f2a
	LEN, STACK_WORD to LONGEST.
190f2a
	* mep-tdep.c (push_large_arguments): Expand ARG_LEN to ULONGEST.
190f2a
	* microblaze-tdep.c (microblaze_store_return_value): Expand LEN to
190f2a
	LONGEST.
190f2a
	* mips-tdep.c (mips_xfer_register): Expand parameter BUF_OFFSET to
190f2a
	LONGEST.  Use plongest to format print BUF_OFFSET.
190f2a
	(mips_eabi_push_dummy_call): Expand LEN to LONGEST.  Use plongest
190f2a
	to format print LEN.
190f2a
	(mips_n32n64_fp_arg_chunk_p): Expand parameter OFFSET to LONGEST.
190f2a
	Expand POS to LONGEST.
190f2a
	(mips_n32n64_push_dummy_call): Expand LEN to LONGEST.
190f2a
	(mips_n32n64_return_value): Expand OFFSET to LONGEST.  Use
190f2a
	plongest to format print OFFSET.
190f2a
	(mips_o32_push_dummy_call): Expand LEN to LONGEST.  Use plongest
190f2a
	to format print LEN.
190f2a
	(mips_o64_push_dummy_call): Expand LEN, STACK_OFFSET to LONGEST.
190f2a
	Use plongest to format print LEN.
190f2a
	* mn10300-tdep.c (mn10300_push_dummy_call): Expand LEN to
190f2a
	LONGEST.
190f2a
	* mt-tdep.c (mt_push_dummy_call): Expand STACK_DEST, TYPELEN to
190f2a
	LONGEST.
190f2a
	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Expand
190f2a
	ARGSPACE, ARGOFFSET, STRUCTOFFSET, LEN, to LONGEST.
190f2a
	(ppc64_sysv_abi_push_dummy_call): Expand BYTE, LEN to ssize_t.
190f2a
	* rl78-tdep.c (rl78_push_dummy_call): Expand LEN, CONTAINER_LEN
190f2a
	to LONGEST.
190f2a
	* rs6000-aix-tdep.c (rs6000_push_dummy_call): Expand ARGBYTES,
190f2a
	LEN to LONGEST.
190f2a
	(ran_out_of_registers_for_arguments): Expand SPACE, JJ to
190f2a
	LONGEST.
190f2a
	* s390-linux-tdep.c (s390_value_from_register): Expand LEN to LONGEST.
190f2a
	(is_power_of_two): Expand parameter N to ULONGEST.
190f2a
	(s390_push_dummy_call): Expand LENGTH to ULONGEST.
190f2a
	* score-tdep.c (score_push_dummy_call): Expand ARGLEN to
190f2a
	LONGEST.
190f2a
	* sh-tdep.c (sh_use_struct_convention) Expand len to LONGEST.
190f2a
	(sh_justify_value_in_reg): Expand parameter LEN to LONGEST.
190f2a
	(sh_push_dummy_call_fpu): Expand LEN to LONGEST.  Expand REG_SIZE
190f2a
	to ssize_t.
190f2a
	(sh_push_dummy_call_nofpu): Likewise.
190f2a
	* sh64-tdep.c (sh64_push_dummy_call): Expand STACK_OFFSET,
190f2a
	STACK_ALLOC, LEN to LONGEST.
190f2a
	* sparc-tdep.c (sparc32_store_arguments): Expand LEN to LONGEST.
190f2a
	* sparc64-tdep.c (sparc64_store_floating_fields): Expand
190f2a
	parameter BITPOS to LONGEST.  Expand SUBPOS to LONGEST.
190f2a
	(sparc64_extract_floating_fields): Likewise.
190f2a
	(sparc64_store_arguments): Expand LEN to LONGEST.
190f2a
	* spu-tdep.c (spu_push_dummy_call): Expand N_REGS, LEN to LONGEST.
190f2a
	(spu_value_from_register): Expand LEN to LONGEST.
190f2a
	* tic6x-tdep.c (tic6x_push_dummy_call): Expand REFERENCES_OFFST,
190f2a
	LEN to LONGEST.  Expand LEN to ssize_t.  Use plongest to format
190f2a
	print LEN.
190f2a
	* tilegx-tdep.c (tilegx_push_dummy_call): Expand TYPELEN,
190f2a
	SLACKLEN, ALIGNLEN to LONGEST.
190f2a
	* v850-tdep.c (v850_push_dummy_call): Expand LEN to LONGEST.
190f2a
	* vax-tdep.c (vax_store_arguments): Expand COUNT, LEN to LONGEST.
190f2a
	(vax_return_value): Expand LEN to LONGEST.
190f2a
	* xstormy16-tdep.c (xstormy16_push_dummy_call): Expand J, TYPELEN
190f2a
	to LONGEST.
190f2a
	* xtensa-tdep.c (xtensa_store_return_value): Print LEN instead of
190f2a
	TYPE_LENGTH..
190f2a
	(struct argument_info): Expoand member LENGTH to ssize_t.
190f2a
	(struct argument_info.u): Expand member OFFSET to ssize_t.
190f2a
	(xtensa_push_dummy_call): Expand SIZE, ONSTACK_SIZE to LONGEST.
190f2a
	Expand N to ssize_t.  Use pulongest to format print TYPE_LENGTH.
190f2a
190f2a
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
190f2a
Content-Type: text/x-patch
190f2a
Content-Transfer-Encoding: 7bit
190f2a
Content-Disposition: attachment; filename=bitpos-tdep.patch
190f2a
190f2a
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
190f2a
--- a/gdb/alpha-tdep.c
190f2a
+++ b/gdb/alpha-tdep.c
190f2a
@@ -299,17 +299,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 {
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int i;
190f2a
-  int accumulate_size = struct_return ? 8 : 0;
190f2a
+  ssize_t accumulate_size = struct_return ? 8 : 0;
190f2a
   struct alpha_arg
190f2a
     {
190f2a
       const gdb_byte *contents;
190f2a
-      int len;
190f2a
-      int offset;
190f2a
+      ssize_t len;
190f2a
+      ssize_t offset;
190f2a
     };
190f2a
   struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
190f2a
   struct alpha_arg *m_arg;
190f2a
   gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
190f2a
-  int required_arg_regs;
190f2a
+  ssize_t required_arg_regs;
190f2a
   CORE_ADDR func_addr = find_function_addr (function, NULL);
190f2a
 
190f2a
   /* The ABI places the address of the called function in T12.  */
190f2a
@@ -429,8 +429,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   for (i = nargs; m_arg--, --i >= 0;)
190f2a
     {
190f2a
       const gdb_byte *contents = m_arg->contents;
190f2a
-      int offset = m_arg->offset;
190f2a
-      int len = m_arg->len;
190f2a
+      ssize_t offset = m_arg->offset;
190f2a
+      ssize_t len = m_arg->len;
190f2a
 
190f2a
       /* Copy the bytes destined for registers into arg_reg_buffer.  */
190f2a
       if (offset < sizeof(arg_reg_buffer))
190f2a
@@ -442,7 +442,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 	    }
190f2a
 	  else
190f2a
 	    {
190f2a
-	      int tlen = sizeof(arg_reg_buffer) - offset;
190f2a
+	      ssize_t tlen = sizeof(arg_reg_buffer) - offset;
190f2a
 	      memcpy (arg_reg_buffer + offset, contents, tlen);
190f2a
 	      offset += tlen;
190f2a
 	      contents += tlen;
190f2a
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
190f2a
--- a/gdb/amd64-tdep.c
190f2a
+++ b/gdb/amd64-tdep.c
190f2a
@@ -878,8 +878,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
190f2a
   };
190f2a
   struct value **stack_args = XALLOCAVEC (struct value *, nargs);
190f2a
   int num_stack_args = 0;
190f2a
-  int num_elements = 0;
190f2a
-  int element = 0;
190f2a
+  LONGEST num_elements = 0;
190f2a
+  LONGEST element = 0;
190f2a
   int integer_reg = 0;
190f2a
   int sse_reg = 0;
190f2a
   int i;
190f2a
@@ -891,7 +891,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
190f2a
   for (i = 0; i < nargs; i++)
190f2a
     {
190f2a
       struct type *type = value_type (args[i]);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      LONGEST len = TYPE_LENGTH (type);
190f2a
       enum amd64_reg_class theclass[2];
190f2a
       int needed_integer_regs = 0;
190f2a
       int needed_sse_regs = 0;
190f2a
@@ -955,7 +955,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
190f2a
 
190f2a
 	      gdb_assert (regnum != -1);
190f2a
 	      memset (buf, 0, sizeof buf);
190f2a
-	      memcpy (buf, valbuf + j * 8, std::min (len, 8));
190f2a
+	      memcpy (buf, valbuf + j * 8, std::min (len, (LONGEST) 8));
190f2a
 	      regcache->raw_write_part (regnum, offset, 8, buf);
190f2a
 	    }
190f2a
 	}
190f2a
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
190f2a
--- a/gdb/amd64-windows-tdep.c
190f2a
+++ b/gdb/amd64-windows-tdep.c
190f2a
@@ -291,7 +291,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
 			    struct type *type, struct regcache *regcache,
190f2a
 			    gdb_byte *readbuf, const gdb_byte *writebuf)
190f2a
 {
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
   int regnum = -1;
190f2a
 
190f2a
   /* See if our value is returned through a register.  If it is, then
190f2a
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
190f2a
--- a/gdb/arm-tdep.c
190f2a
+++ b/gdb/arm-tdep.c
190f2a
@@ -3468,7 +3468,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
190f2a
    array).  Vector types are not currently supported, matching the
190f2a
    generic AAPCS support.  */
190f2a
 
190f2a
-static int
190f2a
+static LONGEST
190f2a
 arm_vfp_cprc_sub_candidate (struct type *t,
190f2a
 			    enum arm_vfp_cprc_base_type *base_type)
190f2a
 {
190f2a
@@ -3551,7 +3551,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
190f2a
 	  }
190f2a
 	else
190f2a
 	  {
190f2a
-	    int count;
190f2a
+	    LONGEST count;
190f2a
 	    unsigned unitlen;
190f2a
 
190f2a
 	    count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
190f2a
@@ -3574,12 +3574,12 @@ arm_vfp_cprc_sub_candidate (struct type *t,
190f2a
 
190f2a
     case TYPE_CODE_STRUCT:
190f2a
       {
190f2a
-	int count = 0;
190f2a
+	LONGEST count = 0;
190f2a
 	unsigned unitlen;
190f2a
 	int i;
190f2a
 	for (i = 0; i < TYPE_NFIELDS (t); i++)
190f2a
 	  {
190f2a
-	    int sub_count = 0;
190f2a
+	    LONGEST sub_count = 0;
190f2a
 
190f2a
 	    if (!field_is_static (&TYPE_FIELD (t, i)))
190f2a
 	      sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
190f2a
@@ -3603,13 +3603,15 @@ arm_vfp_cprc_sub_candidate (struct type *t,
190f2a
 
190f2a
     case TYPE_CODE_UNION:
190f2a
       {
190f2a
-	int count = 0;
190f2a
+	LONGEST count = 0;
190f2a
 	unsigned unitlen;
190f2a
 	int i;
190f2a
 	for (i = 0; i < TYPE_NFIELDS (t); i++)
190f2a
 	  {
190f2a
-	    int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
190f2a
-							base_type);
190f2a
+	    LONGEST sub_count;
190f2a
+
190f2a
+	    sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
190f2a
+						    base_type);
190f2a
 	    if (sub_count == -1)
190f2a
 	      return -1;
190f2a
 	    count = (count > sub_count ? count : sub_count);
190f2a
@@ -3645,7 +3647,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
190f2a
 			int *count)
190f2a
 {
190f2a
   enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN;
190f2a
-  int c = arm_vfp_cprc_sub_candidate (t, &b);
190f2a
+  LONGEST c = arm_vfp_cprc_sub_candidate (t, &b);
190f2a
   if (c <= 0 || c > 4)
190f2a
     return 0;
190f2a
   *base_type = b;
190f2a
@@ -3726,7 +3728,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
   for (argnum = 0; argnum < nargs; argnum++)
190f2a
     {
190f2a
-      int len;
190f2a
+      LONGEST len;
190f2a
       struct type *arg_type;
190f2a
       struct type *target_type;
190f2a
       enum type_code typecode;
190f2a
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
190f2a
--- a/gdb/avr-tdep.c
190f2a
+++ b/gdb/avr-tdep.c
190f2a
@@ -1192,13 +1192,13 @@ avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
190f2a
 
190f2a
 struct stack_item
190f2a
 {
190f2a
-  int len;
190f2a
+  ssize_t len;
190f2a
   struct stack_item *prev;
190f2a
   gdb_byte *data;
190f2a
 };
190f2a
 
190f2a
 static struct stack_item *
190f2a
-push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
190f2a
+push_stack_item (struct stack_item *prev, const bfd_byte *contents, ssize_t len)
190f2a
 {
190f2a
   struct stack_item *si;
190f2a
   si = XNEW (struct stack_item);
190f2a
@@ -1286,12 +1286,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
   for (i = 0; i < nargs; i++)
190f2a
     {
190f2a
-      int last_regnum;
190f2a
-      int j;
190f2a
+      ssize_t last_regnum;
190f2a
+      ssize_t j;
190f2a
       struct value *arg = args[i];
190f2a
       struct type *type = check_typedef (value_type (arg));
190f2a
       const bfd_byte *contents = value_contents (arg);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      ssize_t len = TYPE_LENGTH (type);
190f2a
 
190f2a
       /* Calculate the potential last register needed.
190f2a
          E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)
190f2a
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
190f2a
--- a/gdb/bfin-tdep.c
190f2a
+++ b/gdb/bfin-tdep.c
190f2a
@@ -504,7 +504,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int i;
190f2a
   long reg_r0, reg_r1, reg_r2;
190f2a
-  int total_len = 0;
190f2a
+  ssize_t total_len = 0;
190f2a
 
190f2a
   for (i = nargs - 1; i >= 0; i--)
190f2a
     {
190f2a
@@ -526,7 +526,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
190f2a
     {
190f2a
       struct type *value_type = value_enclosing_type (args[i]);
190f2a
       struct type *arg_type = check_typedef (value_type);
190f2a
-      int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
190f2a
+      ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
190f2a
 
190f2a
       sp -= container_len;
190f2a
       write_memory (sp, value_contents (args[i]), container_len);
190f2a
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
190f2a
--- a/gdb/cris-tdep.c
190f2a
+++ b/gdb/cris-tdep.c
190f2a
@@ -663,13 +663,13 @@ static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch,
190f2a
 
190f2a
 struct stack_item
190f2a
 {
190f2a
-  int len;
190f2a
+  ssize_t len;
190f2a
   struct stack_item *prev;
190f2a
   gdb_byte *data;
190f2a
 };
190f2a
 
190f2a
 static struct stack_item *
190f2a
-push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len)
190f2a
+push_stack_item (struct stack_item *prev, const gdb_byte *contents, ssize_t len)
190f2a
 {
190f2a
   struct stack_item *si = XNEW (struct stack_item);
190f2a
   si->data = (gdb_byte *) xmalloc (len);
190f2a
@@ -833,13 +833,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
   for (argnum = 0; argnum < nargs; argnum++)
190f2a
     {
190f2a
-      int len;
190f2a
+      ssize_t len;
190f2a
       const gdb_byte *val;
190f2a
-      int reg_demand;
190f2a
-      int i;
190f2a
+      ssize_t reg_demand;
190f2a
+      ssize_t i;
190f2a
       
190f2a
-      len = TYPE_LENGTH (value_type (args[argnum]));
190f2a
       val = value_contents (args[argnum]);
190f2a
+      len = TYPE_LENGTH (value_type (args[argnum]));
190f2a
       
190f2a
       /* How may registers worth of storage do we need for this argument?  */
190f2a
       reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
190f2a
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
190f2a
--- a/gdb/h8300-tdep.c
190f2a
+++ b/gdb/h8300-tdep.c
190f2a
@@ -637,7 +637,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 		       int struct_return, CORE_ADDR struct_addr)
190f2a
 {
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
-  int stack_alloc = 0, stack_offset = 0;
190f2a
+  LONGEST stack_alloc = 0, stack_offset = 0;
190f2a
   int wordsize = BINWORD (gdbarch);
190f2a
   int reg = E_ARG0_REGNUM;
190f2a
   int argument;
190f2a
@@ -663,11 +663,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   for (argument = 0; argument < nargs; argument++)
190f2a
     {
190f2a
       struct type *type = value_type (args[argument]);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      ssize_t len = TYPE_LENGTH (type);
190f2a
       char *contents = (char *) value_contents (args[argument]);
190f2a
 
190f2a
       /* Pad the argument appropriately.  */
190f2a
-      int padded_len = align_up (len, wordsize);
190f2a
+      ssize_t padded_len = align_up (len, wordsize);
190f2a
       /* Use std::vector here to get zero initialization.  */
190f2a
       std::vector<gdb_byte> padded (padded_len);
190f2a
 
190f2a
@@ -696,7 +696,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 	      /* Heavens to Betsy --- it's really going in registers!
190f2a
 	         Note that on the h8/300s, there are gaps between the
190f2a
 	         registers in the register file.  */
190f2a
-	      int offset;
190f2a
+	      ssize_t offset;
190f2a
 
190f2a
 	      for (offset = 0; offset < padded_len; offset += wordsize)
190f2a
 		{
190f2a
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
190f2a
--- a/gdb/hppa-tdep.c
190f2a
+++ b/gdb/hppa-tdep.c
190f2a
@@ -984,7 +984,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
     {
190f2a
       struct value *arg = args[i];
190f2a
       struct type *type = value_type (arg);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      LONGEST len = TYPE_LENGTH (type);
190f2a
       const bfd_byte *valbuf;
190f2a
       bfd_byte fptrbuf[8];
190f2a
       int regnum;
190f2a
@@ -1177,7 +1177,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
 		     struct type *type, struct regcache *regcache,
190f2a
 		     gdb_byte *readbuf, const gdb_byte *writebuf)
190f2a
 {
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
   int regnum, offset;
190f2a
 
190f2a
   if (len > 16)
190f2a
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
190f2a
--- a/gdb/i386-darwin-tdep.c
190f2a
+++ b/gdb/i386-darwin-tdep.c
190f2a
@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
   for (write_pass = 0; write_pass < 2; write_pass++)
190f2a
     {
190f2a
-      int args_space = 0;
190f2a
+      LONGEST args_space = 0;
190f2a
       int num_m128 = 0;
190f2a
 
190f2a
       if (struct_return)
190f2a
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
190f2a
--- a/gdb/i386-tdep.c
190f2a
+++ b/gdb/i386-tdep.c
190f2a
@@ -2678,7 +2678,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   gdb_byte buf[4];
190f2a
   int i;
190f2a
   int write_pass;
190f2a
-  int args_space = 0;
190f2a
+  LONGEST args_space = 0;
190f2a
 
190f2a
   /* BND registers can be in arbitrary values at the moment of the
190f2a
      inferior call.  This can cause boundary violations that are not
190f2a
@@ -2693,7 +2693,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
   for (write_pass = 0; write_pass < 2; write_pass++)
190f2a
     {
190f2a
-      int args_space_used = 0;
190f2a
+      LONGEST args_space_used = 0;
190f2a
 
190f2a
       if (struct_return)
190f2a
 	{
190f2a
@@ -2710,7 +2710,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
       for (i = 0; i < nargs; i++)
190f2a
 	{
190f2a
-	  int len = TYPE_LENGTH (value_enclosing_type (args[i]));
190f2a
+	  LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i]));
190f2a
 
190f2a
 	  if (write_pass)
190f2a
 	    {
190f2a
@@ -2917,7 +2917,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
190f2a
 {
190f2a
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
190f2a
   enum type_code code = TYPE_CODE (type);
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
   gdb_assert (code == TYPE_CODE_STRUCT
190f2a
               || code == TYPE_CODE_UNION
190f2a
@@ -3703,7 +3703,7 @@ static int
190f2a
 i386_convert_register_p (struct gdbarch *gdbarch,
190f2a
 			 int regnum, struct type *type)
190f2a
 {
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
   /* Values may be spread across multiple registers.  Most debugging
190f2a
      formats aren't expressive enough to specify the locations, so
190f2a
@@ -3736,7 +3736,7 @@ i386_register_to_value (struct frame_info *frame, int regnum,
190f2a
 			int *optimizedp, int *unavailablep)
190f2a
 {
190f2a
   struct gdbarch *gdbarch = get_frame_arch (frame);
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
   if (i386_fp_regnum_p (gdbarch, regnum))
190f2a
     return i387_register_to_value (frame, regnum, type, to,
190f2a
@@ -3772,7 +3772,7 @@ static void
190f2a
 i386_value_to_register (struct frame_info *frame, int regnum,
190f2a
 			struct type *type, const gdb_byte *from)
190f2a
 {
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
   if (i386_fp_regnum_p (get_frame_arch (frame), regnum))
190f2a
     {
190f2a
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
190f2a
--- a/gdb/iq2000-tdep.c
190f2a
+++ b/gdb/iq2000-tdep.c
190f2a
@@ -651,8 +651,9 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   const bfd_byte *val;
190f2a
   bfd_byte buf[4];
190f2a
   struct type *type;
190f2a
-  int i, argreg, typelen, slacklen;
190f2a
-  int stackspace = 0;
190f2a
+  int i, argreg, slacklen;
190f2a
+  LONGEST typelen;
190f2a
+  LONGEST stackspace = 0;
190f2a
   /* Used to copy struct arguments into the stack.  */
190f2a
   CORE_ADDR struct_ptr;
190f2a
 
190f2a
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
190f2a
--- a/gdb/m32r-tdep.c
190f2a
+++ b/gdb/m32r-tdep.c
190f2a
@@ -671,7 +671,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   CORE_ADDR regval;
190f2a
   gdb_byte *val;
190f2a
   gdb_byte valbuf[M32R_ARG_REGISTER_SIZE];
190f2a
-  int len;
190f2a
+  LONGEST len;
190f2a
 
190f2a
   /* First force sp to a 4-byte alignment.  */
190f2a
   sp = sp & ~3;
190f2a
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
190f2a
--- a/gdb/m68k-tdep.c
190f2a
+++ b/gdb/m68k-tdep.c
190f2a
@@ -372,7 +372,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
190f2a
 {
190f2a
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
190f2a
   enum type_code code = TYPE_CODE (type);
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
   gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
190f2a
 	      || code == TYPE_CODE_COMPLEX);
190f2a
@@ -504,9 +504,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   for (i = nargs - 1; i >= 0; i--)
190f2a
     {
190f2a
       struct type *value_type = value_enclosing_type (args[i]);
190f2a
-      int len = TYPE_LENGTH (value_type);
190f2a
-      int container_len = (len + 3) & ~3;
190f2a
-      int offset;
190f2a
+      LONGEST len = TYPE_LENGTH (value_type);
190f2a
+      LONGEST container_len = (len + 3) & ~3;
190f2a
+      LONGEST offset;
190f2a
 
190f2a
       /* Non-scalars bigger than 4 bytes are left aligned, others are
190f2a
 	 right aligned.  */
190f2a
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
190f2a
--- a/gdb/mep-tdep.c
190f2a
+++ b/gdb/mep-tdep.c
190f2a
@@ -2239,7 +2239,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
190f2a
 
190f2a
   for (i = 0; i < argc; i++)
190f2a
     {
190f2a
-      unsigned arg_len = TYPE_LENGTH (value_type (argv[i]));
190f2a
+      ULONGEST arg_len = TYPE_LENGTH (value_type (argv[i]));
190f2a
 
190f2a
       if (arg_len > MEP_GPR_SIZE)
190f2a
         {
190f2a
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
190f2a
--- a/gdb/mips-tdep.c
190f2a
+++ b/gdb/mips-tdep.c
190f2a
@@ -489,7 +489,7 @@ static void
190f2a
 mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
190f2a
 		    int reg_num, int length,
190f2a
 		    enum bfd_endian endian, gdb_byte *in,
190f2a
-		    const gdb_byte *out, int buf_offset)
190f2a
+		    const gdb_byte *out, LONGEST buf_offset)
190f2a
 {
190f2a
   int reg_offset = 0;
190f2a
 
190f2a
@@ -512,8 +512,8 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
190f2a
     }
190f2a
   if (mips_debug)
190f2a
     fprintf_unfiltered (gdb_stderr,
190f2a
-			"xfer $%d, reg offset %d, buf offset %d, length %d, ",
190f2a
-			reg_num, reg_offset, buf_offset, length);
190f2a
+			"xfer $%d, reg offset %d, buf offset %s, length %d, ",
190f2a
+			reg_num, reg_offset, plongest (buf_offset), length);
190f2a
   if (mips_debug && out != NULL)
190f2a
     {
190f2a
       int i;
190f2a
@@ -4543,13 +4543,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
190f2a
       struct value *arg = args[argnum];
190f2a
       struct type *arg_type = check_typedef (value_type (arg));
190f2a
-      int len = TYPE_LENGTH (arg_type);
190f2a
+      LONGEST len = TYPE_LENGTH (arg_type);
190f2a
       enum type_code typecode = TYPE_CODE (arg_type);
190f2a
 
190f2a
       if (mips_debug)
190f2a
 	fprintf_unfiltered (gdb_stdlog,
190f2a
-			    "mips_eabi_push_dummy_call: %d len=%d type=%d",
190f2a
-			    argnum + 1, len, (int) typecode);
190f2a
+			    "mips_eabi_push_dummy_call: %d len=%s type=%d",
190f2a
+			    argnum + 1, plongest (len), (int) typecode);
190f2a
 
190f2a
       /* The EABI passes structures that do not fit in a register by
190f2a
          reference.  */
190f2a
@@ -4819,7 +4819,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
 
190f2a
 static int
190f2a
 mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
190f2a
-			    int offset)
190f2a
+			    LONGEST offset)
190f2a
 {
190f2a
   int i;
190f2a
 
190f2a
@@ -4834,7 +4834,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
190f2a
 
190f2a
   for (i = 0; i < TYPE_NFIELDS (arg_type); i++)
190f2a
     {
190f2a
-      int pos;
190f2a
+      LONGEST pos;
190f2a
       struct type *field_type;
190f2a
 
190f2a
       /* We're only looking at normal fields.  */
190f2a
@@ -4876,7 +4876,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   int argreg;
190f2a
   int float_argreg;
190f2a
   int argnum;
190f2a
-  int len = 0;
190f2a
+  LONGEST len = 0;
190f2a
   int stack_offset = 0;
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   CORE_ADDR func_addr = find_function_addr (function, NULL);
190f2a
@@ -5227,11 +5227,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
 				: MIPS_V0_REGNUM);
190f2a
 	   field < TYPE_NFIELDS (type); field++, regnum += 2)
190f2a
 	{
190f2a
-	  int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
190f2a
-			/ TARGET_CHAR_BIT);
190f2a
+	  LONGEST offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
190f2a
+			    / TARGET_CHAR_BIT);
190f2a
 	  if (mips_debug)
190f2a
-	    fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
190f2a
-				offset);
190f2a
+	    fprintf_unfiltered (gdb_stderr, "Return float struct+%s\n",
190f2a
+				plongest (offset));
190f2a
 	  if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16)
190f2a
 	    {
190f2a
 	      /* A 16-byte long double field goes in two consecutive
190f2a
@@ -5273,8 +5273,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
 	  if (offset + xfer > TYPE_LENGTH (type))
190f2a
 	    xfer = TYPE_LENGTH (type) - offset;
190f2a
 	  if (mips_debug)
190f2a
-	    fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n",
190f2a
-				offset, xfer, regnum);
190f2a
+	    fprintf_unfiltered (gdb_stderr, "Return struct+%s:%d in $%d\n",
190f2a
+				plongest (offset), xfer, regnum);
190f2a
 	  mips_xfer_register (gdbarch, regcache,
190f2a
 			      gdbarch_num_regs (gdbarch) + regnum,
190f2a
 			      xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf,
190f2a
@@ -5332,7 +5332,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   int argreg;
190f2a
   int float_argreg;
190f2a
   int argnum;
190f2a
-  int len = 0;
190f2a
+  LONGEST len = 0;
190f2a
   int stack_offset = 0;
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   CORE_ADDR func_addr = find_function_addr (function, NULL);
190f2a
@@ -5396,13 +5396,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       const gdb_byte *val;
190f2a
       struct value *arg = args[argnum];
190f2a
       struct type *arg_type = check_typedef (value_type (arg));
190f2a
-      int len = TYPE_LENGTH (arg_type);
190f2a
+      LONGEST len = TYPE_LENGTH (arg_type);
190f2a
       enum type_code typecode = TYPE_CODE (arg_type);
190f2a
 
190f2a
       if (mips_debug)
190f2a
 	fprintf_unfiltered (gdb_stdlog,
190f2a
-			    "mips_o32_push_dummy_call: %d len=%d type=%d",
190f2a
-			    argnum + 1, len, (int) typecode);
190f2a
+			    "mips_o32_push_dummy_call: %d len=%s type=%d",
190f2a
+			    argnum + 1, plongest (len), (int) typecode);
190f2a
 
190f2a
       val = value_contents (arg);
190f2a
 
190f2a
@@ -5856,8 +5856,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   int argreg;
190f2a
   int float_argreg;
190f2a
   int argnum;
190f2a
-  int len = 0;
190f2a
-  int stack_offset = 0;
190f2a
+  LONGEST len = 0;
190f2a
+  LONGEST stack_offset = 0;
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   CORE_ADDR func_addr = find_function_addr (function, NULL);
190f2a
 
190f2a
@@ -5917,13 +5917,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       const gdb_byte *val;
190f2a
       struct value *arg = args[argnum];
190f2a
       struct type *arg_type = check_typedef (value_type (arg));
190f2a
-      int len = TYPE_LENGTH (arg_type);
190f2a
+      LONGEST len = TYPE_LENGTH (arg_type);
190f2a
       enum type_code typecode = TYPE_CODE (arg_type);
190f2a
 
190f2a
       if (mips_debug)
190f2a
 	fprintf_unfiltered (gdb_stdlog,
190f2a
-			    "mips_o64_push_dummy_call: %d len=%d type=%d",
190f2a
-			    argnum + 1, len, (int) typecode);
190f2a
+			    "mips_o64_push_dummy_call: %d len=%s type=%d",
190f2a
+			    argnum + 1, plongest (len), (int) typecode);
190f2a
 
190f2a
       val = value_contents (arg);
190f2a
 
190f2a
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
190f2a
--- a/gdb/mn10300-tdep.c
190f2a
+++ b/gdb/mn10300-tdep.c
190f2a
@@ -1197,7 +1197,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   const int push_size = register_size (gdbarch, E_PC_REGNUM);
190f2a
   int regs_used;
190f2a
-  int len, arg_len; 
190f2a
+  LONGEST len, arg_len; 
190f2a
   int stack_offset = 0;
190f2a
   int argnum;
190f2a
   const gdb_byte *val;
190f2a
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
190f2a
--- a/gdb/ppc-sysv-tdep.c
190f2a
+++ b/gdb/ppc-sysv-tdep.c
190f2a
@@ -68,7 +68,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
190f2a
   ULONGEST saved_sp;
190f2a
-  int argspace = 0;		/* 0 is an initial wrong guess.  */
190f2a
+  LONGEST argspace = 0;		/* 0 is an initial wrong guess.  */
190f2a
   int write_pass;
190f2a
 
190f2a
   gdb_assert (tdep->wordsize == 4);
190f2a
@@ -99,9 +99,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       /* Next available vector register for vector arguments.  */
190f2a
       int vreg = 2;
190f2a
       /* Arguments start above the "LR save word" and "Back chain".  */
190f2a
-      int argoffset = 2 * tdep->wordsize;
190f2a
+      LONGEST argoffset = 2 * tdep->wordsize;
190f2a
       /* Structures start after the arguments.  */
190f2a
-      int structoffset = argoffset + argspace;
190f2a
+      LONGEST structoffset = argoffset + argspace;
190f2a
 
190f2a
       /* If the function is returning a `struct', then the first word
190f2a
          (which will be passed in r3) is used for struct return
190f2a
@@ -120,7 +120,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 	{
190f2a
 	  struct value *arg = args[argno];
190f2a
 	  struct type *type = check_typedef (value_type (arg));
190f2a
-	  int len = TYPE_LENGTH (type);
190f2a
+	  ssize_t len = TYPE_LENGTH (type);
190f2a
 	  const bfd_byte *val = value_contents (arg);
190f2a
 
190f2a
 	  if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8
190f2a
@@ -1246,11 +1246,11 @@ struct ppc64_sysv_argpos
190f2a
 
190f2a
 static void
190f2a
 ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
190f2a
-			 const bfd_byte *val, int len, int align,
190f2a
+			 const bfd_byte *val, ssize_t len, int align,
190f2a
 			 struct ppc64_sysv_argpos *argpos)
190f2a
 {
190f2a
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
190f2a
-  int offset = 0;
190f2a
+  LONGEST offset = 0;
190f2a
 
190f2a
   /* Enforce alignment of stack location, if requested.  */
190f2a
   if (align > tdep->wordsize)
190f2a
@@ -1287,7 +1287,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
190f2a
     {
190f2a
       if (argpos->regcache && argpos->greg <= 10)
190f2a
 	argpos->regcache->cooked_write_part
190f2a
-	  (tdep->ppc_gp0_regnum + argpos->greg, offset, len, val);
190f2a
+	  (tdep->ppc_gp0_regnum + argpos->greg, offset, (LONGEST) len, val);
190f2a
       argpos->greg++;
190f2a
     }
190f2a
 }
190f2a
@@ -1346,7 +1346,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
190f2a
       if (argpos->regcache && argpos->freg <= 13)
190f2a
 	{
190f2a
 	  int regnum = tdep->ppc_fp0_regnum + argpos->freg;
190f2a
-	  int offset = 0;
190f2a
+	  LONGEST offset = 0;
190f2a
 
190f2a
 	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
190f2a
 	    offset = 8 - TYPE_LENGTH (type);
190f2a
@@ -1795,7 +1795,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
190f2a
       && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
190f2a
     {
190f2a
       int regnum = tdep->ppc_fp0_regnum + 1 + index;
190f2a
-      int offset = 0;
190f2a
+      LONGEST offset = 0;
190f2a
 
190f2a
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
190f2a
 	offset = 8 - TYPE_LENGTH (valtype);
190f2a
@@ -1871,7 +1871,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
190f2a
       && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype))
190f2a
     {
190f2a
       int regnum = tdep->ppc_gp0_regnum + 3 + index;
190f2a
-      int offset = 0;
190f2a
+      LONGEST offset = 0;
190f2a
 
190f2a
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
190f2a
 	offset = 8 - TYPE_LENGTH (valtype);
190f2a
@@ -1979,7 +1979,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
190f2a
       && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
190f2a
     {
190f2a
       int regnum = tdep->ppc_gp0_regnum + 3;
190f2a
-      int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
190f2a
+      LONGEST offset
190f2a
+	= (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
190f2a
 
190f2a
       if (writebuf != NULL)
190f2a
 	regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype),
190f2a
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
190f2a
--- a/gdb/rl78-tdep.c
190f2a
+++ b/gdb/rl78-tdep.c
190f2a
@@ -1346,8 +1346,8 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   for (i = nargs - 1; i >= 0; i--)
190f2a
     {
190f2a
       struct type *value_type = value_enclosing_type (args[i]);
190f2a
-      int len = TYPE_LENGTH (value_type);
190f2a
-      int container_len = (len + 1) & ~1;
190f2a
+      LONGEST len = TYPE_LENGTH (value_type);
190f2a
+      LONGEST container_len = (len + 1) & ~1;
190f2a
 
190f2a
       sp -= container_len;
190f2a
       write_memory (rl78_make_data_address (sp),
190f2a
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
190f2a
--- a/gdb/rs6000-aix-tdep.c
190f2a
+++ b/gdb/rs6000-aix-tdep.c
190f2a
@@ -177,9 +177,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int ii;
190f2a
-  int len = 0;
190f2a
+  LONGEST len = 0;
190f2a
   int argno;			/* current argument number */
190f2a
-  int argbytes;			/* current argument byte */
190f2a
+  LONGEST argbytes;		/* current argument byte */
190f2a
   gdb_byte tmp_buffer[50];
190f2a
   int f_argno = 0;		/* current floating point argno */
190f2a
   int wordsize = gdbarch_tdep (gdbarch)->wordsize;
190f2a
@@ -307,7 +307,7 @@ ran_out_of_registers_for_arguments:
190f2a
 
190f2a
   if ((argno < nargs) || argbytes)
190f2a
     {
190f2a
-      int space = 0, jj;
190f2a
+      LONGEST space = 0, jj;
190f2a
 
190f2a
       if (argbytes)
190f2a
 	{
190f2a
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
190f2a
--- a/gdb/score-tdep.c
190f2a
+++ b/gdb/score-tdep.c
190f2a
@@ -516,7 +516,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int argnum;
190f2a
   int argreg;
190f2a
-  int arglen = 0;
190f2a
+  LONGEST arglen = 0;
190f2a
   CORE_ADDR stack_offset = 0;
190f2a
   CORE_ADDR addr = 0;
190f2a
 
190f2a
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
190f2a
--- a/gdb/sh-tdep.c
190f2a
+++ b/gdb/sh-tdep.c
190f2a
@@ -812,7 +812,7 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
190f2a
 static int
190f2a
 sh_use_struct_convention (int renesas_abi, struct type *type)
190f2a
 {
190f2a
-  int len = TYPE_LENGTH (type);
190f2a
+  LONGEST len = TYPE_LENGTH (type);
190f2a
   int nelem = TYPE_NFIELDS (type);
190f2a
 
190f2a
   /* The Renesas ABI returns aggregate types always on stack.  */
190f2a
@@ -914,7 +914,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp)
190f2a
 
190f2a
 /* Helper function to justify value in register according to endianess.  */
190f2a
 static const gdb_byte *
190f2a
-sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len)
190f2a
+sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, LONGEST len)
190f2a
 {
190f2a
   static gdb_byte valbuf[4];
190f2a
 
190f2a
@@ -1074,7 +1074,8 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
190f2a
   struct type *type;
190f2a
   CORE_ADDR regval;
190f2a
   const gdb_byte *val;
190f2a
-  int len, reg_size = 0;
190f2a
+  LONGEST len;
190f2a
+  int reg_size = 0;
190f2a
   int pass_on_stack = 0;
190f2a
   int treat_as_flt;
190f2a
   int last_reg_arg = INT_MAX;
190f2a
@@ -1215,7 +1216,8 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
190f2a
   struct type *type;
190f2a
   CORE_ADDR regval;
190f2a
   const gdb_byte *val;
190f2a
-  int len, reg_size = 0;
190f2a
+  LONGEST len;
190f2a
+  int reg_size = 0;
190f2a
   int pass_on_stack = 0;
190f2a
   int last_reg_arg = INT_MAX;
190f2a
 
190f2a
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
190f2a
--- a/gdb/sparc64-tdep.c
190f2a
+++ b/gdb/sparc64-tdep.c
190f2a
@@ -1205,7 +1205,7 @@ sparc64_16_byte_align_p (struct type *type)
190f2a
 
190f2a
 static void
190f2a
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
190f2a
-			       const gdb_byte *valbuf, int element, int bitpos)
190f2a
+			       const gdb_byte *valbuf, int element, LONGEST bitpos)
190f2a
 {
190f2a
   struct gdbarch *gdbarch = regcache->arch ();
190f2a
   int len = TYPE_LENGTH (type);
190f2a
@@ -1265,7 +1265,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
190f2a
       for (i = 0; i < TYPE_NFIELDS (type); i++)
190f2a
 	{
190f2a
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
190f2a
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
190f2a
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
190f2a
 
190f2a
 	  sparc64_store_floating_fields (regcache, subtype, valbuf,
190f2a
 					 element, subpos);
190f2a
@@ -1297,7 +1297,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
190f2a
 
190f2a
 static void
190f2a
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
190f2a
-				 gdb_byte *valbuf, int bitpos)
190f2a
+				 gdb_byte *valbuf, LONGEST bitpos)
190f2a
 {
190f2a
   struct gdbarch *gdbarch = regcache->arch ();
190f2a
 
190f2a
@@ -1353,7 +1353,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
190f2a
       for (i = 0; i < TYPE_NFIELDS (type); i++)
190f2a
 	{
190f2a
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
190f2a
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
190f2a
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
190f2a
 
190f2a
 	  sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
190f2a
 	}
190f2a
@@ -1386,7 +1386,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
190f2a
   for (i = 0; i < nargs; i++)
190f2a
     {
190f2a
       struct type *type = value_type (args[i]);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      LONGEST len = TYPE_LENGTH (type);
190f2a
 
190f2a
       if (sparc64_structure_or_union_p (type)
190f2a
 	  || (sparc64_complex_floating_p (type) && len == 32))
190f2a
@@ -1486,7 +1486,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
190f2a
     {
190f2a
       const gdb_byte *valbuf = value_contents (args[i]);
190f2a
       struct type *type = value_type (args[i]);
190f2a
-      int len = TYPE_LENGTH (type);
190f2a
+      LONGEST len = TYPE_LENGTH (type);
190f2a
       int regnum = -1;
190f2a
       gdb_byte buf[16];
190f2a
 
190f2a
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
190f2a
--- a/gdb/spu-tdep.c
190f2a
+++ b/gdb/spu-tdep.c
190f2a
@@ -1431,7 +1431,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       struct value *arg = args[i];
190f2a
       struct type *type = check_typedef (value_type (arg));
190f2a
       const gdb_byte *contents = value_contents (arg);
190f2a
-      int n_regs = align_up (TYPE_LENGTH (type), 16) / 16;
190f2a
+      LONGEST n_regs = align_up (TYPE_LENGTH (type), 16) / 16;
190f2a
 
190f2a
       /* If the argument doesn't wholly fit into registers, it and
190f2a
 	 all subsequent arguments go to the stack.  */
190f2a
@@ -1463,7 +1463,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 	{
190f2a
 	  struct value *arg = args[i];
190f2a
 	  struct type *type = check_typedef (value_type (arg));
190f2a
-	  int len = TYPE_LENGTH (type);
190f2a
+	  LONGEST len = TYPE_LENGTH (type);
190f2a
 	  int preferred_slot;
190f2a
 	  
190f2a
 	  if (spu_scalar_value_p (type))
190f2a
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
190f2a
--- a/gdb/tic6x-tdep.c
190f2a
+++ b/gdb/tic6x-tdep.c
190f2a
@@ -881,7 +881,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   int argreg = 0;
190f2a
   int argnum;
190f2a
   int stack_offset = 4;
190f2a
-  int references_offset = 4;
190f2a
+  LONGEST references_offset = 4;
190f2a
   CORE_ADDR func_addr = find_function_addr (function, NULL);
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   struct type *func_type = value_type (function);
190f2a
@@ -915,7 +915,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
   /* Now make space on the stack for the args.  */
190f2a
   for (argnum = 0; argnum < nargs; argnum++)
190f2a
     {
190f2a
-      int len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
190f2a
+      LONGEST len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
190f2a
       if (argnum >= 10 - argreg)
190f2a
 	references_offset += len;
190f2a
       stack_offset += len;
190f2a
@@ -934,7 +934,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
       const gdb_byte *val;
190f2a
       struct value *arg = args[argnum];
190f2a
       struct type *arg_type = check_typedef (value_type (arg));
190f2a
-      int len = TYPE_LENGTH (arg_type);
190f2a
+      ssize_t len = TYPE_LENGTH (arg_type);
190f2a
       enum type_code typecode = TYPE_CODE (arg_type);
190f2a
 
190f2a
       val = value_contents (arg);
190f2a
@@ -1090,7 +1090,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
190f2a
 	    }
190f2a
 	  else
190f2a
 	    internal_error (__FILE__, __LINE__,
190f2a
-			    _("unexpected length %d of arg %d"), len, argnum);
190f2a
+			    _("unexpected length %s of arg %d"),
190f2a
+			    plongest (len), argnum);
190f2a
 
190f2a
 	  addr = sp + stack_offset;
190f2a
 	  write_memory (addr, val, len);
190f2a
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
190f2a
--- a/gdb/tilegx-tdep.c
190f2a
+++ b/gdb/tilegx-tdep.c
190f2a
@@ -288,7 +288,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
190f2a
   CORE_ADDR stack_dest = sp;
190f2a
   int argreg = TILEGX_R0_REGNUM;
190f2a
   int i, j;
190f2a
-  int typelen, slacklen;
190f2a
+  LONGEST typelen, slacklen;
190f2a
   static const gdb_byte four_zero_words[16] = { 0 };
190f2a
 
190f2a
   /* If struct_return is 1, then the struct return address will
190f2a
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
190f2a
--- a/gdb/v850-tdep.c
190f2a
+++ b/gdb/v850-tdep.c
190f2a
@@ -1019,7 +1019,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int argreg;
190f2a
   int argnum;
190f2a
-  int len = 0;
190f2a
+  LONGEST len = 0;
190f2a
   int stack_offset;
190f2a
 
190f2a
   if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
190f2a
@@ -1047,7 +1047,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
190f2a
      in four registers available.  Loop thru args from first to last.  */
190f2a
   for (argnum = 0; argnum < nargs; argnum++)
190f2a
     {
190f2a
-      int len;
190f2a
+      LONGEST len;
190f2a
       gdb_byte *val;
190f2a
       gdb_byte valbuf[v850_reg_size];
190f2a
 
190f2a
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
190f2a
--- a/gdb/vax-tdep.c
190f2a
+++ b/gdb/vax-tdep.c
190f2a
@@ -110,7 +110,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
190f2a
   struct gdbarch *gdbarch = regcache->arch ();
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   gdb_byte buf[4];
190f2a
-  int count = 0;
190f2a
+  LONGEST count = 0;
190f2a
   int i;
190f2a
 
190f2a
   /* We create an argument list on the stack, and make the argument
190f2a
@@ -119,7 +119,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
190f2a
   /* Push arguments in reverse order.  */
190f2a
   for (i = nargs - 1; i >= 0; i--)
190f2a
     {
190f2a
-      int len = TYPE_LENGTH (value_enclosing_type (args[i]));
190f2a
+      LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i]));
190f2a
 
190f2a
       sp -= (len + 3) & ~3;
190f2a
       count += (len + 3) / 4;
190f2a
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
190f2a
--- a/gdb/xstormy16-tdep.c
190f2a
+++ b/gdb/xstormy16-tdep.c
190f2a
@@ -232,8 +232,9 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   CORE_ADDR stack_dest = sp;
190f2a
   int argreg = E_1ST_ARG_REGNUM;
190f2a
-  int i, j;
190f2a
-  int typelen, slacklen;
190f2a
+  int i, slacklen;
190f2a
+  LONGEST j;
190f2a
+  LONGEST typelen;
190f2a
   const gdb_byte *val;
190f2a
   gdb_byte buf[xstormy16_pc_size];
190f2a
 
190f2a
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
190f2a
--- a/gdb/xtensa-tdep.c
190f2a
+++ b/gdb/xtensa-tdep.c
190f2a
@@ -1626,8 +1626,7 @@ xtensa_store_return_value (struct type *type,
190f2a
 
190f2a
       if (len > (callsize > 8 ? 8 : 16))
190f2a
 	internal_error (__FILE__, __LINE__,
190f2a
-			_("unimplemented for this length: %d"),
190f2a
-			TYPE_LENGTH (type));
190f2a
+			_("unimplemented for this length: %d"), len);
190f2a
       areg = arreg_number (gdbarch,
190f2a
 			   gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
190f2a
 
190f2a
@@ -1701,18 +1700,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
190f2a
 {
190f2a
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
190f2a
   int i;
190f2a
-  int size, onstack_size;
190f2a
+  LONGEST size, onstack_size;
190f2a
   gdb_byte *buf = (gdb_byte *) alloca (16);
190f2a
   CORE_ADDR ra, ps;
190f2a
   struct argument_info
190f2a
   {
190f2a
     const bfd_byte *contents;
190f2a
-    int length;
190f2a
+    ssize_t length;
190f2a
     int onstack;		/* onstack == 0 => in reg */
190f2a
     int align;			/* alignment */
190f2a
     union
190f2a
     {
190f2a
-      int offset;		/* stack offset if on stack.  */
190f2a
+      ssize_t offset;		/* stack offset if on stack.  */
190f2a
       int regno;		/* regno if in register.  */
190f2a
     } u;
190f2a
   };
190f2a
@@ -1736,9 +1735,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
190f2a
         {
190f2a
 	  struct value *arg = args[i];
190f2a
 	  struct type *arg_type = check_typedef (value_type (arg));
190f2a
-	  fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i,
190f2a
-			      host_address_to_string (arg),
190f2a
-			      TYPE_LENGTH (arg_type));
190f2a
+	  const char *arg_type_len_s = pulongest (TYPE_LENGTH (arg_type));
190f2a
+
190f2a
+	  fprintf_unfiltered (gdb_stdlog, "%2d: %s %s ", i,
190f2a
+			      host_address_to_string (arg), arg_type_len_s);
190f2a
 	  switch (TYPE_CODE (arg_type))
190f2a
 	    {
190f2a
 	    case TYPE_CODE_INT:
190f2a
@@ -1808,8 +1808,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
190f2a
 	  info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
190f2a
 	  break;
190f2a
 	}
190f2a
-      info->length = TYPE_LENGTH (arg_type);
190f2a
       info->contents = value_contents (arg);
190f2a
+      info->length = TYPE_LENGTH (arg_type);
190f2a
 
190f2a
       /* Align size and onstack_size.  */
190f2a
       size = (size + info->align - 1) & ~(info->align - 1);
190f2a
@@ -1854,7 +1854,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
190f2a
 
190f2a
       if (info->onstack)
190f2a
 	{
190f2a
-	  int n = info->length;
190f2a
+	  ssize_t n = info->length;
190f2a
 	  CORE_ADDR offset = sp + info->u.offset;
190f2a
 
190f2a
 	  /* Odd-sized structs are aligned to the lower side of a memory
190f2a
@@ -1870,7 +1870,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
190f2a
 	}
190f2a
       else
190f2a
 	{
190f2a
-	  int n = info->length;
190f2a
+	  ssize_t n = info->length;
190f2a
 	  const bfd_byte *cp = info->contents;
190f2a
 	  int r = info->u.regno;
190f2a