049-mcfv4e_linker_bss_cleanup.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From 4e16f08c800d57b986217e0d39d4a06b5bdf641d Mon Sep 17 00:00:00 2001
  2. From: Kurt Mahan <[email protected]>
  3. Date: Wed, 19 Mar 2008 17:37:44 -0600
  4. Subject: [PATCH] Move BSS section in linker script and zero it on boot.
  5. To work with the latest round of toolchains the bss section
  6. in the linker script needed to be moved to the end (due to
  7. the linker thinking there were overlapping sections).
  8. The BSS section needs to be manually zeroed.
  9. LTIBName: mcfv4e-linker-bss-cleanup
  10. Signed-off-by: Kurt Mahan <[email protected]>
  11. ---
  12. arch/m68k/coldfire/head.S | 11 +++++++++++
  13. arch/m68k/coldfire/vmlinux-cf.lds | 11 ++++++++---
  14. 2 files changed, 19 insertions(+), 3 deletions(-)
  15. --- a/arch/m68k/coldfire/head.S
  16. +++ b/arch/m68k/coldfire/head.S
  17. @@ -321,6 +321,17 @@ ENTRY(__start)
  18. movec %d0, %acr3
  19. nop
  20. +#ifdef CONFIG_COLDFIRE
  21. +/* zero bss */
  22. + lea _sbss,%a0
  23. + lea _ebss,%a1
  24. + clrl %d0
  25. +_loop_bss:
  26. + movel %d0,(%a0)+
  27. + cmpl %a0,%a1
  28. + bne _loop_bss
  29. +#endif
  30. +
  31. /* If you change the memory size to another value make a matching
  32. change in paging_init(cf-mmu.c) to zones_size[]. */
  33. --- a/arch/m68k/coldfire/vmlinux-cf.lds
  34. +++ b/arch/m68k/coldfire/vmlinux-cf.lds
  35. @@ -51,9 +51,6 @@ SECTIONS
  36. CONSTRUCTORS
  37. } :data
  38. - .bss : AT(ADDR(.bss) - LOAD_OFFSET) { /* BSS */
  39. - *(.bss)
  40. - }
  41. . = ALIGN(16);
  42. .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET ) {
  43. @@ -62,6 +59,8 @@ SECTIONS
  44. _edata = .; /* End of data section */
  45. + NOTES /* support ld --build-id */
  46. +
  47. . = ALIGN(8192); /* Initrd */
  48. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  49. __init_begin = .;
  50. @@ -111,6 +110,12 @@ SECTIONS
  51. *(.data.init_task) /* The initial task and kernel stack */
  52. }
  53. + _sbss = .;
  54. + .bss : AT(ADDR(.bss) - LOAD_OFFSET) { /* BSS */
  55. + *(.bss)
  56. + }
  57. + _ebss = .;
  58. +
  59. _end = . ;
  60. /* Sections to be discarded */