This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Why doesn't this assemble for elf but does for pe?
- From: Nick Clifton <nickc at redhat dot com>
- To: "Stephen P. Smith" <ischis2 at cox dot net>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: 30 Apr 2003 12:33:51 +0100
- Subject: Re: Why doesn't this assemble for elf but does for pe?
- References: <3EADF43D.4030103@cox.net>
Hi Stephen,
> I have some code that looks like this. The code assembles when
> compiled with i686-pc-pe-as but chokes when compiled with
> i686-pc-elf-as. The version of the assembler is the same:
How does the assembler choke ?
> $ i686-pc-elf-as --version
> GNU assembler 030415 20030415
> --------------------- example ------------
> .equ numRawHandlers, NumEntries
> table:
> <some code goes here>
> common:
> .equ size, ((common - table/ numRawHandlers)
There are a couple of problem with this test case:
* The value of NumEntries is not defined.
* There is a missing closing brace after 'table' on the last line.
Anyway, if the problem is that the assembler is complaining about a
missing closing parenthesis:
fred.s: Assembler messages:
fred.s:5: Error: missing ')' (
then the reason is that the i386-pc-elf target defines the forward
slash character ('/') as starting a comment, so the second .equ
directive in the example above is interpreted as:
.equ size, ((common - table
The answer is to disable pre-processing at the start of the file by
using the #NO_APP directive, like this:
#NO_APP
.equ NumEntries, 5
.equ numRawHandlers, NumEntries
table:
nop
common:
.equ size, ((common - table) / numRawHandlers)
Cheers
Nick