[i386] Simplify linker script and standardise linker-defined symbol names

Reduce the number of sections within the linker script to match the
number of practical sections within the output file.

Define _section, _msection, _esection, _section_filesz, _section_memsz,
and _section_lma for each section, replacing the mixture of symbols that
previously existed.

In particular, replace _text and _end with _textdata and _etextdata, to
make it explicit within code that uses these symbols that the .text and
.data sections are always treated as a single contiguous block.
This commit is contained in:
Michael Brown
2008-10-09 22:22:01 +01:00
parent 3029eb0e84
commit 13d09e6719
11 changed files with 153 additions and 236 deletions

View File

@@ -144,7 +144,7 @@ got_sectors:
/* Jump to loaded copy */
ljmp $SYSSEG, $start_runtime
endseg: .word SYSSEG + _load_size_pgh
endseg: .word SYSSEG + _filesz_pgh
.section ".zinfo.fixup", "a" /* Compressor fixup information */
.ascii "SUBW"
.long endseg

View File

@@ -63,7 +63,7 @@ max_sector:
max_head:
.byte 0
load_length:
.long _load_size_sect
.long _filesz_sect
.section ".zinfo.fixup", "a" /* Compressor fixup information */
.ascii "SUBL"

View File

@@ -511,11 +511,11 @@ alloc_basemem:
shlw $6, %ax
/* .data16 segment address */
subw $_data16_size_pgh, %ax
subw $_data16_memsz_pgh, %ax
pushw %ax
/* .text16 segment address */
subw $_text16_size_pgh, %ax
subw $_text16_memsz_pgh, %ax
pushw %ax
/* Update FBMS */
@@ -594,19 +594,19 @@ install_prealloc:
jnz 1f
movw %cs, %si
shll $4, %esi
1: addl $_payload_offset, %esi
1: addl $_payload_lma, %esi
/* Install .text16 and .data16 */
pushl %edi
movzwl %ax, %edi
shll $4, %edi
movl $_text16_size, %ecx
movl $_text16_memsz, %ecx
movl %ecx, %edx
call install_block /* .text16 */
movzwl %bx, %edi
shll $4, %edi
movl $_data16_progbits_size, %ecx
movl $_data16_size, %edx
movl $_data16_filesz, %ecx
movl $_data16_memsz, %edx
call install_block /* .data16 */
popl %edi
@@ -622,8 +622,8 @@ install_prealloc:
* prior to reading the E820 memory map and relocating
* properly.
*/
movl $_textdata_progbits_size, %ecx
movl $_textdata_size, %edx
movl $_textdata_filesz, %ecx
movl $_textdata_memsz, %edx
call install_block
/* Initialise librm at current location */
@@ -681,25 +681,25 @@ prot_call_vector:
#if COMPRESS
.section ".zinfo", "a"
.ascii "COPY"
.long _prefix_load_offset
.long _prefix_progbits_size
.long _prefix_lma
.long _prefix_filesz
.long _max_align
.ascii "PACK"
.long _text16_load_offset
.long _text16_progbits_size
.long _text16_lma
.long _text16_filesz
.long _max_align
.ascii "PACK"
.long _data16_load_offset
.long _data16_progbits_size
.long _data16_lma
.long _data16_filesz
.long _max_align
.ascii "PACK"
.long _textdata_load_offset
.long _textdata_progbits_size
.long _textdata_lma
.long _textdata_filesz
.long _max_align
#else /* COMPRESS */
.section ".zinfo", "a"
.ascii "COPY"
.long _prefix_load_offset
.long _load_size
.long _prefix_lma
.long _filesz
.long _max_align
#endif /* COMPRESS */

View File

@@ -92,7 +92,7 @@ setup_sects:
root_flags:
.word 0
syssize:
.long _load_size_pgh - PREFIXPGH
.long _filesz_pgh - PREFIXPGH
.section ".zinfo.fixup", "a" /* Compressor fixup information */
.ascii "SUBL"

View File

@@ -32,8 +32,8 @@ segment_header:
.byte 0
.byte 0x04 /* Last segment */
.long 0x00007e00
imglen: .long _load_size - 512
memlen: .long _load_size - 512
imglen: .long _filesz - 512
memlen: .long _filesz - 512
.size segment_header, . - segment_header
.section ".zinfo.fixup", "a" /* Compressor fixup information */

View File

@@ -30,7 +30,7 @@
.org 0x00
romheader:
.word 0xAA55 /* BIOS extension signature */
romheader_size: .byte _load_size_sect /* Size in 512-byte blocks */
romheader_size: .byte _filesz_sect /* Size in 512-byte blocks */
jmp init /* Initialisation vector */
checksum:
.byte 0
@@ -58,12 +58,12 @@ pciheader:
.byte 0x03 /* PCI data structure revision */
.byte 0x02, 0x00, 0x00 /* Class code */
pciheader_image_length:
.word _load_size_sect /* Image length */
.word _filesz_sect /* Image length */
.word 0x0001 /* Revision level */
.byte 0x00 /* Code type */
.byte 0x80 /* Last image indicator */
pciheader_runtime_length:
.word _load_size_sect /* Maximum run-time image length */
.word _filesz_sect /* Maximum run-time image length */
.word 0x0000 /* Configuration utility code header */
.word 0x0000 /* DMTF CLP entry point */
.equ pciheader_len, . - pciheader
@@ -130,9 +130,9 @@ undiheader:
.byte 0 /* Structure revision */
.byte 0,1,2 /* PXE version: 2.1.0 */
.word undiloader /* Offset to loader routine */
.word _data16_size /* Stack segment size */
.word _data16_size /* Data segment size */
.word _text16_size /* Code segment size */
.word _data16_memsz /* Stack segment size */
.word _data16_memsz /* Data segment size */
.word _text16_memsz /* Code segment size */
.ascii "PCIR" /* Bus type */
.equ undiheader_len, . - undiheader
.size undiheader, . - undiheader
@@ -294,7 +294,7 @@ pmm_scan:
/* Shrink ROM and update checksum */
xorw %bx, %bx
xorw %si, %si
movw $_prefix_size_sect, %cx
movw $_prefix_memsz_sect, %cx
movb %cl, romheader_size
shlw $9, %cx
1: lodsb