aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-riscv.c
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2021-01-04 10:12:45 +0800
committerNelson Chu <nelson.chu@sifive.com>2021-01-04 11:17:33 +0800
commit4c0e540e47e8ea26e20246c33c744306944b4cb8 (patch)
treeb0c211f9ec492e90888cad664152051df6fe1cf1 /bfd/elfnn-riscv.c
parente9cf3691bfa140469d52815a2307b00eecf7917c (diff)
downloadgdb-4c0e540e47e8ea26e20246c33c744306944b4cb8.zip
gdb-4c0e540e47e8ea26e20246c33c744306944b4cb8.tar.gz
gdb-4c0e540e47e8ea26e20246c33c744306944b4cb8.tar.bz2
RISC-V: Fix the merged orders of Z* extension for linker.
Similar to the commit 6729e2c2af2bd94408430734316597843718a484, we have to check the first char of the Z* extensions, to make sure that they follow the order of the standard extensions. bfd/ * elfxx-riscv.c (riscv_compare_subsets): Removed static. * elfxx-riscv.h: Add declaration. * elfnn-riscv.c (riscv_merge_multi_letter_ext): Use riscv_compare_subsets to check the orders. (riscv_skip_prefix): Removed. (riscv_prefix_cmp): Removed.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r--bfd/elfnn-riscv.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index dff0d4d..047f31b 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -3410,39 +3410,6 @@ riscv_merge_std_ext (bfd *ibfd,
return TRUE;
}
-/* If C is a prefix class, then return the EXT string without the prefix.
- Otherwise return the entire EXT string. */
-
-static const char *
-riscv_skip_prefix (const char *ext, riscv_isa_ext_class_t c)
-{
- switch (c)
- {
- case RV_ISA_CLASS_X: return &ext[1];
- case RV_ISA_CLASS_S: return &ext[1];
- case RV_ISA_CLASS_Z: return &ext[1];
- default: return ext;
- }
-}
-
-/* Compare prefixed extension names canonically. */
-
-static int
-riscv_prefix_cmp (const char *a, const char *b)
-{
- riscv_isa_ext_class_t ca = riscv_get_prefix_class (a);
- riscv_isa_ext_class_t cb = riscv_get_prefix_class (b);
-
- /* Extension name without prefix */
- const char *anp = riscv_skip_prefix (a, ca);
- const char *bnp = riscv_skip_prefix (b, cb);
-
- if (ca == cb)
- return strcasecmp (anp, bnp);
-
- return (int)ca - (int)cb;
-}
-
/* Merge multi letter extensions. PIN is a pointer to the head of the input
object subset list. Likewise for POUT and the output object. Return TRUE
on success and FALSE when a conflict is found. */
@@ -3460,7 +3427,7 @@ riscv_merge_multi_letter_ext (bfd *ibfd,
while (in && out)
{
- cmp = riscv_prefix_cmp (in->name, out->name);
+ cmp = riscv_compare_subsets (in->name, out->name);
if (cmp < 0)
{