[syslinux] Linker script assertion with binutils 2.21

H. Peter Anvin hpa at zytor.com
Mon Jan 17 13:42:37 PST 2011


On 01/17/2011 12:20 PM, Colin Watson wrote:
> 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;
> 

Oh, and a question: does

	__payload_len = ABSOLUTE(__payload_end) - 	
ABSOLUTE(__payload_start);

... work instead?

	-hpa




More information about the Syslinux mailing list