Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

assembly file on Linux

prashanthr
Beginner
382 Views

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

0 Kudos
2 Replies
JenniferJ
Moderator
382 Views
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
Mark_S_Intel1
Employee
382 Views
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
>





mCG_allow_x87=F and -mCG_no_x87=T
Reply