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: Labels in Instruction and data directives


On Sat, 2006-09-30 at 16:08 +0530, santosh wrote:
> In code section when a label is followed by a data directive or $list
> control instruction then whether we have to issue error?

The result is target dependent, and you didn't mention the target.
Also, it isn't clear if you actually posted a valid assembly
testcase.  .data usually means switch to the data section.  You can't
use it to emit data normally.

Assuming you meant to use .word, then the answer is maybe.  Some
assemblers for some targets will warn or errors, some other assemblers
for other targets won't.  It depends on the ABI, and the assembler
syntax, and other factors.  It also depends on what kind of label you
are using here, i.e. is this a branch target label, or is it a global
symbol label.  It may also depend on what assembler options you are
using.

This assembler syntax is usually allowed by gas as it is useful for
emitting special target instructions that might not be directly
supported by gas.  This is assuming the label is a branch target label.
It can also be used for emitting switch statement jump tables, though
nowadays most people put these in rodata instead of the text section.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com



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