- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Sir,
How to compile/assemble an assembly file using linux compiler (icc).
icc (ICC) 11.1 20090827
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
I tried icc 1.asm and got the error as,
ipo: warning #11009: file format not recognized for 1.asm
ld:1.asm: file format not recognized; treating as linker script
ld:1.asm:2: syntax error
Is there any specific way we should write assembly file?
Please help as I am facing problems.
Thanks & Regards,
Prashanth
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the asm file on Linux is .s. if you need an example of the .s, try a chello.cpp and compile with -S option to see the generated .s code.
Jennifer
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Other than .asm extensions for Windows asm files and .s for Linux, the syntax of the two are also different:
mov eax, ebx // on Windows
mov %ebx, %eax // on Linux
However, if you want to share the same inline asm code between your Windows and Linux code, you can write in Windows format, and use the icc option "-use-msasm" or "-fasm-blocks" to compile it on Linux without having to change to the Linux format:
cat asm_win.c
int main()
{
__asm { mov eax, ebx }
}
> icc -c asm_win.c
asm_win.c(3): error: asm blocks not enabled, use -fasm-blocks
__asm { mov eax, ebx }
^
compilation aborted for asm_win.c (code 2)
> icc -c asm_win.c -fasm-blocks
>
mov eax, ebx // on Windows
mov %ebx, %eax // on Linux
However, if you want to share the same inline asm code between your Windows and Linux code, you can write in Windows format, and use the icc option "-use-msasm" or "-fasm-blocks" to compile it on Linux without having to change to the Linux format:
cat asm_win.c
int main()
{
__asm { mov eax, ebx }
}
> icc -c asm_win.c
asm_win.c(3): error: asm blocks not enabled, use -fasm-blocks
__asm { mov eax, ebx }
^
compilation aborted for asm_win.c (code 2)
> icc -c asm_win.c -fasm-blocks
>
mCG_allow_x87=F and -mCG_no_x87=T

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page