]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
S12Z: New 32 bit Reloc.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 3 Oct 2018 10:26:42 +0000 (12:26 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 23 Oct 2018 14:09:30 +0000 (16:09 +0200)
Third party tools produce 32 bit relocs  at index 6 with strange properties.
This change moves the existing 32 bit reloc (R_S12Z_EXT32) to index 7
and introduces a new one (R_S12Z_CW32) at index 6 to try to support code
generated by these tools.

  * bfd/elf32-s12z.c (elf_s12z_howto_table) [R_S12Z_CW32]: New member.
  * binutils/readelf.c (is_32bit_abs_reloc): Reloc type 7 is also 32 bit.
  * include/elf/s12z.h (elf_s12z_reloc_tpe) [RELOC_NUMBER (R_S12Z_CW32)]: New enum.

bfd/elf32-s12z.c
binutils/readelf.c
include/elf/s12z.h

index d2ea4ecaf2f6fb05935d201e4ebdcedb501672bf..05e515326392eccb029e69bd2261444ebebc171f 100644 (file)
@@ -183,6 +183,29 @@ static reloc_howto_type elf_s12z_howto_table[] =
         0x0005ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
+  /* A 32 bit absolute relocation.   This kind of relocation is
+     schizophrenic - Although they appear in sections named .rela.debug.*
+     in some sections they behave as RELA relocs, but in others they have
+     an added of zero and behave as REL.
+
+     It is not recommended that new code  emits this reloc.   It is here
+     only to support existing elf files generated by third party
+     applications.  */
+
+  HOWTO (R_S12Z_CW32,        /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_bitfield,    /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_S12Z_CW32", /* name */
+        FALSE,                 /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
   /* A 32 bit absolute relocation  */
   HOWTO (R_S12Z_EXT32,        /* type */
         0,                     /* rightshift */
index fff50c6ad04e76224df81470dac9123d01b8de52..d8d0d6e95468cfbfac2f00d3c1e27def4594ff39 100644 (file)
@@ -12386,7 +12386,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
     case EM_68HC12:
       return reloc_type == 6; /* R_M68HC11_32.  */
     case EM_S12Z:
-      return reloc_type == 6; /* R_S12Z_EXT32.  */
+      return reloc_type == 7 || /* R_S12Z_EXT32 */
+       reloc_type == 6;        /* R_S12Z_CW32.  */
     case EM_MCORE:
       return reloc_type == 1; /* R_MCORE_ADDR32.  */
     case EM_CYGNUS_MEP:
index fc74b9a7b8908a514d1eb8833111384fdcbfee73..f42fa11032efc8e2683f7feb90b4c753f5769a6d 100644 (file)
@@ -30,7 +30,8 @@ START_RELOC_NUMBERS (elf_s12z_reloc_type)
   RELOC_NUMBER (R_S12Z_PCREL_7_15, 3)
   RELOC_NUMBER (R_S12Z_EXT24, 4)
   RELOC_NUMBER (R_S12Z_EXT18, 5)
-  RELOC_NUMBER (R_S12Z_EXT32, 6)
+  RELOC_NUMBER (R_S12Z_CW32, 6)
+  RELOC_NUMBER (R_S12Z_EXT32, 7)
 END_RELOC_NUMBERS (R_S12Z_max)
 
 #endif