aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-riscv.c
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-04-03 10:08:29 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-04-04 08:29:16 -0700
commitb52920324fabbcad93042f2e17de52696d0dab42 (patch)
tree35f0068b46fd2e207feba053509415467c86ac11 /bfd/elfnn-riscv.c
parent65dd1e590e519eba10bc29fb6e952271e0604c9b (diff)
RISC-V: Resurrect GP-relative disassembly hints
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.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r--bfd/elfnn-riscv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index e476bb150b..38f12d0f58 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -52,10 +52,6 @@
#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;
}