aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2021-04-14 10:00:05 +0800
committerNelson Chu <nelson.chu@sifive.com>2021-04-15 10:32:36 +0800
commitddfe525f2875e76e0c32ff348fc0d3d6aa5fb4a3 (patch)
treee4452f5c8dff39d9d510d56081143e757c507a88 /bfd
parentf6a1f9574955cd2678c66e658d770adda9331995 (diff)
downloadfsf-binutils-gdb-ddfe525f2875e76e0c32ff348fc0d3d6aa5fb4a3.zip
fsf-binutils-gdb-ddfe525f2875e76e0c32ff348fc0d3d6aa5fb4a3.tar.gz
fsf-binutils-gdb-ddfe525f2875e76e0c32ff348fc0d3d6aa5fb4a3.tar.bz2
RISC-V: PR27584, surpress local and empty name symbols for nm.
The local ".L0" symbol are usually generated to mark where the auipc instruction is, and clang also uses ".LBB" to do the same thing. Besides, clang also uses the empty name symbols for label differences. Arm surpress their mapping symbols by regarding them as special symbols, and MIPS surpress all local symbols. Therefore, RISC-V probably need to surpress the local and empty name symbols for nm and related tools. User can use "--special-syms" to show these surpressed symbols. bfd/ PR27584 * elfnn-riscv.c (riscv_elf_is_target_special_symbol): Added to omit local and empty symbols since they usually generated to mark the auipc instructions.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfnn-riscv.c11
2 files changed, 18 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4884aab..702d402 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2021-04-15 Nelson Chu <nelson.chu@sifive.com>
+
+ PR27584
+ * elfnn-riscv.c (riscv_elf_is_target_special_symbol): Added to
+ omit local and empty symbols since they usually generated to
+ mark the auipc instructions.
+
2021-04-15 Lifang Xia<lifang_xia@c-sky.com>
* elf32-csky.c (csky_elf_howto_table)
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 5e29278..a944b33 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -5094,6 +5094,16 @@ riscv_elf_obj_attrs_arg_type (int tag)
return (tag & 1) != 0 ? ATTR_TYPE_FLAG_STR_VAL : ATTR_TYPE_FLAG_INT_VAL;
}
+/* PR27584, Omit local and empty symbols since they usually generated
+ for pcrel relocations. */
+
+static bool
+riscv_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
+{
+ return (!strcmp (sym->name, "")
+ || _bfd_elf_is_local_label_name (abfd, sym->name));
+}
+
#define TARGET_LITTLE_SYM riscv_elfNN_vec
#define TARGET_LITTLE_NAME "elfNN-littleriscv"
#define TARGET_BIG_SYM riscv_elfNN_be_vec
@@ -5106,6 +5116,7 @@ riscv_elf_obj_attrs_arg_type (int tag)
#define bfd_elfNN_bfd_reloc_type_lookup riscv_reloc_type_lookup
#define bfd_elfNN_bfd_merge_private_bfd_data \
_bfd_riscv_elf_merge_private_bfd_data
+#define bfd_elfNN_bfd_is_target_special_symbol riscv_elf_is_target_special_symbol
#define elf_backend_copy_indirect_symbol riscv_elf_copy_indirect_symbol
#define elf_backend_create_dynamic_sections riscv_elf_create_dynamic_sections