Missing function calls on MIPS
- Dominant language
- C++
- Stars
- 8.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Due to #652, I had to disable string checks in:
```
bugs.dynamic-segment-info-usage.busybox (busybox -k)
```
A lot of the strings are no longer present in the output.
They were present before only because they got stored to registers, but never got used in functions where stores happened.
Now, stores like these get optimized away.
The problem is, that we are missing some functions calls that use these strings as parameters. If they were detected, strings would get used and they would be present in the output.
Example: function `bb_verror_msg()` at `0x42b5f0`.
Before #652 - only one call:
```c
// Address range: 0x42b5f0 - 0x42b678
int32_t bb_verror_msg(int32_t a1, int32_t * a2) {
// 0x42b5f0
g2 = (int32_t)a2;
g1 = a1;
g120 = 0x450f60;
int32_t v1 = g64; // 0x42b610
g128 = v1;
int32_t v2 = g1; // 0x42b618
int32_t v3 = *(int32_t *)v1; // 0x42b61c
g1 = v3;
int32_t v4 = g2; // 0x42b624
fflush(v3);
g2 = (int32_t)"urrently defined functions:\n";
int32_t result = (int32_t)g73;
int32_t * v5 = (int32_t *)g61;
g1 = *v5;
g3 = result;
g2 = (int32_t)"%s: ";
g1 = *v5;
g2 = v2;
g3 = v4;
return result;
}
```
After #652 - the same call, but much less clutter:
```c
// Address range: 0x42b5f0 - 0x42b678
int32_t bb_verror_msg(int32_t a1, int32_t * a2) {
// 0x42b5f0
fflush(*(int32_t *)g40);
return (int32_t)g47;
}
```
Disassembly - looks like `fflush()`, `fprintf()`, and `vfprintf()` should be called:
```asm
LOAD:0042B5F0 bb_verror_msg: # CODE XREF: bb_error_msg+2C↑p
LOAD:0042B5F0 # bb_error_msg_and_die+2C↑p ...
LOAD:0042B5F0
LOAD:0042B5F0 var_18 = -0x18
LOAD:0042B5F0 var_10 = -0x10
LOAD:0042B5F0 var_C = -0xC
LOAD:0042B5F0 var_8 = -8
LOAD:0042B5F0 var_4 = -4
LOAD:0042B5F0
LOAD:0042B5F0 lui $gp, 0x45 # 'E'
LOAD:0042B5F4 addiu $sp, -0x28
LOAD:0042B5F8 li $gp, 0x450F60
LOAD:0042B5FC sw $ra, 0x28+var_4($sp)
LOAD:0042B600 sw $s2, 0x28+var_8($sp)
LOAD:0042B604 sw $s1, 0x28+var_C($sp)
LOAD:0042B608 sw $s0, 0x28+var_10($sp)
LOAD:0042B60C sw $gp, 0x28+var_18($sp)
LOAD:0042B610 la $v0, stdout
LOAD:0042B614 la $t9, fflush
LOAD:0042B618 move $s2, $a0
LOAD:0042B61C lw $a0, (stdout - 0x44CC04)($v0)
LOAD:0042B620 jalr $t9 ; fflush
LOAD:0042B624 move $s1, $a1
LOAD:0042B628 lw $gp, 0x28+var_18($sp)
LOAD:0042B62C lui $a1, 0x43 # 'C'
LOAD:0042B630 la $s0, stderr
LOAD:0042B634 la $v0, bb_applet_name
LOAD:0042B638 la $t9, fprintf
LOAD:0042B63C lw $a0, (stderr - 0x44CBB4)($s0)
LOAD:0042B640 lw $a2, (bb_applet_name - 0x44966C)($v0)
LOAD:0042B644 jalr $t9 ; fprintf
LOAD:0042B648 la $a1, aS_0 # "%s: "
LOAD:0042B64C lw $gp, 0x28+var_18($sp)
LOAD:0042B650 lw $a0, (stderr - 0x44CBB4)($s0)
LOAD:0042B654 la $t9, vfprintf
LOAD:0042B658 move $a1, $s2
LOAD:0042B65C move $a2, $s1
LOAD:0042B660 lw $ra, 0x28+var_4($sp)
LOAD:0042B664 lw $s2, 0x28+var_8($sp)
LOAD:0042B668 lw $s1, 0x28+var_C($sp)
LOAD:0042B66C lw $s0, 0x28+var_10($sp)
LOAD:0042B670 jr $t9 ; vfprintf
LOAD:0042B674 addiu $sp, 0x28
LOAD:0042B674 # End of function bb_verror_msg
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.