]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V: Resurrect GP-relative disassembly hints
authorPalmer Dabbelt <palmer@dabbelt.com>
Mon, 3 Apr 2017 17:08:29 +0000 (10:08 -0700)
committerPalmer Dabbelt <palmer@dabbelt.com>
Fri, 5 May 2017 18:34:53 +0000 (11:34 -0700)
We missed a "_gp" when changing the GP symbol.  To make sure that
doesn't happen again, we now use the same definition everywhere (thanks,
Nick).

include/ChangeLog:

2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>

        * elf/riscv.h (RISCV_GP_SYMBOL): New define.

bfd/ChangeLog:

2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>

        * elfnn-riscv.c (GP_NAME): Delete.
        (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
        (_bfd_riscv_relax_lui): Likewise.

opcodes/ChangeLog:

2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>

        * riscv-dis.c (riscv_disassemble_insn): Change "_gp" to
        RISCV_GP_SYMBOL.

bfd/ChangeLog
bfd/elfnn-riscv.c
include/ChangeLog
include/elf/riscv.h
opcodes/ChangeLog
opcodes/riscv-dis.c

index 0ba4d258d774f207247d6120c0f8d7a8bd4f4e22..bbca87370f0f66dc91c4d565b2fc0eb3834ab72a 100644 (file)
@@ -1,3 +1,9 @@
+2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
+
+       * elfnn-riscv.c (GP_NAME): Delete.
+       (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
+       (_bfd_riscv_relax_lui): Likewise.
+
 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
 
        * elfnn-riscv.c (riscv_elf_object_p): New function.
index d1e62d04cd26badd04a3ae1af52a3e90f0760112..3c04507623c3e24142b89c97ac92e02d8f8a2fd3 100644 (file)
 #define ELF_MAXPAGESIZE                        0x1000
 #define ELF_COMMONPAGESIZE             0x1000
 
-/* The global pointer's symbol name.  */
-
-#define GP_NAME "__global_pointer$"
-
 /* The RISC-V linker needs to keep track of the number of relocs that it
    decides to copy as dynamic relocs in check_relocs for each symbol.
    This is so that it can later discard them if they are found to be
@@ -1467,7 +1463,7 @@ riscv_global_pointer_value (struct bfd_link_info *info)
 {
   struct bfd_link_hash_entry *h;
 
-  h = bfd_link_hash_lookup (info->hash, GP_NAME, FALSE, FALSE, TRUE);
+  h = bfd_link_hash_lookup (info->hash, RISCV_GP_SYMBOL, FALSE, FALSE, TRUE);
   if (h == NULL || h->type != bfd_link_hash_defined)
     return 0;
 
@@ -2818,7 +2814,8 @@ _bfd_riscv_relax_lui (bfd *abfd,
       /* If gp and the symbol are in the same output section, then
         consider only that section's alignment.  */
       struct bfd_link_hash_entry *h =
-       bfd_link_hash_lookup (link_info->hash, GP_NAME, FALSE, FALSE, TRUE);
+       bfd_link_hash_lookup (link_info->hash, RISCV_GP_SYMBOL, FALSE, FALSE,
+                             TRUE);
       if (h->u.def.section->output_section == sym_sec->output_section)
        max_alignment = (bfd_vma) 1 << sym_sec->output_section->alignment_power;
     }
index 5995c3b4392c354a692b028c6da96af68091708c..dddecfb49b68f0a003bb7f477d133c235b8b11e9 100644 (file)
@@ -1,3 +1,7 @@
+2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
+
+       * elf/riscv.h (RISCV_GP_SYMBOL): New define.
+
 2017-03-27  Andrew Waterman  <andrew@sifive.com>
 
        * opcode/riscv-opc.h (CSR_PMPCFG0): New define.
index 526bc11f1544b5db98857528350e8732bbe134ac..daa44639263c17a2202aa01dbba6115b0d4040be 100644 (file)
@@ -109,4 +109,7 @@ END_RELOC_NUMBERS (R_RISCV_max)
 /* File uses the quad-float ABI.  */
 #define EF_RISCV_FLOAT_ABI_QUAD 0x0006
 
+/* The name of the global pointer symbol.  */
+#define RISCV_GP_SYMBOL "__global_pointer$"
+
 #endif /* _ELF_RISCV_H */
index 0517fd94e1a77783227054cad48321f0a580886e..2a5410a61165e6037a8ea1d88f104e53a126c26d 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
+
+       * riscv-dis.c (riscv_disassemble_insn): Change "_gp" to
+       RISCV_GP_SYMBOL.
+
 2017-03-14  Kito Cheng  <kito.cheng@gmail.com>
 
        * riscv-opc.c (riscv_opcodes> <c.li>: Use the 'o' immediate encoding.
index 070c96ec74eaae6aafe646095ff89815e233357e..bdc961c317b5c70bc8c9d6eb93ea7742fcdd7c09 100644 (file)
@@ -383,7 +383,7 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info)
        pd->hi_addr[i] = -1;
 
       for (i = 0; i < info->symtab_size; i++)
-       if (strcmp (bfd_asymbol_name (info->symtab[i]), "_gp") == 0)
+       if (strcmp (bfd_asymbol_name (info->symtab[i]), RISCV_GP_SYMBOL) == 0)
          pd->gp = bfd_asymbol_value (info->symtab[i]);
     }
   else