This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getting gnu as to check the current location


On Wed, 14 Apr 2010, Harvey Chapman wrote:
> On Apr 13, 2010, at 9:57 PM, Alan Modra wrote:
>
> > On Tue, Apr 13, 2010 at 01:36:16PM -0400, Harvey Chapman wrote:
> >> Is it possible with gnu as to do something like this?
> >>
> >> .if (. - _start1) < 0x100 || (. - _start1) > 0x1ff
> >> 	.error	"some_label must be between 0x100 and 0x1FF!"
> >> .endif
> >> some_label:
> >
> > 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.

Possibly because there's a relaxable instruction in between
(one which may have variants with different lengths depending on
the operand, for example a branch; requiring a second pass.)

If you can, try instead to do the test in a linker script.

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]