getting gnu as to check the current location

Harvey Chapman hchapman-binutils@3gfp.com
Sun Apr 25 14:24:00 GMT 2010


On Apr 14, 2010, at 10:24 AM, Nick Clifton wrote:

> It works for me with a simple test case:
> ...
> I expect that with the code that you are looking at there is something that is making the assembler to decide to break the section up into fragments, which will then stop the test from working.

  .text
 _start1:
	jmp	some_label
back_to_where_we_started:	
	.fill 0x101,1,1
	.if (. - _start1) < 0x100 || (. - _start1) > 0x1ff
	.error  "some_label must be between 0x100 and 0x1FF!"
	.endif
some_label:
	jmp	back_to_where_we_started
	
:6: Error: non-constant expression in ".if" statement 

I modified your example and was able to figure out at least what causes it to fail. The initial jump is the issue.

I'll have to learn about linker scripts to explore that route if there's no solution to the above code.

Thanks, Harvey



More information about the Binutils mailing list