Make bfd_byte an int8_t, flagword a uint32_t
[binutils-gdb.git] / bfd / elf32-rx.c
index 80d1fe5631264b66fd7fb4c179951a1302a6999e..d14c23831bdf7b3fb536cf8bdfe193c244911857 100644 (file)
@@ -1,5 +1,5 @@
 /* Renesas RX specific support for 32-bit ELF.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -96,7 +96,7 @@ static reloc_howto_type rx_elf_howto_table [] =
   RXREL (RH_GPRELB,  2, 16, 0, unsigned, false),
   RXREL (RH_GPRELW,  2, 16, 0, unsigned, false),
   RXREL (RH_GPRELL,  2, 16, 0, unsigned, false),
-  RXREL (RH_RELAX,   1,         0, 0, dont,     false),
+  RXREL (RH_RELAX,   0,         0, 0, dont,     false),
 
   EMPTY_HOWTO (0x2e),
   EMPTY_HOWTO (0x2f),
@@ -181,25 +181,25 @@ static reloc_howto_type rx_elf_howto_table [] =
   /* A 5-bit unsigned displacement to a B/W/L address, at bit position 8/12.  */
   /* ---- ----   4--- 3210.  */
 #define R_RX_RH_ABS5p8B 0x78
-  RXREL (RH_ABS5p8B,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p8B,   0,  0, 0, dont,    false),
 #define R_RX_RH_ABS5p8W 0x79
-  RXREL (RH_ABS5p8W,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p8W,   0,  0, 0, dont,    false),
 #define R_RX_RH_ABS5p8L 0x7a
-  RXREL (RH_ABS5p8L,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p8L,   0,  0, 0, dont,    false),
   /* A 5-bit unsigned displacement to a B/W/L address, at bit position 5/12.  */
   /* ---- -432   1--- 0---.  */
 #define R_RX_RH_ABS5p5B 0x7b
-  RXREL (RH_ABS5p5B,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p5B,   0,  0, 0, dont,    false),
 #define R_RX_RH_ABS5p5W 0x7c
-  RXREL (RH_ABS5p5W,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p5W,   0,  0, 0, dont,    false),
 #define R_RX_RH_ABS5p5L 0x7d
-  RXREL (RH_ABS5p5L,   1,  0, 0, dont,    false),
+  RXREL (RH_ABS5p5L,   0,  0, 0, dont,    false),
   /* A 4-bit unsigned immediate at bit position 8.  */
 #define R_RX_RH_UIMM4p8 0x7e
-  RXREL (RH_UIMM4p8,   1,  0, 0, dont,    false),
+  RXREL (RH_UIMM4p8,   0,  0, 0, dont,    false),
   /* A 4-bit negative unsigned immediate at bit position 8.  */
 #define R_RX_RH_UNEG4p8 0x7f
-  RXREL (RH_UNEG4p8,   1,  0, 0, dont,    false),
+  RXREL (RH_UNEG4p8,   0,  0, 0, dont,    false),
   /* End of internal relocs.  */
 
   RXREL (SYM,      4, 32, 0, dont, false),
@@ -2038,8 +2038,9 @@ elf32_rx_relax_section (bfd *abfd,
      this section does not have relocs, or if this is not a
      code section.  */
   if (bfd_link_relocatable (link_info)
-      || (sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
+      || (sec->flags & SEC_RELOC) == 0
+      || (sec->flags & SEC_HAS_CONTENTS) == 0
       || (sec->flags & SEC_CODE) == 0)
     return true;
 
@@ -3972,16 +3973,17 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo)
 
   bfd_hash_traverse (&(info->info->hash->table), rx_table_map_2, info);
 
-  fprintf (info->mapfile, "\nRX Vector Table: %s has %d entries at 0x%08" BFD_VMA_FMT "x\n\n",
-          tname, info->table_size, start_addr);
+  fprintf (info->mapfile,
+          "\nRX Vector Table: %s has %d entries at 0x%08" PRIx64 "\n\n",
+          tname, info->table_size, (uint64_t) start_addr);
 
   if (info->table_default_entry)
-    fprintf (info->mapfile, "  default handler is: %s at 0x%08" BFD_VMA_FMT "x\n",
+    fprintf (info->mapfile, "  default handler is: %s at 0x%08" PRIx64 "\n",
             info->table_default_entry->root.string,
-            info->table_default_handler);
+            (uint64_t) info->table_default_handler);
   else if (info->table_default_handler != (bfd_vma)(-1))
-    fprintf (info->mapfile, "  default handler is at 0x%08" BFD_VMA_FMT "x\n",
-            info->table_default_handler);
+    fprintf (info->mapfile, "  default handler is at 0x%08" PRIx64 "\n",
+            (uint64_t) info->table_default_handler);
   else
     fprintf (info->mapfile, "  no default handler\n");
 
@@ -3997,7 +3999,8 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo)
        }
       need_elipses = 1;
 
-      fprintf (info->mapfile, "  0x%08" BFD_VMA_FMT "x [%3d] ", start_addr + 4 * idx, idx);
+      fprintf (info->mapfile,
+              "  0x%08" PRIx64 " [%3d] ", (uint64_t) start_addr + 4 * idx, idx);
 
       if (info->table_handlers[idx] == (bfd_vma) (-1))
        fprintf (info->mapfile, "(no handler found)\n");
@@ -4012,12 +4015,15 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo)
 
       else if (info->table_entries[idx])
        {
-         fprintf (info->mapfile, "0x%08" BFD_VMA_FMT "x %s\n", info->table_handlers[idx], info->table_entries[idx]->root.string);
+         fprintf (info->mapfile, "0x%08" PRIx64 " %s\n",
+                  (uint64_t) info->table_handlers[idx],
+                  info->table_entries[idx]->root.string);
        }
 
       else
        {
-         fprintf (info->mapfile, "0x%08" BFD_VMA_FMT "x ???\n", info->table_handlers[idx]);
+         fprintf (info->mapfile, "0x%08" PRIx64 " ???\n",
+                  (uint64_t) info->table_handlers[idx]);
        }
     }
   if (need_elipses)