This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: getting gnu as to check the current location
Hi Harvey,
It depends on what is between . and _start. They must be in the same
section, and there can't be any .align or similar directives between.
Both of those are true. The code above does not work.
It works for me with a simple test case:
% cat foo.s
.text
_start1:
.fill 0x10,1,1
.if (. - _start1) < 0x100 || (. - _start1) > 0x1ff
.error "some_label must be between 0x100 and 0x1FF!"
.endif
some_label:
% as foo.s
foo.s: Assembler messages:
foo.s:5: Error: some_label must be between 0x100 and 0x1FF!
% sed -i s/10,/100,/ foo.s
% as foo.s
%
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.
Unfortunately I do not think that there is any reliable way to achieve
the result you want using the current features of gas. Sorry.
Cheers
Nick