mirror of
https://github.com/radareorg/r2ghidra.git
synced 2026-11-07 06:25:57 -10:00
Ignore endian when building sleighid for single endian archs
This commit is contained in:
1 parent
11a688481d
commit
a271227ca9
2 files changed
+39
-7
No files matched your search
+26
-7
@@ -452,14 +452,33 @@ std::string SleighIdFromSleighAsmConfig(RCore *core, const char *cpu, int bits,
|
||||
}
|
||||
// short form if possible
|
||||
std::string low_cpu = tolower (cpu);
|
||||
std::string proc;
|
||||
bool has_be = false;
|
||||
bool has_le = false;
|
||||
for (const auto &lang : langs) {
|
||||
auto proc = lang.getProcessor();
|
||||
if (tolower (proc) == low_cpu) {
|
||||
return proc
|
||||
+ ":" + (bigendian ? "BE" : "LE")
|
||||
+ ":" + to_string (bits)
|
||||
+ ":" + "default";
|
||||
if (tolower (lang.getProcessor ()) != low_cpu) {
|
||||
continue;
|
||||
}
|
||||
proc = lang.getProcessor ();
|
||||
if (lang.getSize () != bits) {
|
||||
continue;
|
||||
}
|
||||
if (lang.isBigEndian ()) {
|
||||
has_be = true;
|
||||
} else {
|
||||
has_le = true;
|
||||
}
|
||||
}
|
||||
return cpu;
|
||||
if (proc.empty ()) {
|
||||
return cpu;
|
||||
}
|
||||
if (bigendian && !has_be && has_le) {
|
||||
bigendian = false;
|
||||
} else if (!bigendian && !has_le && has_be) {
|
||||
bigendian = true;
|
||||
}
|
||||
return proc
|
||||
+ ":" + (bigendian ? "BE" : "LE")
|
||||
+ ":" + to_string (bits)
|
||||
+ ":" + "default";
|
||||
}
|
||||
@@ -552,3 +552,16 @@ EXPECT=<<EOF2
|
||||
0x000000ff
|
||||
EOF2
|
||||
RUN
|
||||
|
||||
NAME=single-endian sleigh cpu ignores unavailable configured endian
|
||||
FILE=malloc://64
|
||||
ARGS=-a r2ghidra -b 32
|
||||
CMDS=<<EOF2
|
||||
e cfg.bigendian=true
|
||||
e asm.cpu=V850
|
||||
pdgss
|
||||
EOF2
|
||||
EXPECT=<<EOF2
|
||||
V850:LE:32:default
|
||||
EOF2
|
||||
RUN
|
||||
Reference in new issue
Block a user