arch/arm32_code_inference

ARM32 architecture-specific rules for code inference.

arm_ver_order(Name:symbol, VersionID:unsigned)

Assign ARM version names to their generation number

e.g., “v7E_M” -> 7

  • Used by: +disconnected7

init_ldr_add_pc(EA_ldr:address, Size:unsigned, Reg1:register, LitPoolAddr:address, EA_add_pc:address, Reg2:register)

ldr Reg1, .L0 add Reg2, Reg1, pc

Uses straight_line_def_used, which is a weaker version of def_used that can be used before code inference.

init_symbol_minus_symbol_candidate_arm(EA:address, Size:unsigned, Symbol1:address, Symbol2:address, Scale:unsigned, Offset:number)

A weaker version of cinf_symbol_minus_symbol_candidate_arm that can be used before code inference. see the comment of cinf_symbol_minus_symbol_candidate_arm.

data_block_limit(Limit:address)

Addresses where the propagation of indefinite data blocks should be limited.

Similar to (and a superset of) block_limit for code blocks.

indefinite_litpool_ref(Start:address, Size:unsigned)

References to potential litpools with indeterminate sizes.

litpool_boundaries(BegAddr:address, EndAddr:address)

overlap_with_litpool(Block:address)

Check if the given block overlaps with a possible literal pool.

litpool_confidence(EARef:address, LitPoolAddr:address, Reason:symbol)

Confidence level for each literal pool

code_to_litpool_ref_point_transfer(Reason:symbol)

mode_min_instruction_size(Mode:unsigned, Size:unsigned)

Minimum instruction size for each execution mode.

Mode can be 0 (ARM) or 1 (Thumb)

branch_to_calculated_pc_rel_addr(EA:address, Dest:address)

A computed PC-relative address that isn’t a jump table.

This example was generated in zlib with gcc 9.4. -Os:

adr r1, Label add r2, r1, r2, lsl #4 mov pc, r2

.Label:

cmp r3, r1, lsl #31 nop adc r0, r0, r0 it hs subhs r3, r3, r1, lsl #31

.Label+16:

cmp r3, r1, lsl #30 nop adc r0, r0, r0 it hs subhs r3, r3, r1, lsl #30

.Label+32:

In the above pattern, Label is supposed to be code rather than data (literal pools).