summaryrefslogtreecommitdiff
path: root/com32/lib/com32.ld
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-24 19:01:02 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-24 19:01:02 -0700
commit04e7c2784dd3fd45090d1ddb31905dd7a9b921a3 (patch)
treefbe5e2df0e93dddcb4b34d44755d433d84663f38 /com32/lib/com32.ld
parent24ffb34fcff5b50b56d987e18dcf519e278c771e (diff)
downloadsyslinux-04e7c2784dd3fd45090d1ddb31905dd7a9b921a3.tar.gz
com32: make com32 modules self-relocating (COM32R)
Introduce a new "COM32R" format, which is exactly like COM32 except that they contain position-independent code. Therefore, the core can load them at any sufficiently aligned address; by protocol select 4K as the alignment. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/lib/com32.ld')
-rw-r--r--com32/lib/com32.ld65
1 files changed, 41 insertions, 24 deletions
diff --git a/com32/lib/com32.ld b/com32/lib/com32.ld
index 36d5b6ed..41e88da4 100644
--- a/com32/lib/com32.ld
+++ b/com32/lib/com32.ld
@@ -11,7 +11,7 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x101000;
+ . = 0;
PROVIDE (__executable_start = .);
.init :
@@ -39,29 +39,44 @@ SECTIONS
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(4);
- PROVIDE (__preinit_array_start = .);
- .preinit_array : { *(.preinit_array) }
- PROVIDE (__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
- .init_array : { *(.init_array) }
- PROVIDE (__init_array_end = .);
- PROVIDE (__fini_array_start = .);
- .fini_array : { *(.fini_array) }
- PROVIDE (__fini_array_end = .);
- PROVIDE (__ctors_start = .);
- .ctors :
- {
+ .preinit_array : {
+ PROVIDE (__preinit_array_start = .);
+ *(.preinit_array)
+ PROVIDE (__preinit_array_end = .);
+ }
+ .init_array : {
+ PROVIDE (__init_array_start = .);
+ *(.init_array)
+ PROVIDE (__init_array_end = .);
+ }
+ .fini_array : {
+ PROVIDE (__fini_array_start = .);
+ *(.fini_array)
+ PROVIDE (__fini_array_end = .);
+ }
+ .ctors : {
+ PROVIDE (__ctors_start = .);
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
+ PROVIDE (__ctors_end = .);
}
- PROVIDE (__ctors_end = .);
- PROVIDE (__dtors_start = .);
- .dtors :
- {
+ .dtors : {
+ PROVIDE (__dtors_start = .);
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
+ PROVIDE (__dtors_end = .);
+ }
+
+ .got : {
+ PROVIDE (__got_start = .);
+ KEEP (*(.got))
+ PROVIDE (__got_end = .);
+ }
+ .got.plt : {
+ PROVIDE (__got_plt_start = .);
+ KEEP (*(.got.plt))
+ PROVIDE (__got_plt_end = .);
}
- PROVIDE (__dtors_end = .);
/* Adjust the address for the data segment. Avoid mixing code and
data within same 128-byte chunk. */
@@ -69,12 +84,14 @@ SECTIONS
.data :
{
- *(.data .data.* .gnu.linkonce.d.*)
+ _sdata = .;
+ KEEP(*(.data .data.* .gnu.linkonce.d.*))
SORT(CONSTRUCTORS)
+ *(.data1)
+ . = ALIGN(4);
+ _edata = .;
}
- .data1 : { *(.data1) }
- _edata = .;
- PROVIDE (edata = .);
+
__bss_start = .;
.bss :
{
@@ -84,9 +101,9 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(4);
}
- . = ALIGN(32 / 8);
+ . = ALIGN(4);
_end = .;
PROVIDE (end = .);