[PATCH] bfd: tweak SET_ARCH_MACH of aout-cris.c
authorGunther Nikl <gnikl@justmail.de>
Mon, 4 May 2020 15:07:26 +0000 (16:07 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 4 May 2020 15:07:26 +0000 (16:07 +0100)
* aout-cris.c (DEFAULT_ARCH): Delete define.
(MY_set_arch_mach): Likewise.
(SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
of bfd_arch_cris.
(swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
of r_type before the shift.

bfd/ChangeLog
bfd/aout-cris.c

index be1c985615c7292594338e139daaed831e3a94fa..19ecf8929240bfd9a06d6a02f1b5cb361147b3d8 100644 (file)
@@ -1,4 +1,13 @@
-2020-05-01  Wilco Dijkstra  <wdijkstr@arm.com>
+2020-05-04  Gunther Nikl  <gnikl@justmail.de>
+
+       * aout-cris.c (DEFAULT_ARCH): Delete define.
+       (MY_set_arch_mach): Likewise.
+       (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
+       of bfd_arch_cris.
+       (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
+       of r_type before the shift.
+
+2020-05-04  Wilco Dijkstra  <wdijkstr@arm.com>
 
        PR ld/25665
        * elfnn-aarch64.c (group_sections): Copy implementation from
index 30ab2b5f4943c774e94d095507e81a37b75c3f16..d6221d17e76d606919ef3b2ef0c29b667ccd6b8e 100644 (file)
@@ -56,9 +56,6 @@
 #define TARGET_PAGE_SIZE SEGMENT_SIZE
 #define TARGETNAME "a.out-cris"
 
-/* The definition here seems not used; just provided as a convention.  */
-#define DEFAULT_ARCH bfd_arch_cris
-
 /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
    remove whitespace added here, and thus will fail to concatenate
    the tokens.  */
@@ -92,9 +89,8 @@ static bfd_boolean MY (set_sizes) (bfd *);
    through SET_ARCH_MACH.  The default bfd_default_set_arch_mach will
    not call set_sizes.  */
 
-#define MY_set_arch_mach NAME (aout, set_arch_mach)
 #define SET_ARCH_MACH(BFD, EXECP) \
MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXECP))
 bfd_set_arch_mach (BFD, bfd_arch_cris, N_MACHTYPE (EXECP))
 
 /* These macros describe the binary layout of the reloc information we
    use in a file.  */
@@ -231,12 +227,14 @@ MY (swap_ext_reloc_in) (bfd *abfd,
   cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
 
   /* Now the fun stuff.  */
-  r_index =  (bytes->r_index[2] << 16)
-    | (bytes->r_index[1] << 8)
-    |  bytes->r_index[0];
+  r_index =  (((unsigned int) bytes->r_index[2] << 16)
+    | ((unsigned int) bytes->r_index[1] << 8)
+    |  bytes->r_index[0]);
+  
   r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
-  r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
-    & RELOC_EXT_BITS_TYPE_LITTLE;
+
+  r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
+    >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
 
   if (r_type > 2)
     {
This page took 0.02659 seconds and 4 git commands to generate.