030-add-stage2-ldscripts.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From 8858927ddc6797489cad322fc2d2134aeae543cd Mon Sep 17 00:00:00 2001
  2. From: Arnaud Lacombe <[email protected]>
  3. Date: Sun, 11 Dec 2011 16:44:02 -0500
  4. Subject: [PATCH] add-stage2-ldscripts
  5. ---
  6. stage2/Makefile.am | 2 +-
  7. stage2/Makefile.in | 2 +-
  8. stage2/stage2.ldscripts | 30 ++++++++++++++++++++++++++++++
  9. 3 files changed, 32 insertions(+), 2 deletions(-)
  10. create mode 100644 stage2/stage2.ldscripts
  11. diff --git a/stage2/Makefile.am b/stage2/Makefile.am
  12. index f8e6d42..ea28a4d 100644
  13. --- a/stage2/Makefile.am
  14. +++ b/stage2/Makefile.am
  15. @@ -55,7 +55,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
  16. endif
  17. MOSTLYCLEANFILES = $(noinst_PROGRAMS)
  18. -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
  19. +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
  20. START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
  21. NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
  22. PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
  23. diff --git a/stage2/Makefile.in b/stage2/Makefile.in
  24. index d0062bd..7bee2d5 100644
  25. --- a/stage2/Makefile.in
  26. +++ b/stage2/Makefile.in
  27. @@ -468,7 +468,7 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
  28. @DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito
  29. @DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
  30. MOSTLYCLEANFILES = $(noinst_PROGRAMS)
  31. -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
  32. +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
  33. START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
  34. NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
  35. PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
  36. diff --git a/stage2/stage2.ldscripts b/stage2/stage2.ldscripts
  37. new file mode 100644
  38. index 0000000..2c8b8e1
  39. --- /dev/null
  40. +++ b/stage2/stage2.ldscripts
  41. @@ -0,0 +1,30 @@
  42. +/* Script for -N: mix text and data on same page; don't align data */
  43. +OUTPUT_FORMAT("elf32-i386", "elf32-i386",
  44. + "elf32-i386")
  45. +OUTPUT_ARCH(i386)
  46. +ENTRY(_start)
  47. +SECTIONS
  48. +{
  49. + . = 0x8200;
  50. + .text :
  51. + {
  52. + _start = .;
  53. + *(.text .text.* )
  54. + }
  55. + .rodata : { *(.rodata .rodata.* ) }
  56. + /* Adjust the address for the data segment. We want to adjust up to
  57. + the same address within the page on the next page up. */
  58. + . = .;
  59. + .data : { *(.data .data.* ) }
  60. + __bss_start = .;
  61. + .bss :
  62. + {
  63. + *(.bss .bss.* )
  64. + *(COMMON)
  65. + . = ALIGN(. != 0 ? 32 / 8 : 1);
  66. + }
  67. + . = ALIGN(32 / 8);
  68. + . = ALIGN(32 / 8);
  69. + _end = .; PROVIDE (end = .);
  70. + .comment 0 : { *(.comment) }
  71. +}
  72. --
  73. 1.7.6.153.g78432