[LLVMdev] [PATCH] LLVM build failure on OpenBSD/mips64
Brad Smith
brad at comstyle.com
Fri Dec 28 00:54:24 PST 2012
I'm just passing this patch on to the list as I know Brian is busy and I
had proded him to file the bug report.
http://llvm.org/bugs/show_bug.cgi?id=14721
"binutils on OpenBSD is quite old, which causes the build on mips64el to fail on
MipsJITInfo.cpp - it complains of illegal operands. The attachment patches it
so that it will build. All the patch does is replace the register aliases with
the actual register (i.e. changing $sp to $29). The registers are identical to
both mips and mips64, so it should not disrupt 32-bit Mips builds."
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------- next part --------------
Index: lib/Target/Mips/MipsJITInfo.cpp
===================================================================
--- lib/Target/Mips/MipsJITInfo.cpp (revision 171175)
+++ lib/Target/Mips/MipsJITInfo.cpp (working copy)
@@ -102,11 +102,11 @@
".globl " ASMPREFIX "MipsCompilationCallback\n"
ASMPREFIX "MipsCompilationCallback:\n"
".ent " ASMPREFIX "MipsCompilationCallback\n"
- ".frame $sp, 32, $ra\n"
+ ".frame $29, 32, $31\n"
".set noreorder\n"
- ".cpload $t9\n"
+ ".cpload $25\n"
- "addiu $sp, $sp, -64\n"
+ "addiu $29, $29, -64\n"
".cprestore 16\n"
// Save argument registers a0, a1, a2, a3, f12, f14 since they may contain
@@ -115,35 +115,35 @@
// concerned. We also need to save the ra register since it contains the
// original return address, and t8 register since it contains the address
// of the end of function stub.
- "sw $a0, 20($sp)\n"
- "sw $a1, 24($sp)\n"
- "sw $a2, 28($sp)\n"
- "sw $a3, 32($sp)\n"
- "sw $ra, 36($sp)\n"
- "sw $t8, 40($sp)\n"
- "sdc1 $f12, 48($sp)\n"
- "sdc1 $f14, 56($sp)\n"
+ "sw $4, 20($29)\n"
+ "sw $5, 24($29)\n"
+ "sw $6, 28($29)\n"
+ "sw $7, 32($29)\n"
+ "sw $31, 36($29)\n"
+ "sw $24, 40($29)\n"
+ "sdc1 $f12, 48($29)\n"
+ "sdc1 $f14, 56($29)\n"
// t8 points at the end of function stub. Pass the beginning of the stub
// to the MipsCompilationCallbackC.
- "addiu $a0, $t8, -16\n"
+ "addiu $4, $24, -16\n"
"jal " ASMPREFIX "MipsCompilationCallbackC\n"
"nop\n"
// Restore registers.
- "lw $a0, 20($sp)\n"
- "lw $a1, 24($sp)\n"
- "lw $a2, 28($sp)\n"
- "lw $a3, 32($sp)\n"
- "lw $ra, 36($sp)\n"
- "lw $t8, 40($sp)\n"
- "ldc1 $f12, 48($sp)\n"
- "ldc1 $f14, 56($sp)\n"
- "addiu $sp, $sp, 64\n"
+ "lw $4, 20($29)\n"
+ "lw $5, 24($29)\n"
+ "lw $6, 28($29)\n"
+ "lw $7, 32($29)\n"
+ "lw $31, 36($29)\n"
+ "lw $24, 40($29)\n"
+ "ldc1 $f12, 48($29)\n"
+ "ldc1 $f14, 56($29)\n"
+ "addiu $29, $29, 64\n"
// Jump to the (newly modified) stub to invoke the real function.
- "addiu $t8, $t8, -16\n"
- "jr $t8\n"
+ "addiu $24, $24, -16\n"
+ "jr $24\n"
"nop\n"
".set reorder\n"
@@ -168,9 +168,9 @@
// Rewrite the function stub so that we don't end up here every time we
// execute the call. We're replacing the first four instructions of the
// stub with code that jumps to the compiled function:
- // lui $t9, %hi(NewVal)
- // addiu $t9, $t9, %lo(NewVal)
- // jr $t9
+ // lui $25, %hi(NewVal)
+ // addiu $25, $25, %lo(NewVal)
+ // jr $25
// nop
int Hi = ((unsigned)NewVal & 0xffff0000) >> 16;
More information about the llvm-dev
mailing list