Closed ryanmkurtz closed 4 years ago
Could you please provide a fully linked binary which includes this object module. Need to ensure that while addressing object module concerns we do not break those for a fully linked module.
Sure:
There are a number of issues involved:
Additionally, the object file for this code introduces two new relocation types that aren't implemented: 0x15 and 0x18.
__prog__ const char __attribute__((space(psv))) hello_world[] = "Hello World";
int main(void) {
printf("%s\n", hello_world);
printf("Hello World!\n");
}
__prog__ const char __attribute__((space(psv))) hello_world[] = "Hello World";
int main(void) {
printf("%s, %d\n", hello_world, 5);
printf("Hello World, %d\n", 6);
}
__prog__ const char __attribute__((space(psv))) hello_world[] = "Hello World";
int sum(int n, ...) {
int i, ret = 0;
va_list valist;
va_start(valist, n);
for (i = 0; i < n; i++) {
ret += va_arg(valist, int);
}
va_end(valist);
return ret;
}
int main(void) {
printf("%s, %d\n", hello_world, 5);
printf("Hello World, %d\n", 6);
printf("sum(5, 1,2,3,4,5) = %d", sum(5,1,2,3,4,5));
}
Fixed by 305a1ddf98076cfe540e1d7046dc774fd6b89a67
Fixed in master and future 9.2
Here is a small program's ELF object file for the dsPIC30:
Here is objdump's relocation information for the
.text
section:And Ghidra's corresponding relocation table entry:
Ghidra appears to be fixing up relocations in the wrong locations, resulting in a bad call target and a corrupted return instruction.
main.zip