mirror of
https://github.com/decompme/decomp.me.git
synced 2026-02-21 13:59:25 -06:00
Checkbox for disabling pseudo instructions for MIPS (#635)
Adds a new checkbox for disabling pseudo instructions on MIPS scratches by passing the `-Mno-aliases` flag to `objdump`. This is disabled by default.  ### Why is this useful? Because GAS likes using the same pseudo instruction for multiple instructions, which sometimes leads to confusion of "why this doesn't match if it is the same instruction". Complains about this usually happen with the `li` pseudo instruction. Example ("both are `li`s, why it doesn't match?!?!?"):  Disabling pseudos ("oh, they actually are different instructions"):  ### Disadvantages Some pseudos are clearer as pseudos than their actual raw instruction; like for example the `nop`, which gets disassembled as `sll, zero, zero, 0x0`. `move` is also an example of this (even if the underlying instruction changes depending on the assembler). There doesn't seem to be any option in `objdump` to only allow some pseudos. `asm-differ` seems to have custom logic for handling `nop`s which gets lost when disabling them, this can be seen in this screenshot:  A workaround for this could be made in the `asm-differ` repo. ### Other I also allowed passing the other objdump flags to PS1 and PS2.
This commit is contained in:
@@ -122,10 +122,12 @@ class DiffWrapper:
|
||||
|
||||
@staticmethod
|
||||
def parse_objdump_flags(diff_flags: List[str]) -> List[str]:
|
||||
known_objdump_flags = ["-Mreg-names=32", "-Mno-aliases"]
|
||||
ret = []
|
||||
|
||||
if "-Mreg-names=32" in diff_flags:
|
||||
ret.append("-Mreg-names=32")
|
||||
for flag in known_objdump_flags:
|
||||
if flag in diff_flags:
|
||||
ret.append(flag)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ COMMON_DIFF_FLAGS: Flags = [
|
||||
|
||||
COMMON_MIPS_DIFF_FLAGS: Flags = [
|
||||
Checkbox("mreg_names=32", "-Mreg-names=32"),
|
||||
Checkbox("mno_aliases", "-Mno-aliases"),
|
||||
Checkbox("no_show_rodata_refs", ASMDIFF_FLAG_PREFIX + "no_show_rodata_refs"),
|
||||
]
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ PS1 = Platform(
|
||||
assemble_cmd='mips-linux-gnu-as -march=r3000 -mabi=32 -o "$OUTPUT" "$INPUT"',
|
||||
objdump_cmd="mips-linux-gnu-objdump",
|
||||
nm_cmd="mips-linux-gnu-nm",
|
||||
diff_flags=COMMON_DIFF_FLAGS + COMMON_MIPS_DIFF_FLAGS,
|
||||
asm_prelude="""
|
||||
.macro .late_rodata
|
||||
.section .rodata
|
||||
@@ -226,6 +227,7 @@ PS2 = Platform(
|
||||
assemble_cmd='mips-linux-gnu-as -march=r5900 -mabi=eabi -o "$OUTPUT" "$INPUT"',
|
||||
objdump_cmd="mips-linux-gnu-objdump",
|
||||
nm_cmd="mips-linux-gnu-nm",
|
||||
diff_flags=COMMON_DIFF_FLAGS + COMMON_MIPS_DIFF_FLAGS,
|
||||
asm_prelude="""
|
||||
.macro .late_rodata
|
||||
.section .rodata
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
"sdata_limit.-G4": "4 bytes",
|
||||
"sdata_limit.-G8": "8 bytes",
|
||||
"mreg_names=32": "ABI FPR names",
|
||||
"mno_aliases": "Disable pseudo instructions",
|
||||
"no_show_rodata_refs": "Hide rodata refs in diff, e.g. jtbl labels",
|
||||
|
||||
"diff_algorithm": "Diff algorithm",
|
||||
|
||||
Reference in New Issue
Block a user