]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/elf32-arm.c
asan: buffer overflow in elf32_arm_get_synthetic_symtab
[thirdparty/binutils-gdb.git] / bfd / elf32-arm.c
index 98f924019429ca11eca0e7fdf6bc81f484183724..18c30dbef866c6804b2b7b9c623e43d64df40724 100644 (file)
@@ -1,5 +1,5 @@
 /* 32-bit ELF support for ARM
-   Copyright (C) 1998-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998-2023 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -80,7 +80,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* No relocation.  */
   HOWTO (R_ARM_NONE,           /* type */
         0,                     /* rightshift */
-        3,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -94,7 +94,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_PC24,           /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -109,7 +109,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* 32 bit absolute */
   HOWTO (R_ARM_ABS32,          /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -124,7 +124,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* standard 32bit pc-relative reloc */
   HOWTO (R_ARM_REL32,          /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -139,7 +139,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* 8 bit absolute - R_ARM_LDR_PC_G0 in AAELF */
   HOWTO (R_ARM_LDR_PC_G0,      /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -154,7 +154,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
    /* 16 bit absolute */
   HOWTO (R_ARM_ABS16,          /* type */
         0,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -169,7 +169,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* 12 bit absolute */
   HOWTO (R_ARM_ABS12,          /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -183,7 +183,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_ABS5,       /* type */
         6,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         5,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -198,7 +198,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* 8 bit absolute */
   HOWTO (R_ARM_ABS8,           /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size */
         8,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -212,7 +212,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_SBREL32,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -226,7 +226,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_CALL,       /* type */
         1,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -240,7 +240,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_PC8,                /* type */
         1,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         8,                     /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -254,7 +254,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_BREL_ADJ,       /* type */
         1,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -268,7 +268,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_DESC,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -282,7 +282,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_SWI8,       /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -297,7 +297,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* BLX instruction for the ARM.  */
   HOWTO (R_ARM_XPC25,          /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -312,7 +312,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* BLX instruction for the Thumb.  */
   HOWTO (R_ARM_THM_XPC22,      /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -328,7 +328,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_DTPMOD32,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -342,7 +342,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_DTPOFF32,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -356,7 +356,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_TPOFF32,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -372,7 +372,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_COPY,           /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -386,7 +386,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GLOB_DAT,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -400,7 +400,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_JUMP_SLOT,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -414,7 +414,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_RELATIVE,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -428,7 +428,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOTOFF32,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -442,7 +442,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOTPC,          /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -456,7 +456,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOT32,          /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -470,7 +470,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_PLT32,          /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -484,7 +484,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_CALL,           /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -498,7 +498,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_JUMP24,         /* type */
         2,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -512,7 +512,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_JUMP24,     /* type */
         1,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -526,7 +526,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_BASE_ABS,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -540,7 +540,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PCREL7_0,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -554,7 +554,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PCREL15_8,  /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         true,                  /* pc_relative */
         8,                     /* bitpos */
@@ -568,7 +568,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PCREL23_15, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         true,                  /* pc_relative */
         16,                    /* bitpos */
@@ -582,7 +582,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_SBREL_11_0, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -596,7 +596,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SBREL_19_12,        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         8,                     /* bitsize */
         false,                 /* pc_relative */
         12,                    /* bitpos */
@@ -610,7 +610,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SBREL_27_20,        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         8,                     /* bitsize */
         false,                 /* pc_relative */
         20,                    /* bitpos */
@@ -624,7 +624,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TARGET1,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -638,7 +638,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ROSEGREL32,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -652,7 +652,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_V4BX,           /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -666,7 +666,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TARGET2,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -680,7 +680,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_PREL31,         /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         31,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -694,7 +694,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVW_ABS_NC,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -708,7 +708,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVT_ABS,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -722,7 +722,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVW_PREL_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -736,7 +736,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVT_PREL,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -750,7 +750,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVW_ABS_NC,        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -764,7 +764,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVT_ABS,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -778,7 +778,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVW_PREL_NC,/* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -792,7 +792,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVT_PREL,  /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -806,7 +806,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_JUMP19,     /* type */
         1,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         19,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -820,7 +820,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_JUMP6,      /* type */
         1,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         6,                     /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -837,7 +837,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
      versa.  */
   HOWTO (R_ARM_THM_ALU_PREL_11_0,/* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         13,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -851,7 +851,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_PC12,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         13,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -865,7 +865,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ABS32_NOI,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -879,7 +879,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_REL32_NOI,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -895,7 +895,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PC_G0_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -909,7 +909,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PC_G0,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -923,7 +923,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PC_G1_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -937,7 +937,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PC_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -951,7 +951,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_PC_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -965,7 +965,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_PC_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -979,7 +979,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_PC_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -993,7 +993,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_PC_G0,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1007,7 +1007,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_PC_G1,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1021,7 +1021,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_PC_G2,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1035,7 +1035,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_PC_G0,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1049,7 +1049,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_PC_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1063,7 +1063,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_PC_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1077,7 +1077,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SB_G0_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1091,7 +1091,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SB_G0,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1105,7 +1105,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SB_G1_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1119,7 +1119,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SB_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1133,7 +1133,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_ALU_SB_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1147,7 +1147,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_SB_G0,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1161,7 +1161,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_SB_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1175,7 +1175,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDR_SB_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1189,7 +1189,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_SB_G0,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1203,7 +1203,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_SB_G1,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1217,7 +1217,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDRS_SB_G2,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1231,7 +1231,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_SB_G0,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1245,7 +1245,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_SB_G1,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1259,7 +1259,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_LDC_SB_G2,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1275,7 +1275,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVW_BREL_NC,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1289,7 +1289,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVT_BREL,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1303,7 +1303,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_MOVW_BREL,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1317,7 +1317,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVW_BREL_NC,/* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1331,7 +1331,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVT_BREL,  /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1345,7 +1345,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_MOVW_BREL,  /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1359,7 +1359,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_GOTDESC,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1373,7 +1373,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_CALL,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1387,7 +1387,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_DESCSEQ,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1401,7 +1401,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_TLS_CALL,   /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         24,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1415,7 +1415,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_PLT32_ABS,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1429,7 +1429,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOT_ABS,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1443,7 +1443,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOT_PREL,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1457,7 +1457,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOT_BREL12,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1471,7 +1471,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_GOTOFF12,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1488,7 +1488,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* GNU extension to record C++ vtable member usage */
   HOWTO (R_ARM_GNU_VTENTRY,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1503,7 +1503,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* GNU extension to record C++ vtable hierarchy */
   HOWTO (R_ARM_GNU_VTINHERIT, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1517,7 +1517,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_JUMP11,     /* type */
         1,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         11,                    /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1531,7 +1531,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_JUMP8,      /* type */
         1,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         8,                     /* bitsize */
         true,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1546,7 +1546,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* TLS relocations */
   HOWTO (R_ARM_TLS_GD32,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1560,7 +1560,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_LDM32,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1574,7 +1574,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_LDO32,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1588,7 +1588,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_IE32,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                  /* pc_relative */
         0,                     /* bitpos */
@@ -1602,7 +1602,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_LE32,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1616,7 +1616,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_LDO12,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1630,7 +1630,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_LE12,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1644,7 +1644,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_TLS_IE12GP,     /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         12,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1679,7 +1679,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
 
   HOWTO (R_ARM_THM_TLS_DESCSEQ,        /* type */
         0,                     /* rightshift */
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        2,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1694,7 +1694,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   EMPTY_HOWTO (131),
   HOWTO (R_ARM_THM_ALU_ABS_G0_NC,/* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         16,                    /* bitsize.  */
         false,                 /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1707,7 +1707,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
         false),                /* pcrel_offset.  */
   HOWTO (R_ARM_THM_ALU_ABS_G1_NC,/* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         16,                    /* bitsize.  */
         false,                 /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1720,7 +1720,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
         false),                /* pcrel_offset.  */
   HOWTO (R_ARM_THM_ALU_ABS_G2_NC,/* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         16,                    /* bitsize.  */
         false,                 /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1733,7 +1733,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
         false),                /* pcrel_offset.  */
   HOWTO (R_ARM_THM_ALU_ABS_G3_NC,/* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         16,                    /* bitsize.  */
         false,                 /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1747,7 +1747,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
   /* Relocations for Armv8.1-M Mainline.  */
   HOWTO (R_ARM_THM_BF16,       /* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         16,                    /* bitsize.  */
         true,                  /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1760,7 +1760,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
         true),                 /* pcrel_offset.  */
   HOWTO (R_ARM_THM_BF12,       /* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         12,                    /* bitsize.  */
         true,                  /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1773,7 +1773,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
         true),                 /* pcrel_offset.  */
   HOWTO (R_ARM_THM_BF18,       /* type.  */
         0,                     /* rightshift.  */
-        1,                     /* size (0 = byte, 1 = short, 2 = long).  */
+        2,                     /* size.  */
         18,                    /* bitsize.  */
         true,                  /* pc_relative.  */
         0,                     /* bitpos.  */
@@ -1791,7 +1791,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
 {
   HOWTO (R_ARM_IRELATIVE,      /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1804,7 +1804,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_GOTFUNCDESC,    /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1817,7 +1817,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_GOTOFFFUNCDESC, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1830,7 +1830,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_FUNCDESC,       /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1843,7 +1843,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_FUNCDESC_VALUE, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         64,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1856,7 +1856,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_TLS_GD32_FDPIC, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1869,7 +1869,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_TLS_LDM32_FDPIC,        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1882,7 +1882,7 @@ static reloc_howto_type elf32_arm_howto_table_2[8] =
         false),                /* pcrel_offset */
   HOWTO (R_ARM_TLS_IE32_FDPIC, /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        4,                     /* size */
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1900,7 +1900,7 @@ static reloc_howto_type elf32_arm_howto_table_3[4] =
 {
   HOWTO (R_ARM_RREL32,         /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1914,7 +1914,7 @@ static reloc_howto_type elf32_arm_howto_table_3[4] =
 
   HOWTO (R_ARM_RABS32,         /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1928,7 +1928,7 @@ static reloc_howto_type elf32_arm_howto_table_3[4] =
 
   HOWTO (R_ARM_RPC24,          /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1942,7 +1942,7 @@ static reloc_howto_type elf32_arm_howto_table_3[4] =
 
   HOWTO (R_ARM_RBASE,          /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* size */
         0,                     /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -2536,11 +2536,23 @@ static const bfd_vma elf32_arm_nacl_plt_entry [] =
   0xea000000,          /* b    .Lplt_tail                      */
 };
 
+/* PR 28924:
+   There was a bug due to too high values of THM_MAX_FWD_BRANCH_OFFSET and
+   THM2_MAX_FWD_BRANCH_OFFSET.  The first macro concerns the case when Thumb-2
+   is not available, and second macro when Thumb-2 is available.  Among other
+   things, they affect the range of branches represented as BLX instructions
+   in Encoding T2 defined in Section A8.8.25 of the ARM Architecture
+   Reference Manual ARMv7-A and ARMv7-R edition issue C.d.  Such branches are
+   specified there to have a maximum forward offset that is a multiple of 4.
+   Previously, the respective values defined here were multiples of 2 but not
+   4 and they are included in comments for reference.  */
 #define ARM_MAX_FWD_BRANCH_OFFSET  ((((1 << 23) - 1) << 2) + 8)
-#define ARM_MAX_BWD_BRANCH_OFFSET  ((-((1 << 23) << 2)) + 8)
-#define THM_MAX_FWD_BRANCH_OFFSET  ((1 << 22) -2 + 4)
+#define ARM_MAX_BWD_BRANCH_OFFSET ((-((1 << 23) << 2)) + 8)
+#define THM_MAX_FWD_BRANCH_OFFSET   ((1 << 22) - 4 + 4)
+/* #def THM_MAX_FWD_BRANCH_OFFSET   ((1 << 22) - 2 + 4) */
 #define THM_MAX_BWD_BRANCH_OFFSET  (-(1 << 22) + 4)
-#define THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 2) + 4)
+#define THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 4) + 4)
+/* #def THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 2) + 4) */
 #define THM2_MAX_BWD_BRANCH_OFFSET (-(1 << 24) + 4)
 #define THM2_MAX_FWD_COND_BRANCH_OFFSET (((1 << 20) -2) + 4)
 #define THM2_MAX_BWD_COND_BRANCH_OFFSET (-(1 << 20) + 4)
@@ -3941,7 +3953,7 @@ using_thumb2_bl (struct elf32_arm_link_hash_table *globals)
     bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
 
   /* Force return logic to be reviewed for each new architecture.  */
-  BFD_ASSERT (arch <= TAG_CPU_ARCH_V8_1M_MAIN);
+  BFD_ASSERT (arch <= TAG_CPU_ARCH_V9);
 
   /* Architecture was introduced after ARMv6T2 (eg. ARMv6-M).  */
   return (arch == TAG_CPU_ARCH_V6T2
@@ -4130,13 +4142,14 @@ arch_has_arm_nop (struct elf32_arm_link_hash_table *globals)
                                             Tag_CPU_arch);
 
   /* Force return logic to be reviewed for each new architecture.  */
-  BFD_ASSERT (arch <= TAG_CPU_ARCH_V8_1M_MAIN);
+  BFD_ASSERT (arch <= TAG_CPU_ARCH_V9);
 
   return (arch == TAG_CPU_ARCH_V6T2
          || arch == TAG_CPU_ARCH_V6K
          || arch == TAG_CPU_ARCH_V7
          || arch == TAG_CPU_ARCH_V8
-         || arch == TAG_CPU_ARCH_V8R);
+         || arch == TAG_CPU_ARCH_V8R
+         || arch == TAG_CPU_ARCH_V9);
 }
 
 static bool
@@ -5040,7 +5053,7 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+    info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
 
@@ -5995,6 +6008,9 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
       else
        {
          cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
+         if (cmse_hash == NULL)
+           continue;
+
          sym_name = (char *) cmse_hash->root.root.root.string;
          if (!startswith (sym_name, CMSE_PREFIX))
            continue;
@@ -7097,10 +7113,13 @@ find_thumb_glue (struct bfd_link_info *link_info,
   hash = elf_link_hash_lookup
     (&(hash_table)->root, tmp_name, false, false, true);
 
-  if (hash == NULL
-      && asprintf (error_message, _("unable to find %s glue '%s' for '%s'"),
-                  "Thumb", tmp_name, name) == -1)
-    *error_message = (char *) bfd_errmsg (bfd_error_system_call);
+  if (hash == NULL)
+    {
+      *error_message = bfd_asprintf (_("unable to find %s glue '%s' for '%s'"),
+                                    "Thumb", tmp_name, name);
+      if (*error_message == NULL)
+       *error_message = (char *) bfd_errmsg (bfd_error_system_call);
+    }
 
   free (tmp_name);
 
@@ -7132,11 +7151,13 @@ find_arm_glue (struct bfd_link_info *link_info,
   myh = elf_link_hash_lookup
     (&(hash_table)->root, tmp_name, false, false, true);
 
-  if (myh == NULL
-      && asprintf (error_message, _("unable to find %s glue '%s' for '%s'"),
-                  "ARM", tmp_name, name) == -1)
-    *error_message = (char *) bfd_errmsg (bfd_error_system_call);
-
+  if (myh == NULL)
+    {
+      *error_message = bfd_asprintf (_("unable to find %s glue '%s' for '%s'"),
+                                    "ARM", tmp_name, name);
+      if (*error_message == NULL)
+       *error_message = (char *) bfd_errmsg (bfd_error_system_call);
+    }
   free (tmp_name);
 
   return myh;
@@ -7866,7 +7887,8 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
       if (sec->reloc_count == 0)
        continue;
 
-      if ((sec->flags & SEC_EXCLUDE) != 0)
+      if ((sec->flags & SEC_EXCLUDE) != 0
+         || (sec->flags & SEC_HAS_CONTENTS) == 0)
        continue;
 
       symtab_hdr = & elf_symtab_hdr (abfd);
@@ -10344,11 +10366,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *         howto,
     {
       bfd_vma sign;
 
-      switch (howto->size)
+      switch (bfd_get_reloc_size (howto))
        {
-       case 0: addend = bfd_get_8 (input_bfd, hit_data); break;
-       case 1: addend = bfd_get_16 (input_bfd, hit_data); break;
-       case 2: addend = bfd_get_32 (input_bfd, hit_data); break;
+       case 1: addend = bfd_get_8 (input_bfd, hit_data); break;
+       case 2: addend = bfd_get_16 (input_bfd, hit_data); break;
+       case 4: addend = bfd_get_32 (input_bfd, hit_data); break;
        default: addend = 0; break;
        }
       /* Note: the addend and signed_addend calculated here are
@@ -13046,7 +13068,7 @@ arm_add_to_rel (bfd *              abfd,
        case R_ARM_PLT32:
        case R_ARM_CALL:
        case R_ARM_JUMP24:
-         addend <<= howto->size;
+         addend *= bfd_get_reloc_size (howto);
          addend += increment;
 
          /* Should we check for overflow here ?  */
@@ -13852,6 +13874,8 @@ bfd_arm_get_mach_from_attributes (bfd * abfd)
        return bfd_mach_arm_8M_MAIN;
     case TAG_CPU_ARCH_V8_1M_MAIN:
        return bfd_mach_arm_8_1M_MAIN;
+    case TAG_CPU_ARCH_V9:
+       return bfd_mach_arm_9;
 
     default:
       /* Force entry to be added for any new known Tag_CPU_arch value.  */
@@ -14095,7 +14119,7 @@ set_secondary_compatible_arch (bfd *abfd, int arch)
 
 static int
 tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
-                     int newtag, int secondary_compat)
+                     int newtag, int secondary_compat, const char* name_table[])
 {
 #define T(X) TAG_CPU_ARCH_##X
   int tagl, tagh, result;
@@ -14202,7 +14226,14 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       T(V8),           /* V6_M.  */
       T(V8),           /* V6S_M.  */
       T(V8),           /* V7E_M.  */
-      T(V8)            /* V8.  */
+      T(V8),           /* V8.  */
+      T(V8),           /* V8-R.  */
+      T(V8),           /* V8-M.BASE.  */
+      T(V8),           /* V8-M.MAIN.  */
+      T(V8),           /* V8.1.  */
+      T(V8),           /* V8.2.  */
+      T(V8),           /* V8.3.  */
+      T(V8),           /* V8.1-M.MAIN.  */
     };
   const int v8r[] =
     {
@@ -14289,6 +14320,32 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       -1,              /* Unused (20).  */
       T(V8_1M_MAIN)    /* V8.1-M MAINLINE.  */
     };
+  const int v9[] =
+    {
+      T(V9),           /* PRE_V4.  */
+      T(V9),           /* V4.  */
+      T(V9),           /* V4T.  */
+      T(V9),           /* V5T.  */
+      T(V9),           /* V5TE.  */
+      T(V9),           /* V5TEJ.  */
+      T(V9),           /* V6.  */
+      T(V9),           /* V6KZ.  */
+      T(V9),           /* V6T2.  */
+      T(V9),           /* V6K.  */
+      T(V9),           /* V7.  */
+      T(V9),           /* V6_M.  */
+      T(V9),           /* V6S_M.  */
+      T(V9),           /* V7E_M.  */
+      T(V9),           /* V8.  */
+      T(V9),           /* V8-R.  */
+      T(V9),           /* V8-M.BASE.  */
+      T(V9),           /* V8-M.MAIN.  */
+      T(V9),           /* V8.1.  */
+      T(V9),           /* V8.2.  */
+      T(V9),           /* V8.3.  */
+      T(V9),           /* V8.1-M.MAIN.  */
+      T(V9),           /* V9.  */
+     };
   const int v4t_plus_v6_m[] =
     {
       -1,              /* PRE_V4.  */
@@ -14313,6 +14370,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       -1,              /* Unused (19).  */
       -1,              /* Unused (20).  */
       T(V8_1M_MAIN),   /* V8.1-M MAINLINE.  */
+      T(V9),           /* V9.  */
       T(V4T_PLUS_V6_M) /* V4T plus V6_M.  */
     };
   const int *comb[] =
@@ -14331,6 +14389,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       NULL,
       NULL,
       v8_1m_mainline,
+      v9,
       /* Pseudo-architecture.  */
       v4t_plus_v6_m
     };
@@ -14377,8 +14436,8 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
 
   if (result == -1)
     {
-      _bfd_error_handler (_("error: %pB: conflicting CPU architectures %d/%d"),
-                         ibfd, oldtag, newtag);
+      _bfd_error_handler (_("error: conflicting CPU architectures %s vs %s in %pB"),
+                         name_table[oldtag], name_table[newtag], ibfd);
       return -1;
     }
 
@@ -14485,6 +14544,14 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
          out_attr[Tag_MPextension_use_legacy].i = 0;
        }
 
+      /* PR 28859 and 28848:  Handle the case where the first input file,
+        eg crti.o, has a Tag_ABI_HardFP_use of 3 but no Tag_FP_arch set.
+        Using Tag_ABI_HardFP_use in this way is deprecated, so reset the
+        attribute to zero.
+        FIXME: Should we handle other non-zero values of Tag_ABI_HardFO_use ? */
+      if (out_attr[Tag_ABI_HardFP_use].i == 3 && out_attr[Tag_FP_arch].i == 0)
+       out_attr[Tag_ABI_HardFP_use].i = 0;
+
       return result;
     }
 
@@ -14547,10 +14614,16 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
                "ARM v7",
                "ARM v6-M",
                "ARM v6S-M",
+               "ARM v7E-M",
                "ARM v8",
-               "",
+               "ARM v8-R",
                "ARM v8-M.baseline",
                "ARM v8-M.mainline",
+               "ARM v8.1-A",
+               "ARM v8.2-A",
+               "ARM v8.3-A",
+               "ARM v8.1-M.mainline",
+               "ARM v9",
            };
 
            /* Merge Tag_CPU_arch and Tag_also_compatible_with.  */
@@ -14559,7 +14632,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
            arch_attr = tag_cpu_arch_combine (ibfd, out_attr[i].i,
                                              &secondary_compat_out,
                                              in_attr[i].i,
-                                             secondary_compat);
+                                             secondary_compat,
+                                             name_table);
 
            /* Return with error if failed to merge.  */
            if (arch_attr == -1)
@@ -14615,6 +14689,7 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
        case Tag_PAC_extension:
        case Tag_BTI_extension:
        case Tag_BTI_use:
+       case Tag_PACRET_use:
          /* Use the largest value specified.  */
          if (in_attr[i].i > out_attr[i].i)
            out_attr[i].i = in_attr[i].i;
@@ -15868,7 +15943,7 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
   struct elf_link_hash_entry **sym_hashes;
   struct elf32_arm_link_hash_entry *cmse_hash;
   bool again, is_v8m, first_bfd_browse = true;
-  bool debug_sec_need_to_be_marked = false;
+  bool extra_marks_added = false;
   asection *isec;
 
   _bfd_elf_gc_mark_extra_sections (info, gc_mark_hook);
@@ -15912,6 +15987,8 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
             of them so no need for a second browsing.  */
          if (is_v8m && first_bfd_browse)
            {
+             bool debug_sec_need_to_be_marked = false;
+
              sym_hashes = elf_sym_hashes (sub);
              bed = get_elf_backend_data (sub);
              symtab_hdr = &elf_tdata (sub)->symtab_hdr;
@@ -15922,11 +15999,13 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
              for (i = ext_start; i < sym_count; i++)
                {
                  cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
+                 if (cmse_hash == NULL)
+                   continue;
 
                  /* Assume it is a special symbol.  If not, cmse_scan will
                     warn about it and user can do something about it.  */
                  if (startswith (cmse_hash->root.root.root.string,
-                                   CMSE_PREFIX))
+                                 CMSE_PREFIX))
                    {
                      cmse_sec = cmse_hash->root.root.u.def.section;
                      if (!cmse_sec->gc_mark
@@ -15947,15 +16026,24 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
                    {
                      /* If not a debug sections, skip it.  */
                      if (!isec->gc_mark && (isec->flags & SEC_DEBUGGING))
-                       isec->gc_mark = 1 ;
+                       {
+                         isec->gc_mark = 1;
+                         extra_marks_added = true;
+                       }
                    }
                  debug_sec_need_to_be_marked = false;
                }
            }
        }
+
       first_bfd_browse = false;
     }
 
+  /* PR 30354: If we have added extra marks then make sure that any
+     dependencies of the newly marked sections are also marked.  */
+  if (extra_marks_added)
+    _bfd_elf_gc_mark_extra_sections (info, gc_mark_hook);
+
   return true;
 }
 
@@ -17621,6 +17709,35 @@ elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
                            const asection *rel_sec ATTRIBUTE_UNUSED,
                            const Elf_Internal_Rela *rela)
 {
+  struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info);
+
+  if (htab->root.dynsym != NULL
+      && htab->root.dynsym->contents != NULL)
+    {
+      /* Check relocation against STT_GNU_IFUNC symbol if there are
+        dynamic symbols.  */
+      bfd *abfd = info->output_bfd;
+      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+      unsigned long r_symndx = ELF32_R_SYM (rela->r_info);
+      if (r_symndx != STN_UNDEF)
+       {
+         Elf_Internal_Sym sym;
+         if (!bed->s->swap_symbol_in (abfd,
+                                      (htab->root.dynsym->contents
+                                       + r_symndx * bed->s->sizeof_sym),
+                                      0, &sym))
+           {
+             /* xgettext:c-format */
+             _bfd_error_handler (_("%pB symbol number %lu references"
+                                   " nonexistent SHT_SYMTAB_SHNDX section"),
+                                 abfd, r_symndx);
+             /* Ideally an error class should be returned here.  */
+           }
+         else if (ELF_ST_TYPE (sym.st_info) == STT_GNU_IFUNC)
+           return reloc_class_ifunc;
+       }
+    }
+
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
     case R_ARM_RELATIVE:
@@ -18045,6 +18162,11 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
   bfd_size_type size;
   bfd *input_bfd;
 
+  if (info->strip == strip_all
+      && !info->emitrelocations
+      && !bfd_link_relocatable (info))
+    return true;
+
   htab = elf32_arm_hash_table (info);
   if (htab == NULL)
     return false;
@@ -19849,11 +19971,15 @@ read_code16 (const bfd *abfd, const bfd_byte *addr)
    or (bfd_vma) -1 if size can not be determined.  */
 
 static bfd_vma
-elf32_arm_plt0_size (const bfd *abfd, const bfd_byte *addr)
+elf32_arm_plt0_size (const bfd *abfd, const bfd_byte *addr,
+                    bfd_size_type data_size)
 {
   bfd_vma first_word;
   bfd_vma plt0_size;
 
+  if (data_size < 4)
+    return (bfd_vma) -1;
+
   first_word = read_code32 (abfd, addr);
 
   if (first_word == elf32_arm_plt0_entry[0])
@@ -19872,24 +19998,28 @@ elf32_arm_plt0_size (const bfd *abfd, const bfd_byte *addr)
    or (bfd_vma) -1 if size can not be determined.  */
 
 static bfd_vma
-elf32_arm_plt_size (const bfd *abfd, const bfd_byte *start, bfd_vma offset)
+elf32_arm_plt_size (const bfd *abfd, const bfd_byte *start, bfd_vma offset,
+                   bfd_size_type data_size)
 {
   bfd_vma first_insn;
   bfd_vma plt_size = 0;
-  const bfd_byte *addr = start + offset;
 
   /* PLT entry size if fixed on Thumb-only platforms.  */
   if (read_code32 (abfd, start) == elf32_thumb2_plt0_entry[0])
-      return 4 * ARRAY_SIZE (elf32_thumb2_plt_entry);
+    return 4 * ARRAY_SIZE (elf32_thumb2_plt_entry);
 
   /* Respect Thumb stub if necessary.  */
-  if (read_code16 (abfd, addr) == elf32_arm_plt_thumb_stub[0])
+  if (offset + 2 > data_size)
+    return (bfd_vma) -1;
+  if (read_code16 (abfd, start + offset) == elf32_arm_plt_thumb_stub[0])
     {
       plt_size += 2 * ARRAY_SIZE (elf32_arm_plt_thumb_stub);
     }
 
   /* Strip immediate from first add.  */
-  first_insn = read_code32 (abfd, addr + plt_size) & 0xffffff00;
+  if (offset + plt_size + 4 > data_size)
+    return (bfd_vma) -1;
+  first_insn = read_code32 (abfd, start + offset + plt_size) & 0xffffff00;
 
 #ifdef FOUR_WORD_PLT
   if (first_insn == elf32_arm_plt_entry[0])
@@ -19952,15 +20082,11 @@ elf32_arm_get_synthetic_symtab (bfd *abfd,
   if (!elf32_arm_size_info.slurp_reloc_table (abfd, relplt, dynsyms, true))
     return -1;
 
-  data = plt->contents;
-  if (data == NULL)
-    {
-      if (!bfd_get_full_section_contents (abfd, (asection *) plt, &data) || data == NULL)
-       return -1;
-      bfd_cache_section_contents ((asection *) plt, data);
-    }
+  data = NULL;
+  if (!bfd_get_full_section_contents (abfd, plt, &data))
+    return -1;
 
-  count = relplt->size / hdr->sh_entsize;
+  count = NUM_SHDR_ENTRIES (hdr);
   size = count * sizeof (asymbol);
   p = relplt->relocation;
   for (i = 0; i < count; i++, p += elf32_arm_size_info.int_rels_per_ext_rel)
@@ -19970,13 +20096,13 @@ elf32_arm_get_synthetic_symtab (bfd *abfd,
        size += sizeof ("+0x") - 1 + 8;
     }
 
-  s = *ret = (asymbol *) bfd_malloc (size);
-  if (s == NULL)
-    return -1;
-
-  offset = elf32_arm_plt0_size (abfd, data);
-  if (offset == (bfd_vma) -1)
-    return -1;
+  offset = elf32_arm_plt0_size (abfd, data, plt->size);
+  if (offset == (bfd_vma) -1
+      || (s = *ret = (asymbol *) bfd_malloc (size)) == NULL)
+    {
+      free (data);
+      return -1;
+    }
 
   names = (char *) (s + count);
   p = relplt->relocation;
@@ -19985,7 +20111,7 @@ elf32_arm_get_synthetic_symtab (bfd *abfd,
     {
       size_t len;
 
-      bfd_vma plt_size = elf32_arm_plt_size (abfd, data, offset);
+      bfd_vma plt_size = elf32_arm_plt_size (abfd, data, offset, plt->size);
       if (plt_size == (bfd_vma) -1)
        break;
 
@@ -20021,6 +20147,7 @@ elf32_arm_get_synthetic_symtab (bfd *abfd,
       offset += plt_size;
     }
 
+  free (data);
   return n;
 }
 
@@ -20184,12 +20311,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define ELF_ARCH                       bfd_arch_arm
 #define ELF_TARGET_ID                  ARM_ELF_DATA
 #define ELF_MACHINE_CODE               EM_ARM
-#ifdef __QNXTARGET__
 #define ELF_MAXPAGESIZE                        0x1000
-#else
-#define ELF_MAXPAGESIZE                        0x10000
-#endif
-#define ELF_MINPAGESIZE                        0x1000
 #define ELF_COMMONPAGESIZE             0x1000
 
 #define bfd_elf32_mkobject                     elf32_arm_mkobject
@@ -20251,7 +20373,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define elf_backend_dtrel_excludes_plt 1
 
 #define elf_backend_got_header_size    12
-#define elf_backend_extern_protected_data 1
+#define elf_backend_extern_protected_data 0
 
 #undef elf_backend_obj_attrs_vendor
 #define elf_backend_obj_attrs_vendor           "aeabi"
@@ -20365,7 +20487,6 @@ elf32_arm_nacl_plt_sym_val (bfd_vma i, const asection *plt,
 #undef  elf_backend_final_write_processing
 #define elf_backend_final_write_processing     elf32_arm_final_write_processing
 #undef ELF_MINPAGESIZE
-#define ELF_MINPAGESIZE                        0x1000
 #undef ELF_COMMONPAGESIZE
 #define ELF_COMMONPAGESIZE             0x1000