Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intel-style inline assembly in gcc

I am trying to compile an old C++ software project in Code::Blocks using the gcc compiler, and after fixing a few other issues, I've hit a wall: the project has a file with Intel-style inline ASM written as

_asm {
  code here
}

and the compiler refuses to compile it with "error: '_asm' was not declared in this scope".

I've spent a while Googling around looking for solutions, but the only ones I can find are to add -masm=intel to the build options (which I've tried and can't get to work), or to convert the code to asm ("code here"); (which isn't feasible because of the sheer amount of ASM). Does anyone know how I can get gcc to compile this code as-is, or should I give up and use a different compiler?

like image 298
Dinoguy1000 Avatar asked Nov 03 '22 21:11

Dinoguy1000


1 Answers

GCC uses a very different syntax for inline assembler, so you won't be able to handle it with trivial changes. I see the following options:

  1. Rewrite everything in GCC syntax or as C code
  2. Make some script to translate to GCC syntax (non-trivial task)
  3. Compile the code with whatever compiler it was written for (MSVC?)
like image 67
Igor Skochinsky Avatar answered Nov 09 '22 13:11

Igor Skochinsky