Linux MIPS Architecture development
 help / color / mirror / Atom feed
* simple assembler program
@ 2004-07-21  5:17 Roman Mashak
  2004-07-21  5:17 ` Roman Mashak
  2004-07-21  6:56 ` Jan-Benedict Glaw
  0 siblings, 2 replies; 4+ messages in thread
From: Roman Mashak @ 2004-07-21  5:17 UTC (permalink / raw)
  To: linux-mips

Hello!

    I tried to compile simple assembler program:

#define a 1
#define b 2

.ent main
.global main
main:
        li $3, a
        li $2, b
        addu $4, $2, $3
.end main

I use SDE-lite kit version 5.03.06 and compile with sde-as:
#sde-as test.S -o testtest.S: Assembler messages:
test.S:9: Error: absolute expression required `li'
test.S:10: Error: absolute expression required `li'

When I eliminate #define and use just 'li $3, 1' and so on - everything is
compiled correctly. Where is my problem?

Thanks in advance!

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru

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

* simple assembler program
  2004-07-21  5:17 simple assembler program Roman Mashak
@ 2004-07-21  5:17 ` Roman Mashak
  2004-07-21  6:56 ` Jan-Benedict Glaw
  1 sibling, 0 replies; 4+ messages in thread
From: Roman Mashak @ 2004-07-21  5:17 UTC (permalink / raw)
  To: linux-mips

Hello!

    I tried to compile simple assembler program:

#define a 1
#define b 2

.ent main
.global main
main:
        li $3, a
        li $2, b
        addu $4, $2, $3
.end main

I use SDE-lite kit version 5.03.06 and compile with sde-as:
#sde-as test.S -o testtest.S: Assembler messages:
test.S:9: Error: absolute expression required `li'
test.S:10: Error: absolute expression required `li'

When I eliminate #define and use just 'li $3, 1' and so on - everything is
compiled correctly. Where is my problem?

Thanks in advance!

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru

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

* Re: simple assembler program
  2004-07-21  5:17 simple assembler program Roman Mashak
  2004-07-21  5:17 ` Roman Mashak
@ 2004-07-21  6:56 ` Jan-Benedict Glaw
  2004-07-21 13:44   ` Maciej W. Rozycki
  1 sibling, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2004-07-21  6:56 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Wed, 2004-07-21 14:17:14 +0900, Roman Mashak <mrv@tusur.ru>
wrote in message <002701c46ee1$feeb7fc0$cc20bdd3@roman>:

> #define a 1
> #define b 2
> 
> .ent main
> .global main
> main:
>         li $3, a
>         li $2, b
>         addu $4, $2, $3
> .end main
> 
> I use SDE-lite kit version 5.03.06 and compile with sde-as:
> #sde-as test.S -o testtest.S: Assembler messages:
> test.S:9: Error: absolute expression required `li'
> test.S:10: Error: absolute expression required `li'
> 
> When I eliminate #define and use just 'li $3, 1' and so on - everything is
> compiled correctly. Where is my problem?

Assembler sources aren't commonly fed through a preprocessor, so your
assembler just ignores the comments (your defines) and uses "a" and "b"
as-is.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: simple assembler program
  2004-07-21  6:56 ` Jan-Benedict Glaw
@ 2004-07-21 13:44   ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2004-07-21 13:44 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: linux-mips

On Wed, 21 Jul 2004, Jan-Benedict Glaw wrote:

> > #sde-as test.S -o testtest.S: Assembler messages:
> > test.S:9: Error: absolute expression required `li'
> > test.S:10: Error: absolute expression required `li'
> > 
> > When I eliminate #define and use just 'li $3, 1' and so on - everything is
> > compiled correctly. Where is my problem?
> 
> Assembler sources aren't commonly fed through a preprocessor, so your
> assembler just ignores the comments (your defines) and uses "a" and "b"
> as-is.

 However, they would be, based on the file name suffix, which is .S for
assembly to be preprocessed or .s for one not to, if fed to the assembler
via the gcc driver.

  Maciej

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

end of thread, other threads:[~2004-07-21 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-21  5:17 simple assembler program Roman Mashak
2004-07-21  5:17 ` Roman Mashak
2004-07-21  6:56 ` Jan-Benedict Glaw
2004-07-21 13:44   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox