Why doesn't this assemble for elf but does for pe?

Stephen P. Smith ischis2@cox.net
Wed Apr 30 13:22:00 GMT 2003



Nick Clifton wrote:

>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 ?
>  
>

It complains about a missing ")"

>>--------------------- 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.
>

Actually, the value is defined.  I didn't think you wanted to look at 
100 lines of code and when I
shortened it I forgot to give a value.

>  * 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)
>
>  
>

Then how do I turn preprocessing back on?





More information about the Binutils mailing list