Fix building mono with icc
authorAndrea Canciani <ranma42@gmail.com>
Tue, 20 May 2014 13:32:11 +0000 (15:32 +0200)
committerAndrea Canciani <ranma42@gmail.com>
Wed, 21 May 2014 12:18:56 +0000 (14:18 +0200)
When compiling mono with icc (ICC) 14.0.0 20130728 the build fails on

  CC     libmonoruntimesgen_la-sgen-stw.lo

with the following error:

Assembler messages:
Error: suffix or operands invalid for `lea'

Apparently icc (or the assembler) dislikes the rip-based LEA
operation. This can be worked around by manually assembling the
instruction and replacing it with the corresponding byte sequence.

This change is released under the MIT license.

mono/utils/mono-context.h

index a4d29461ca6251a4921961b679e03991ebedca3d..8c813453f6ee4f83c2467219903504b3dc30e4df 100755 (executable)
@@ -222,7 +222,8 @@ typedef struct {
                "movq %%r13, 0x68(%0)\n"        \
                "movq %%r14, 0x70(%0)\n"        \
                "movq %%r15, 0x78(%0)\n"        \
-               "leaq (%%rip), %%rdx\n" \
+               /* "leaq (%%rip), %%rdx\n" is not understood by icc */  \
+               ".byte 0x48, 0x8d, 0x15, 0x00, 0x00, 0x00, 0x00\n" \
                "movq %%rdx, 0x80(%0)\n"        \
                :       \
                : "a" (&(ctx))  \