diff options
author | Michael Brown | 2011-04-29 02:27:36 +0200 |
---|---|---|
committer | Michael Brown | 2011-04-29 02:27:36 +0200 |
commit | 987b825b7f046e844a332d27497b4846cb23ba43 (patch) | |
tree | 8aa769f4390d5dfe4993622283b1e2e88eb38a59 /src/arch/i386/scripts | |
parent | [int13] Catch INT 13,4b when no explicit drive number is present (diff) | |
download | ipxe-987b825b7f046e844a332d27497b4846cb23ba43.tar.gz ipxe-987b825b7f046e844a332d27497b4846cb23ba43.tar.xz ipxe-987b825b7f046e844a332d27497b4846cb23ba43.zip |
[build] Fix building on mildly deranged versions of binutils
Some versions of binutils have curious concepts of what constitutes
subtraction. For example:
0x00000000000000f0 _text16_late = .
0x0000000000000898 _mtext16 = .
0x0000000000000898 _etext16 = .
0x0000000000000898 _text16_late_filesz = ABSOLUTE ((_mtext16 - _text16_late))
0x00000000000007a8 _text16_late_memsz = ABSOLUTE ((_etext16 - _text16_late))
This has interesting side-effects such as producing sizes for .bss
segments that are negative, causing the majority of addressable memory
to be zeroed out.
Fix by using the form
ABSOLUTE ( x ) - ABSOLUTE ( y )
rather than
ABSOLUTE ( x - y )
Reported-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Tested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/scripts')
-rw-r--r-- | src/arch/i386/scripts/i386.lds | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/arch/i386/scripts/i386.lds b/src/arch/i386/scripts/i386.lds index c5bc631f..763b80d6 100644 --- a/src/arch/i386/scripts/i386.lds +++ b/src/arch/i386/scripts/i386.lds @@ -39,8 +39,8 @@ SECTIONS { } .bss.prefix (NOLOAD) : AT ( _end_lma ) { _eprefix = .; } - _prefix_filesz = ABSOLUTE ( _mprefix - _prefix ); - _prefix_memsz = ABSOLUTE ( _eprefix - _prefix ); + _prefix_filesz = ABSOLUTE ( _mprefix ) - ABSOLUTE ( _prefix ); + _prefix_memsz = ABSOLUTE ( _eprefix ) - ABSOLUTE ( _prefix ); /* * The 16-bit (real-mode) code section @@ -63,11 +63,11 @@ SECTIONS { } .bss.text16 (NOLOAD) : AT ( _end_lma ) { _etext16 = .; } - _text16_early_filesz = ABSOLUTE ( _etext16_early - _text16 ); - _text16_early_memsz = ABSOLUTE ( _etext16_early - _text16 ); - _text16_late_filesz = ABSOLUTE ( _mtext16 - _text16_late ); - _text16_late_memsz = ABSOLUTE ( _etext16 - _text16_late ); - _text16_memsz = ABSOLUTE ( _etext16 - _text16 ); + _text16_early_filesz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 ); + _text16_early_memsz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 ); + _text16_late_filesz = ABSOLUTE ( _mtext16 ) - ABSOLUTE ( _text16_late ); + _text16_late_memsz = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16_late ); + _text16_memsz = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16 ); /* * The 16-bit (real-mode) data section @@ -89,8 +89,8 @@ SECTIONS { *(.stack16.*) _edata16 = .; } - _data16_filesz = ABSOLUTE ( _mdata16 - _data16 ); - _data16_memsz = ABSOLUTE ( _edata16 - _data16 ); + _data16_filesz = ABSOLUTE ( _mdata16 ) - ABSOLUTE ( _data16 ); + _data16_memsz = ABSOLUTE ( _edata16 ) - ABSOLUTE ( _data16 ); /* * The 32-bit sections @@ -118,8 +118,8 @@ SECTIONS { *(.stack.*) _etextdata = .; } - _textdata_filesz = ABSOLUTE ( _mtextdata - _textdata ); - _textdata_memsz = ABSOLUTE ( _etextdata - _textdata ); + _textdata_filesz = ABSOLUTE ( _mtextdata ) - ABSOLUTE ( _textdata ); + _textdata_memsz = ABSOLUTE ( _etextdata ) - ABSOLUTE ( _textdata ); /* * Compressor information block @@ -134,8 +134,8 @@ SECTIONS { } .bss.zinfo (NOLOAD) : AT ( _end_lma ) { _ezinfo = .; } - _zinfo_filesz = ABSOLUTE ( _mzinfo - _zinfo ); - _zinfo_memsz = ABSOLUTE ( _ezinfo - _zinfo ); + _zinfo_filesz = ABSOLUTE ( _mzinfo ) - ABSOLUTE ( _zinfo ); + _zinfo_memsz = ABSOLUTE ( _ezinfo ) - ABSOLUTE ( _zinfo ); /* * Weak symbols that need zero values if not otherwise defined |