[syslinux] Linker script assertion with binutils 2.21
Colin Watson
cjwatson at ubuntu.com
Mon Jan 17 12:20:50 PST 2011
On Mon, Jan 17, 2011 at 11:41:01AM -0800, H. Peter Anvin wrote:
> The assertion in the linker script compares the symbols
> syslinux_ldlinux_size (from the assembler) with __payload_len (from the
> linker). Comment out the assert and check the value of __payload_len in
> syslinux.elf; if it is something other than 0x7c00 we need to find out
> where it gets the value (by backtracking the component values.)
Thanks:
$ objdump -t syslinux.elf | grep payload
ffff8400 l d .payload 00000000 .payload
00000200 g *ABS* 00000000 __payload_lma
40000000 g *ABS* 00000000 __payload_dwords
fffff840 g *ABS* 00000000 __payload_sseg
ffff8400 g .payload 00000000 __payload_start
ffff8400 g .payload 00007c00 syslinux_ldlinux
00000000 g .payload 00000000 __payload_end
00000000 g .payload 00000000 __payload_len
Looks like subtracting one relative address from another doesn't work
right, at least not when one is negative. This fixes it, but I haven't
tested it with binutils < 2.21 (although ABSOLUTE predates the commit I
referred to in my original post, at least):
diff --git a/dos/dosexe.ld b/dos/dosexe.ld
index c67c506..423fd62 100644
--- a/dos/dosexe.ld
+++ b/dos/dosexe.ld
@@ -28,9 +28,9 @@ SECTIONS
. = 0x100000000 - syslinux_ldlinux_size;
.payload : AT (__payload_lma) {
- __payload_start = .;
+ __payload_start = ABSOLUTE(.);
*(.payload)
- __payload_end = .;
+ __payload_end = ABSOLUTE(.);
}
__payload_len = __payload_end - __payload_start;
__payload_dwords = __payload_len >> 2;
--
Colin Watson [cjwatson at ubuntu.com]
More information about the Syslinux
mailing list