@@ -204,7 +204,21 @@ impl ObjArch for ObjArchPpc {
204
204
return Some ( DataType :: String ) ;
205
205
}
206
206
207
- guess_data_type_from_load_store_inst_op ( Opcode :: from ( instruction. op as u8 ) )
207
+ let op = Opcode :: from ( instruction. op as u8 ) ;
208
+ if let Some ( ty) = guess_data_type_from_load_store_inst_op ( op) {
209
+ Some ( ty)
210
+ } else if op == Opcode :: Addi {
211
+ // Assume that any addi instruction that references a local symbol is loading a string.
212
+ // This hack is not ideal and results in tons of false positives where it will show
213
+ // garbage strings (e.g. misinterpreting arrays, float literals, etc).
214
+ // But there isn't much other choice as not all strings are in the @stringBase pool.
215
+ // And even those that are would be missed by the target.name.starts_with("@stringBase")
216
+ // hack above for fake pooled relocations, as they have an empty string placeholder for
217
+ // the target symbol name.
218
+ Some ( DataType :: String )
219
+ } else {
220
+ None
221
+ }
208
222
}
209
223
210
224
fn display_data_type ( & self , ty : DataType , bytes : & [ u8 ] ) -> Option < String > {
@@ -422,7 +436,7 @@ fn get_offset_and_addr_gpr_for_possible_pool_reference(
422
436
}
423
437
} else {
424
438
// If it's not a load/store instruction, there's two more possibilities we need to handle.
425
- // 1. It could be a reference to @stringBase .
439
+ // 1. It could be loading a pointer to a string .
426
440
// 2. It could be moving the relocation address plus an offset into a different register to
427
441
// load from later.
428
442
// If either of these match, we also want to return the destination register that the
0 commit comments