public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Why doesn't this assemble for elf but does for pe?
@ 2003-04-29  3:40 Stephen P. Smith
  2003-04-30 11:37 ` Nick Clifton
  2003-04-30 17:31 ` Stephen P. Smith
  0 siblings, 2 replies; 10+ messages in thread
From: Stephen P. Smith @ 2003-04-29  3:40 UTC (permalink / raw)
  To: binutils

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:

$ i686-pc-elf-as --version
GNU assembler 030415 20030415
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i686-pc-elf'.

Does anyone have a clue?

--------------------- example ------------
  .equ numRawHandlers, NumEntries
table:
       <some code goes here>
common:
.equ size, ((common - table/ numRawHandlers)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-29  3:40 Why doesn't this assemble for elf but does for pe? Stephen P. Smith
@ 2003-04-30 11:37 ` Nick Clifton
  2003-04-30 13:22   ` Stephen P. Smith
  2003-04-30 17:31 ` Stephen P. Smith
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Clifton @ 2003-04-30 11:37 UTC (permalink / raw)
  To: Stephen P. Smith; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-30 11:37 ` Nick Clifton
@ 2003-04-30 13:22   ` Stephen P. Smith
       [not found]     ` <m3d6j4t7l1.fsf@localhost.localdomain>
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen P. Smith @ 2003-04-30 13:22 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils



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?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
       [not found]     ` <m3d6j4t7l1.fsf@localhost.localdomain>
@ 2003-04-30 16:03       ` Stephen P. Smith
  2003-05-01  7:40         ` Nick Clifton
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen P. Smith @ 2003-04-30 16:03 UTC (permalink / raw)
  To: Nick Clifton, binutils


note that common, RawHandlerTable, and numRawHandlers are all defined.
Ok I change the code to :

#NO_APP
.equ rawHandlerSize, ((common - RawHandlerTable)/numRawHandlers)
#APP

I am getting :
../../code/HAL/x86/rawhndlr.S: Assembler messages:
../../code/HAL/x86/rawhndlr.S:281: Error: missing ')'
gmake: *** [rawhndlr.o] Error 1

Nick Clifton wrote:

>Hi Stephen,
>
>  
>
>>>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)
>>>      
>>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-29  3:40 Why doesn't this assemble for elf but does for pe? Stephen P. Smith
  2003-04-30 11:37 ` Nick Clifton
@ 2003-04-30 17:31 ` Stephen P. Smith
  2003-04-30 18:03   ` Ian Lance Taylor
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen P. Smith @ 2003-04-30 17:31 UTC (permalink / raw)
  To: Stephen P. Smith; +Cc: binutils

It looks like no matter what I do below, the / functions as a comment 
character.  

$ i686-pc-elf-as --version
GNU assembler 030415 20030415
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i686-pc-elf'.

 380                  /*       
 381                  ;
 382                  ; Compute the size of each entry in the table, so 
that higher level code will be able to compute
 383                  ; addresses of each individual entry.
 384                  ;
 385                  */
 386                 
 387                  #NO_APP
 388                  .equ rawHandlerSize, ( common - RawHandlerTable 
)/numRawHandlers
 389                  .equ sps5, ( common - RawHandlerTable )
 390                  .equ sps6, sps5/numRawHandlers
 391                  #APP
 392                          .data
 393                 
 394 0000 60000000     spstest3:          .long numRawHandlers
 395 0004 08030000     spstest4:          .long sps5
 396 0008 08030000     spstest6:          .long sps6
 397                         
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-30 17:31 ` Stephen P. Smith
@ 2003-04-30 18:03   ` Ian Lance Taylor
  2003-05-01  1:01     ` Stephen P. Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2003-04-30 18:03 UTC (permalink / raw)
  To: Stephen P. Smith; +Cc: binutils

"Stephen P. Smith" <ischis2@cox.net> writes:

> It looks like no matter what I do below, the / functions as a comment
> character.  $ i686-pc-elf-as --version

Yes, by default an i386 ELF assembler uses '/' as a comment character,
for SVR4 compatibility.

This is disabled if you configure for, e.g., i686-linux-gnu, or for
other free operating systems.  In those cases, '/' is a comment
character only at the start of a line.

Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-30 18:03   ` Ian Lance Taylor
@ 2003-05-01  1:01     ` Stephen P. Smith
  2003-05-01  1:37       ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen P. Smith @ 2003-05-01  1:01 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

Thanks,  but I want this toolchain to build on cygwin, and files are 
missing if I try to build for linux-gnu
And so I can't compile for that target.  Where is this behaviour set.  I 
have the sources.

sps


Ian Lance Taylor wrote:

>"Stephen P. Smith" <ischis2@cox.net> writes:
>
>  
>
>>It looks like no matter what I do below, the / functions as a comment
>>character.  $ i686-pc-elf-as --version
>>    
>>
>
>Yes, by default an i386 ELF assembler uses '/' as a comment character,
>for SVR4 compatibility.
>
>This is disabled if you configure for, e.g., i686-linux-gnu, or for
>other free operating systems.  In those cases, '/' is a comment
>character only at the start of a line.
>
>Ian
>
>
>  
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-05-01  1:01     ` Stephen P. Smith
@ 2003-05-01  1:37       ` Alan Modra
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Modra @ 2003-05-01  1:37 UTC (permalink / raw)
  To: Stephen P. Smith; +Cc: Ian Lance Taylor, binutils

On Wed, Apr 30, 2003 at 06:04:47PM -0700, Stephen P. Smith wrote:
> Thanks,  but I want this toolchain to build on cygwin, and files are 
> missing if I try to build for linux-gnu
> And so I can't compile for that target.  Where is this behaviour set.  I 
> have the sources.

gas/config/tc-i386.c comment_chars.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-04-30 16:03       ` Stephen P. Smith
@ 2003-05-01  7:40         ` Nick Clifton
  2003-05-08  3:36           ` Hans-Peter Nilsson
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Clifton @ 2003-05-01  7:40 UTC (permalink / raw)
  To: Stephen P. Smith; +Cc: binutils

Hi Stephen,

> note that common, RawHandlerTable, and numRawHandlers are all defined.
> Ok I change the code to :
> 
> #NO_APP
> .equ rawHandlerSize, ((common - RawHandlerTable)/numRawHandlers)
> #APP
> 
> I am getting :
> ../../code/HAL/x86/rawhndlr.S: Assembler messages:
> ../../code/HAL/x86/rawhndlr.S:281: Error: missing ')'
> gmake: *** [rawhndlr.o] Error 1

The #APP and #NO_APP need to be at the start of files.  They do not
work elsewhere.  (Yes, I know that this is a pain, but that is the way
that the system works).

Cheers
        Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why doesn't this assemble for elf but does for pe?
  2003-05-01  7:40         ` Nick Clifton
@ 2003-05-08  3:36           ` Hans-Peter Nilsson
  0 siblings, 0 replies; 10+ messages in thread
From: Hans-Peter Nilsson @ 2003-05-08  3:36 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Stephen P. Smith, binutils

On 1 May 2003, Nick Clifton wrote:
> Hi Stephen,
>
> > note that common, RawHandlerTable, and numRawHandlers are all defined.
> > Ok I change the code to :
> >
> > #NO_APP
> > .equ rawHandlerSize, ((common - RawHandlerTable)/numRawHandlers)
> > #APP
> >
> > I am getting :
> > ../../code/HAL/x86/rawhndlr.S: Assembler messages:
> > ../../code/HAL/x86/rawhndlr.S:281: Error: missing ')'
> > gmake: *** [rawhndlr.o] Error 1
>
> The #APP and #NO_APP need to be at the start of files.  They do not
> work elsewhere.

They do work elsewhere if and only if there's also a #NO_APP at
the very beginning of the file.  (Only one gcc port emits that:
cris-*.  BTW, last time I looked there's also a kludge in glibc
that relies on #NO_APP not being in effect; that is, scrubbing
being done.  But that's more than one whole other story.)

There be bugs there.  I'd rather rip out all the #APP/#NO_APP
support, but I guess patching the kludge there is, is perceived
as a smaller change.

brgds, H-P

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-05-08  3:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-29  3:40 Why doesn't this assemble for elf but does for pe? Stephen P. Smith
2003-04-30 11:37 ` Nick Clifton
2003-04-30 13:22   ` Stephen P. Smith
     [not found]     ` <m3d6j4t7l1.fsf@localhost.localdomain>
2003-04-30 16:03       ` Stephen P. Smith
2003-05-01  7:40         ` Nick Clifton
2003-05-08  3:36           ` Hans-Peter Nilsson
2003-04-30 17:31 ` Stephen P. Smith
2003-04-30 18:03   ` Ian Lance Taylor
2003-05-01  1:01     ` Stephen P. Smith
2003-05-01  1:37       ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).