getting gnu as to check the current location

Nick Clifton nickc@redhat.com
Wed Apr 14 14:25:00 GMT 2010


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



More information about the Binutils mailing list