error "expression too complex"; complex relocation? (correction)

Peter Johnson peter at tortall.net
Sat Dec 9 13:21:37 PST 2006


On Fri, 8 Dec 2006, Peter Tanski wrote:
> .section .rodata
> _sys_srt:								; label1 here
> .text
> 	.long	_sys_srt-(_sys_info)+0	; error here
> _sys_info:							; label2 here
>
> The error occurs with the satement:
> 	_szy_srt-(_szy_info)
> which is a complex relocation (_szy_srt and _szy_info are the start
> addresses of two different sections); WRT in Nasm.
>
> Yasm outputs the "expression too complex" error for all output object
> formats--except 'bin' and 'dbg', of course.
>
> I traced the "expression too complex" error to libyasm/value.c
> yasm_value_output_basic(), which according to the Note should not be
> used for cases where a reloc is needed.  Is this a bug in Yasm?

More like an not-yet-supported feature :).  Yes, it's a bug.  NASM doesn't 
support cross-section references of this form but GAS does.  Yasm has 
support for expressions of the form (sym in other section)-(current 
position, e.g. "." or "$"), but I didn't think through the fact this could 
be extended for the general case of (sym in other section)-(sym in current 
section).

I'll get a fix for this committed sometime this weekend.

Thanks,
Peter


More information about the yasm-devel mailing list