1 From 8858927ddc6797489cad322fc2d2134aeae543cd Mon Sep 17 00:00:00 2001
2 From: Arnaud Lacombe <lacombar@gmail.com>
3 Date: Sun, 11 Dec 2011 16:44:02 -0500
4 Subject: [PATCH] add-stage2-ldscripts
7 stage2/Makefile.am | 2 +-
8 stage2/Makefile.in | 2 +-
9 stage2/stage2.ldscripts | 30 ++++++++++++++++++++++++++++++
10 3 files changed, 32 insertions(+), 2 deletions(-)
11 create mode 100644 stage2/stage2.ldscripts
13 diff --git a/stage2/Makefile.am b/stage2/Makefile.am
14 index f8e6d42..ea28a4d 100644
15 --- a/stage2/Makefile.am
16 +++ b/stage2/Makefile.am
17 @@ -55,7 +55,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
19 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
21 -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
22 +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
23 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
24 NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
25 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
26 diff --git a/stage2/Makefile.in b/stage2/Makefile.in
27 index d0062bd..7bee2d5 100644
28 --- a/stage2/Makefile.in
29 +++ b/stage2/Makefile.in
30 @@ -468,7 +468,7 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
31 @DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito
32 @DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
33 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
34 -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
35 +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
36 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
37 NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
38 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
39 diff --git a/stage2/stage2.ldscripts b/stage2/stage2.ldscripts
41 index 0000000..2c8b8e1
43 +++ b/stage2/stage2.ldscripts
45 +/* Script for -N: mix text and data on same page; don't align data */
46 +OUTPUT_FORMAT("elf32-i386", "elf32-i386",
58 + .rodata : { *(.rodata .rodata.* ) }
59 + /* Adjust the address for the data segment. We want to adjust up to
60 + the same address within the page on the next page up. */
62 + .data : { *(.data .data.* ) }
68 + . = ALIGN(. != 0 ? 32 / 8 : 1);
72 + _end = .; PROVIDE (end = .);
73 + .comment 0 : { *(.comment) }