Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icc ld errors

paulstillwell
Employee
480 Views
Hi,

I'm trying to compile some code using icc 12.1.4 under linux. I have a simple script that compiles each file and a line to link all the files using a custom linker definition file. The build script works for gcc and the linker definition file works for gcc. When I use it with icc, I get a syntax error on this line:

. = ALIGN (., 0x20);

I'm not sure what is causing this error since it works with gcc and other compilers. ALIGN should be a builtin function in the linker (which I'm assuming is ld). I've noticed this same error in icc with other builtin functions (like REGION_ALIAS).

I use the following line to link:

icc -m32 -march=i586 -nostdlib -Wall -W -pedantic -o coremark_icc_i586.elf -Wl,-static,-lm,-Map=coremark_icc_i586.map,--cref -Ticc_i586_hw.ld core_portme.o ee_printf.o core_list_join.o core_main.o core_matrix.o core_state.o core_util.o startup.o

I'm stumped as to what the problem could be or how to debug it. Does anyone have any ideas on how to solve this? Am I doing something wrong (like passing something that icc doesn't like)?

Paul
0 Kudos
1 Reply
Georg_Z_Intel
Employee
480 Views
Hello Paul,

it would help to see the exact error message.

Up-front: Specifying a linker script (via -T) forwards it directly to the linker. If a (syntax) error within that file appears it comes from the linker. We're using the GNU linker, same as you have installed by default.
Maybe the (default) linker found by our compiler driver is not the one you're using; e.g. you've installed multiple GNU tool-chains.
In that case you can select the tool-chains by using the options -gcc-version=XYZ, -gcc-name= and -gxx-name=. Example for GCC 4.5.1 tool-chain:

$ icc -gcc-version=451 -gcc-name=/usr/bin/gcc-4.5 -gxx-name=/usr/bin/g++-4.5 ...

Also, you might provide me the output you get when adding option "-#" to the Intel compiler invocation you posted initially. It shows exactly which tools are called and how.

Edit:
One exception could be using IPO. You might try to not use option "-ipo". Does it solve the problem then?

Best regards,

Georg Zitzlsberger
0 Kudos
Reply