Why does my program with IACA markers compile but not when I compile to assembly first?

234 Views Asked by At

I'm trying to do some code profiling with Intel's IACA. I've used this Stack Overflow question to set up the makers. The problem I'm having is that if I use gcc and compile straight from the source to the binary, I'm fine. The program compiles and IACA works fine. But if I use -S to compile to asm first, and then use gcc on that, I get the following error.

main.c: Assembler messages:
main.c:10: Error: no such instruction: `movl $111,%ebx'
main.c:13: Error: no such instruction: `movl $222,%ebx'

I recognize that these are the instructions that IACA has injected. But I don't know why they are only a problem when I compile to asm first.

The reason I want to do this is I want to be able to use IACA on FORTRAN code, so I am unable to use the c header file. I should be able to place the markers in the asm by hand but I can't compile the code afterwards.

Just to be clear, for the code I've posted here, I only used the header file and got this error. I did not add anything to the asm. Just compiled to asm then to binary.

main.c:

#include "iacaMarks.h"  
int main()
{
  int i = 0;
  float count = 0.0;

  for(i = 0; i < 123; i++){
    IACA_START
    count+=count;
  }
  IACA_END
}

Makefile:

asm:
        gcc -S main.c -I/home/lavin2/iaca-lin64/include/ -masm=intel
final:
        gcc main.s
all:
        gcc main.c -I/home/lavin2/iaca-lin64/include/

make all works fine and then IACA accepts the binary and runs profiling. make asm followed by make final will produce the above error.

I'm running 64-bit Ubuntu 14.10 on an Intel Xeon-2699 and gcc 4.9.1.

0

There are 0 best solutions below