aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-07-26 07:45:54 +0930
committerAlan Modra <amodra@gmail.com>2025-07-26 07:50:49 +0930
commitc97c1a7d58fa787ef5c118a028e2d92353cb437c (patch)
treeed764baad2dc3efa61f078cd3663ff289852f506
parent3a7f7d0be3a2953fd110f084b34586ce9c649d66 (diff)
downloadbinutils-c97c1a7d58fa787ef5c118a028e2d92353cb437c.zip
binutils-c97c1a7d58fa787ef5c118a028e2d92353cb437c.tar.gz
binutils-c97c1a7d58fa787ef5c118a028e2d92353cb437c.tar.bz2
PR 33214 sparc LDM/STM/LDMA/STMA etc. FAIL on Solaris/SPARC
Delete code in compare_opcodes preferencing 1+i over i+1 and 1,i over i,1. Instead simply make the sort stable, by keeping the original table order.
-rw-r--r--opcodes/sparc-dis.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c
index 1138136..f935783 100644
--- a/opcodes/sparc-dis.c
+++ b/opcodes/sparc-dis.c
@@ -387,40 +387,12 @@ compare_opcodes (const void * a, const void * b)
return length_diff;
}
- /* Put 1+i before i+1. */
- {
- char *p0 = (char *) strchr (op0->args, '+');
- char *p1 = (char *) strchr (op1->args, '+');
-
- if (p0 && p1)
- {
- /* There is a plus in both operands. Note that a plus
- sign cannot be the first character in args,
- so the following [-1]'s are valid. */
- if (p0[-1] == 'i' && p1[1] == 'i')
- /* op0 is i+1 and op1 is 1+i, so op1 goes first. */
- return 1;
- if (p0[1] == 'i' && p1[-1] == 'i')
- /* op0 is 1+i and op1 is i+1, so op0 goes first. */
- return -1;
- }
- }
-
- /* Put 1,i before i,1. */
- {
- int i0 = strncmp (op0->args, "i,1", 3) == 0;
- int i1 = strncmp (op1->args, "i,1", 3) == 0;
-
- if (i0 ^ i1)
- return i0 - i1;
- }
-
- /* They are, as far as we can tell, identical.
- Since qsort may have rearranged the table partially, there is
- no way to tell which one was first in the opcode table as
- written, so just say there are equal. */
- /* ??? This is no longer true now that we sort a vector of pointers,
- not the table itself. */
+ /* They are, as far as we can tell, identical. Keep the order in
+ the sparc_opcodes table. */
+ if (op0 < op1)
+ return -1;
+ if (op0 > op1)
+ return 1;
return 0;
}