ecf4266cc71f52045460c4021fdd7b971f119562.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From ecf4266cc71f52045460c4021fdd7b971f119562 Mon Sep 17 00:00:00 2001
  2. From: Aaron Haun <aaron@haun.guru>
  3. Date: Fri, 28 Apr 2023 22:19:32 +0000
  4. Subject: [PATCH] armcm: Add exception index and dummy heap for newlib 4.3+
  5. Signed-off-by: Aaron B. Haun <aaron@haun.guru>
  6. ---
  7. src/generic/armcm_link.lds.S | 23 +++++++++++++++++++++++
  8. 1 file changed, 23 insertions(+)
  9. diff --git a/src/generic/armcm_link.lds.S b/src/generic/armcm_link.lds.S
  10. index 2f789f1301e..14f50b026fc 100644
  11. --- a/src/generic/armcm_link.lds.S
  12. +++ b/src/generic/armcm_link.lds.S
  13. @@ -26,6 +26,12 @@ SECTIONS
  14. *(.rodata .rodata*)
  15. } > rom
  16. + .ARM.exidx : {
  17. + __exidx_start = .;
  18. + *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  19. + __exidx_end = .;
  20. + } > rom
  21. +
  22. . = ALIGN(4);
  23. _data_flash = .;
  24. @@ -64,6 +70,23 @@ SECTIONS
  25. _stack_end = .;
  26. } > ram
  27. + // Versions of newlib with libnosys require a heap end marker even
  28. + // in C freestanding mode. This creates a one byte heap.
  29. + // !! WARNING: The version of sbrk in libnosys does NOT check
  30. + // for the heap overrunning its allocation. Trying to expand the heap
  31. + // will have undefined behavior.
  32. + // Note: 'end' below refers to the initial end of the heap,
  33. + // while __heap_end__ refers to the last available address
  34. + .heap (NOLOAD) :
  35. + {
  36. + __heap_start__ = .;
  37. + end = __heap_start__;
  38. + _end = end;
  39. + __end = end;
  40. + __heap_end__ = .;
  41. + __HeapLimit = __heap_end__;
  42. + } > ram
  43. +
  44. /DISCARD/ : {
  45. // The .init/.fini sections are used by __libc_init_array(), but
  46. // that isn't needed so no need to include them in the binary.