0006-elf2flt-xtensa-fix-text-relocations.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. diff -Nur elf2flt-v2021.08.orig/elf2flt.c elf2flt-v2021.08/elf2flt.c
  2. --- elf2flt-v2021.08.orig/elf2flt.c 2023-01-09 11:08:28.637676113 +0100
  3. +++ elf2flt-v2021.08/elf2flt.c 2023-01-09 11:09:04.502804007 +0100
  4. @@ -835,7 +835,20 @@
  5. continue;
  6. case R_XTENSA_32:
  7. case R_XTENSA_PLT:
  8. - goto good_32bit_resolved_reloc;
  9. + if (bfd_big_endian (abs_bfd))
  10. + sym_addr =
  11. + (r_mem[0] << 24)
  12. + + (r_mem[1] << 16)
  13. + + (r_mem[2] << 8)
  14. + + r_mem[3];
  15. + else
  16. + sym_addr =
  17. + r_mem[0]
  18. + + (r_mem[1] << 8)
  19. + + (r_mem[2] << 16)
  20. + + (r_mem[3] << 24);
  21. + relocation_needed = 1;
  22. + break;
  23. default:
  24. goto bad_resolved_reloc;
  25. #elif defined(TARGET_riscv64)
  26. diff -Nur elf2flt-v2021.08.orig/elf2flt.c.orig elf2flt-v2021.08/elf2flt.c.orig
  27. --- elf2flt-v2021.08.orig/elf2flt.c.orig 2023-01-09 11:08:22.417478947 +0100
  28. +++ elf2flt-v2021.08/elf2flt.c.orig 2023-01-09 11:08:28.637676113 +0100
  29. @@ -349,8 +349,15 @@
  30. static bool
  31. ro_reloc_data_section_should_be_in_text(asection *s)
  32. {
  33. - return (s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
  34. - (SEC_DATA | SEC_READONLY | SEC_RELOC);
  35. + if ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
  36. + (SEC_DATA | SEC_READONLY | SEC_RELOC)) {
  37. +#if defined(TARGET_m68k) || defined(TARGET_riscv64) || defined(TARGET_xtensa)
  38. + if (!strcmp(".eh_frame", s->name))
  39. + return false;
  40. +#endif
  41. + return true;
  42. + }
  43. + return false;
  44. }
  45. static uint32_t *