0007-riscv32.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. diff -Nur elf2flt-v2021.08.orig/elf2flt.c elf2flt-v2021.08/elf2flt.c
  2. --- elf2flt-v2021.08.orig/elf2flt.c 2023-02-26 11:31:48.758810872 +0100
  3. +++ elf2flt-v2021.08/elf2flt.c 2023-02-26 11:32:05.714465277 +0100
  4. @@ -81,7 +81,7 @@
  5. #include <elf/v850.h>
  6. #elif defined(TARGET_xtensa)
  7. #include <elf/xtensa.h>
  8. -#elif defined(TARGET_riscv64)
  9. +#elif defined(TARGET_riscv64) || defined(TARGET_riscv32)
  10. #include <elf/riscv.h>
  11. #endif
  12. @@ -127,6 +127,8 @@
  13. #define ARCH "xtensa"
  14. #elif defined(TARGET_riscv64)
  15. #define ARCH "riscv64"
  16. +#elif defined(TARGET_riscv32)
  17. +#define ARCH "riscv32"
  18. #else
  19. #error "Don't know how to support your CPU architecture??"
  20. #endif
  21. @@ -849,12 +851,21 @@
  22. break;
  23. default:
  24. goto bad_resolved_reloc;
  25. -#elif defined(TARGET_riscv64)
  26. +#elif defined(TARGET_riscv64) || defined(TARGET_riscv32)
  27. case R_RISCV_32_PCREL:
  28. + case R_RISCV_ADD8:
  29. + case R_RISCV_ADD16:
  30. case R_RISCV_ADD32:
  31. case R_RISCV_ADD64:
  32. + case R_RISCV_SUB6:
  33. + case R_RISCV_SUB8:
  34. + case R_RISCV_SUB16:
  35. case R_RISCV_SUB32:
  36. case R_RISCV_SUB64:
  37. + case R_RISCV_SET6:
  38. + case R_RISCV_SET8:
  39. + case R_RISCV_SET16:
  40. + case R_RISCV_SET32:
  41. continue;
  42. case R_RISCV_32:
  43. case R_RISCV_64:
  44. diff -Nur elf2flt-v2021.08.orig/ld-elf2flt.c elf2flt-v2021.08/ld-elf2flt.c
  45. --- elf2flt-v2021.08.orig/ld-elf2flt.c 2023-02-26 11:31:21.047376888 +0100
  46. +++ elf2flt-v2021.08/ld-elf2flt.c 2023-02-26 11:32:05.714465277 +0100
  47. @@ -327,7 +327,7 @@
  48. /* riscv adds a global pointer symbol to the linker file with the
  49. "RISCV_GP:" prefix. Remove the prefix for riscv64 architecture and
  50. the entire line for other architectures. */
  51. - if (streq(TARGET_CPU, "riscv64"))
  52. + if (streq(TARGET_CPU, "riscv64") || streq(TARGET_CPU, "riscv32"))
  53. append_sed(&sed, "^RISCV_GP:", "");
  54. else
  55. append_sed(&sed, "^RISCV_GP:", NULL);