Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I compile the ASM file with gcc command?

406 views
Skip to first unread message

Lu, Felix Tao

unread,
Mar 18, 2002, 5:00:15 AM3/18/02
to

It seemed that the "nasm" command didn't work.
--
Best Regards,
Lu, Felix Tao

joe durusau

unread,
Mar 18, 2002, 6:41:00 AM3/18/02
to

"Lu, Felix Tao" wrote:

If you have an assembler language _file_ as such, it should be
named <something>.s specify this file as an input to gcc and
it will be handled automagically. If you are talking about embedding
assembly into a C or C++ file, the syntax is

asm {
assembly stuff
}

Speaking only for myself,

Joe Durusau

Lu, Felix Tao

unread,
Mar 18, 2002, 10:32:10 PM3/18/02
to
And when I compile the file, it shows the error message as follows:

gcc -c qqtmp.s
qqtmp.s: Assembler messages:
qqtmp.s:1: Error: Unknown opcode: `bits'
qqtmp.s:2: Error: Unknown opcode: `extern'
qqtmp.s:3: Error: Unknown opcode: `extern'
qqtmp.s:4: Error: Unknown opcode: `extern'
qqtmp.s:5: Error: Unknown opcode: `extern'
qqtmp.s:6: Error: Unknown opcode: `extern'
qqtmp.s:7: Error: Unknown opcode: `extern'
qqtmp.s:8: Error: Unknown opcode: `global'
qqtmp.s:9: Error: Unknown opcode: `global'
qqtmp.s:10: Error: Unknown opcode: `global'
qqtmp.s:11: Error: Unknown opcode: `global'
qqtmp.s:13: Error: Unknown opcode: `section'
qqtmp.s:14: Fatal error: Unknown opcode: `dword_570d08 dd 0'


Did I need any options for the gcc command?

--

Best Regards,
Lu, Felix Tao

Component Engineer
Lucent Qingdao
(Tel)532-8702000-3151
joe durusau <dur...@bellsouth.net> wrote in message
news:3C95D24C...@bellsouth.net...

42Bastian

unread,
Mar 19, 2002, 1:45:27 AM3/19/02
to
"Lu, Felix Tao" <ft...@lucent.com> wrote in message news:<a74dpi$g...@nntpb.cb.lucent.com>...

> It seemed that the "nasm" command didn't work.

You should give some more information, but since you talk about nasm,
I guess you want to compile x86 files.
If so, you gonna have to change the file, since the syntax of gas (the
GNU assembler) and nasm are different.

E.g.: Loading AX with 100

nasm:
mov ax,100
gas:
mov $100,%ax

Got it ?

42Bastian

Hauke Reese

unread,
Mar 19, 2002, 3:24:48 AM3/19/02
to
Lu, Felix Tao wrote:

> And when I compile the file, it shows the error message as follows:
>
> gcc -c qqtmp.s
> qqtmp.s: Assembler messages:
> qqtmp.s:1: Error: Unknown opcode: `bits'
> qqtmp.s:2: Error: Unknown opcode: `extern'
> qqtmp.s:3: Error: Unknown opcode: `extern'
> qqtmp.s:4: Error: Unknown opcode: `extern'
> qqtmp.s:5: Error: Unknown opcode: `extern'
> qqtmp.s:6: Error: Unknown opcode: `extern'
> qqtmp.s:7: Error: Unknown opcode: `extern'
> qqtmp.s:8: Error: Unknown opcode: `global'
> qqtmp.s:9: Error: Unknown opcode: `global'
> qqtmp.s:10: Error: Unknown opcode: `global'
> qqtmp.s:11: Error: Unknown opcode: `global'
> qqtmp.s:13: Error: Unknown opcode: `section'
> qqtmp.s:14: Fatal error: Unknown opcode: `dword_570d08 dd 0'
>
>
> Did I need any options for the gcc command?
>
>

No, Just don't work with 'C' syntax like extern or global
Hauke Reese
tel.: 0481/8555-321
fax.: 0481/8555-301
email : re...@fh-westkueste.de

Benjamin Kalytta

unread,
Mar 19, 2002, 10:06:36 AM3/19/02
to
> E.g.: Loading AX with 100
>
> nasm:
> mov ax,100
> gas:
> mov $100,%ax

NO! New GAS also supports Intel Syntax.

rg
Benjamin


Lu, Felix Tao

unread,
Mar 19, 2002, 10:18:53 PM3/19/02
to

> > And when I compile the file, it shows the error message as follows:
> >
> > gcc -c qqtmp.s
> > qqtmp.s: Assembler messages:
> > qqtmp.s:1: Error: Unknown opcode: `bits'
> > qqtmp.s:2: Error: Unknown opcode: `extern'
> > qqtmp.s:3: Error: Unknown opcode: `extern'
> > qqtmp.s:4: Error: Unknown opcode: `extern'
> > qqtmp.s:5: Error: Unknown opcode: `extern'
> > qqtmp.s:6: Error: Unknown opcode: `extern'
> > qqtmp.s:7: Error: Unknown opcode: `extern'
> > qqtmp.s:8: Error: Unknown opcode: `global'
> > qqtmp.s:9: Error: Unknown opcode: `global'
> > qqtmp.s:10: Error: Unknown opcode: `global'
> > qqtmp.s:11: Error: Unknown opcode: `global'
> > qqtmp.s:13: Error: Unknown opcode: `section'
> > qqtmp.s:14: Fatal error: Unknown opcode: `dword_570d08 dd 0'
> >
> >
> > Did I need any options for the gcc command?
> >
> >
>
> No, Just don't work with 'C' syntax like extern or global

How can I correct the errors? I should use "extern" and "global" keys.

0 new messages