2005-04-08 17:01:17 +02:00
|
|
|
/* -*- sh -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Linker script for i386 images
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
SECTIONS {
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
/* Each section starts at a virtual address of zero.
|
2005-04-08 17:01:17 +02:00
|
|
|
*
|
|
|
|
* We guarantee alignment of virtual addresses to any alignment
|
|
|
|
* specified by the constituent object files (e.g. via
|
|
|
|
* __attribute__((aligned(x)))). Load addresses are guaranteed
|
|
|
|
* only up to _max_align. Provided that all loader and relocation
|
|
|
|
* code honours _max_align, this means that physical addresses are
|
|
|
|
* also guaranteed up to _max_align.
|
|
|
|
*
|
|
|
|
* Note that when using -DKEEP_IT_REAL, the UNDI segments are only
|
|
|
|
* guaranteed to be loaded on a paragraph boundary (i.e. 16-byte
|
|
|
|
* alignment). Using _max_align>16 will therefore not guarantee
|
|
|
|
* >16-byte alignment of physical addresses when -DKEEP_IT_REAL is
|
|
|
|
* used (though virtual addresses will still be fully aligned).
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The prefix
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
.prefix 0x0 : AT ( _prefix_lma ) {
|
|
|
|
_prefix = .;
|
2005-04-08 17:01:17 +02:00
|
|
|
*(.prefix)
|
|
|
|
*(.prefix.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_mprefix = .;
|
2008-10-17 02:39:48 +02:00
|
|
|
} .prefix_bss (NOLOAD) : AT ( _end_lma ) {
|
2008-10-09 23:22:01 +02:00
|
|
|
_eprefix = .;
|
2005-04-08 17:01:17 +02:00
|
|
|
}
|
2008-10-09 23:22:01 +02:00
|
|
|
_prefix_filesz = ABSOLUTE ( _mprefix - _prefix );
|
|
|
|
_prefix_memsz = ABSOLUTE ( _eprefix - _prefix );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
/*
|
2008-10-09 23:22:01 +02:00
|
|
|
* The 16-bit (real-mode) code section
|
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
.text16 0x0 : AT ( _text16_lma ) {
|
|
|
|
_text16 = .;
|
2008-09-06 04:19:03 +02:00
|
|
|
*(.text16.null)
|
2008-10-09 23:22:01 +02:00
|
|
|
. += 1; /* Prevent NULL being valid */
|
2006-05-02 17:41:21 +02:00
|
|
|
*(.text16)
|
|
|
|
*(.text16.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_mtext16 = .;
|
2008-10-17 02:39:48 +02:00
|
|
|
} .text16_bss (NOLOAD) : AT ( _end_lma ) {
|
2008-10-09 23:22:01 +02:00
|
|
|
_etext16 = .;
|
|
|
|
}
|
|
|
|
_text16_filesz = ABSOLUTE ( _mtext16 - _text16 );
|
|
|
|
_text16_memsz = ABSOLUTE ( _etext16 - _text16 );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
/*
|
|
|
|
* The 16-bit (real-mode) data section
|
|
|
|
*
|
|
|
|
*/
|
2006-12-20 21:28:20 +01:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
.data16 0x0 : AT ( _data16_lma ) {
|
|
|
|
_data16 = .;
|
|
|
|
. += 1; /* Prevent NULL being valid */
|
2006-05-02 17:41:21 +02:00
|
|
|
*(.rodata16)
|
|
|
|
*(.rodata16.*)
|
|
|
|
*(.data16)
|
|
|
|
*(.data16.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_mdata16 = .;
|
2008-10-17 02:39:48 +02:00
|
|
|
} .data16_bss (NOLOAD) : AT ( _end_lma ) {
|
2006-05-02 17:41:21 +02:00
|
|
|
*(.bss16)
|
|
|
|
*(.bss16.*)
|
|
|
|
*(.stack16)
|
|
|
|
*(.stack16.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_edata16 = .;
|
2005-04-08 17:01:17 +02:00
|
|
|
}
|
2008-10-09 23:22:01 +02:00
|
|
|
_data16_filesz = ABSOLUTE ( _mdata16 - _data16 );
|
|
|
|
_data16_memsz = ABSOLUTE ( _edata16 - _data16 );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
/*
|
2006-05-02 17:41:21 +02:00
|
|
|
* The 32-bit sections
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
.textdata 0x0 : AT ( _textdata_lma ) {
|
|
|
|
_textdata = .;
|
2006-06-11 03:48:29 +02:00
|
|
|
*(.text.null_trap)
|
2008-10-09 23:22:01 +02:00
|
|
|
. += 1; /* Prevent NULL being valid */
|
2005-04-08 17:01:17 +02:00
|
|
|
*(.text)
|
|
|
|
*(.text.*)
|
|
|
|
*(.rodata)
|
|
|
|
*(.rodata.*)
|
|
|
|
*(.data)
|
|
|
|
*(.data.*)
|
2005-04-27 14:24:38 +02:00
|
|
|
*(SORT(.tbl.*)) /* Various tables. See include/tables.h */
|
2008-10-09 23:22:01 +02:00
|
|
|
_mtextdata = .;
|
2008-10-17 02:39:48 +02:00
|
|
|
} .textdata_bss (NOLOAD) : AT ( _end_lma ) {
|
2005-04-08 17:01:17 +02:00
|
|
|
*(.bss)
|
|
|
|
*(.bss.*)
|
|
|
|
*(COMMON)
|
|
|
|
*(.stack)
|
|
|
|
*(.stack.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_etextdata = .;
|
2005-04-08 17:01:17 +02:00
|
|
|
}
|
2008-10-09 23:22:01 +02:00
|
|
|
_textdata_filesz = ABSOLUTE ( _mtextdata - _textdata );
|
|
|
|
_textdata_memsz = ABSOLUTE ( _etextdata - _textdata );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2007-07-16 17:58:38 +02:00
|
|
|
/*
|
|
|
|
* Compressor information block
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2007-07-16 17:58:38 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
.zinfo 0x0 : AT ( _zinfo_lma ) {
|
|
|
|
_zinfo = .;
|
2007-07-16 17:58:38 +02:00
|
|
|
*(.zinfo)
|
|
|
|
*(.zinfo.*)
|
2008-10-09 23:22:01 +02:00
|
|
|
_mzinfo = .;
|
2008-10-17 02:39:48 +02:00
|
|
|
} .zinfo_bss (NOLOAD) : AT ( _end_lma ) {
|
2008-10-09 23:22:01 +02:00
|
|
|
_ezinfo = .;
|
2007-07-16 17:58:38 +02:00
|
|
|
}
|
2008-10-09 23:22:01 +02:00
|
|
|
_zinfo_filesz = ABSOLUTE ( _mzinfo - _zinfo );
|
|
|
|
_zinfo_memsz = ABSOLUTE ( _ezinfo - _zinfo );
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Weak symbols that need zero values if not otherwise defined
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-10-17 02:39:48 +02:00
|
|
|
.weak 0x0 : AT ( _end_lma ) {
|
2008-10-09 23:22:01 +02:00
|
|
|
_weak = .;
|
|
|
|
*(.weak)
|
|
|
|
_eweak = .;
|
|
|
|
}
|
|
|
|
_assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
|
2007-07-16 17:58:38 +02:00
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
/*
|
|
|
|
* Dispose of the comment and note sections to make the link map
|
|
|
|
* easier to read
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/DISCARD/ : {
|
|
|
|
*(.comment)
|
|
|
|
*(.note)
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-10-09 23:22:01 +02:00
|
|
|
* Load address calculations. In older versions of ld, ALIGN()
|
|
|
|
* can operate only on the location counter, so we use that.
|
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
PROVIDE ( _max_align = 16 );
|
|
|
|
. = 0;
|
2006-05-02 17:41:21 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_prefix_lma = .;
|
|
|
|
. += _prefix_filesz;
|
|
|
|
. = ALIGN ( _max_align );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_payload_lma = .;
|
2006-05-02 17:41:21 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_text16_lma = .;
|
|
|
|
. += _text16_filesz;
|
|
|
|
. = ALIGN ( _max_align );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_data16_lma = .;
|
|
|
|
. += _data16_filesz;
|
|
|
|
. = ALIGN ( _max_align );
|
2007-07-16 17:58:38 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_textdata_lma = .;
|
|
|
|
. += _textdata_filesz;
|
|
|
|
. = ALIGN ( _max_align );
|
2007-07-15 03:52:02 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_filesz = .; /* Do not include zinfo block in file size */
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-10-09 23:22:01 +02:00
|
|
|
_zinfo_lma = .;
|
|
|
|
. += _zinfo_filesz;
|
|
|
|
. = ALIGN ( _max_align );
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-10-17 02:39:48 +02:00
|
|
|
_end_lma = .;
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
/*
|
2006-05-02 17:41:21 +02:00
|
|
|
* Values calculated to save code from doing it
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2005-04-08 17:01:17 +02:00
|
|
|
*/
|
2008-10-09 23:22:01 +02:00
|
|
|
_prefix_memsz_pgh = ( ( _prefix_memsz + 15 ) / 16 );
|
|
|
|
_prefix_memsz_sect = ( ( _prefix_memsz + 511 ) / 512 );
|
|
|
|
_text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
|
|
|
|
_data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );
|
2007-07-16 18:17:26 +02:00
|
|
|
|
|
|
|
/*
|
2008-10-09 23:22:01 +02:00
|
|
|
* File size in paragraphs and sectors. Note that wherever the
|
|
|
|
* _filesz variables are used, there must be a corresponding
|
2007-07-16 18:17:26 +02:00
|
|
|
* .zinfo.fixup section.
|
2008-10-09 23:22:01 +02:00
|
|
|
*
|
2007-07-16 18:17:26 +02:00
|
|
|
*/
|
2008-10-09 23:22:01 +02:00
|
|
|
_filesz_pgh = ( ( _filesz + 15 ) / 16 );
|
|
|
|
_filesz_sect = ( ( _filesz + 511 ) / 512 );
|
2005-04-08 17:01:17 +02:00
|
|
|
}
|