This is the mail archive of the
mailing list for the binutils project.
Re: Labels in Instruction and data directives
- From: Jim Wilson <wilson at specifix dot com>
- To: santosh <santosh at acmet dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 02 Oct 2006 11:13:11 -0700
- Subject: Re: Labels in Instruction and data directives
- References: <000001c6e47c$90cdc580$5401a8c0@c19atest1>
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
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