Subversion Repositories pike

Compare Revisions

Ignore whitespace Rev 161 → Rev 162

/trunk/debian/patches/reg_enum_conflict.patch
1,21 → 1,117
Description: Rename enum constants in src/code/ia32.c
They conflict with /usr/include/i386-linux-gnu/sys/ucontext.h of newer eglibc
Author: Magnus Holmgren
Bug-Debian: http://bugs.debian.org/708366
Forwarded: yes
 
--- a/src/code/ia32.c
+++ b/src/code/ia32.c
@@ -18,6 +18,18 @@
#ifdef REG_NONE
#undef REG_NONE
@@ -14,14 +14,9 @@
#include "object.h"
#include "builtin_functions.h"
-/* This is defined on windows */
-#ifdef REG_NONE
-#undef REG_NONE
-#endif
-
-enum ia32_reg {REG_EAX = 0, REG_EBX = 3, REG_ECX = 1, REG_EDX = 2, REG_NONE = 4};
+enum ia32_reg {PIKE_REG_EAX = 0, PIKE_REG_EBX = 3, PIKE_REG_ECX = 1, PIKE_REG_EDX = 2, PIKE_REG_NONE = 4};
-#define REG_BITMASK ((1 << REG_NONE) - 1)
+#define REG_BITMASK ((1 << PIKE_REG_NONE) - 1)
/* #define REGISTER_DEBUG */
@@ -71,7 +66,7 @@ static int alloc_regs = 0, valid_regs =
#define MOV_ABSADDR_TO_REG(ADDR, REG) do { \
MAKE_VALID_REG (REG); \
/* movl addr,%reg */ \
- if ((REG) == REG_EAX) \
+ if ((REG) == PIKE_REG_EAX) \
add_to_program (0xa1); /* Move dword at address to EAX. */ \
else { \
add_to_program (0x8b); /* Move r/m32 to r32. */ \
@@ -83,7 +78,7 @@ static int alloc_regs = 0, valid_regs =
#define MOV_REG_TO_ABSADDR(REG, ADDR) do { \
CHECK_VALID_REG (REG); \
/* movl %reg,addr */ \
- if ((REG) == REG_EAX) \
+ if ((REG) == PIKE_REG_EAX) \
add_to_program (0xa3); /* Move EAX to dword at address. */ \
else { \
add_to_program (0x89); /* Move r32 to r/m32. */ \
@@ -217,7 +212,7 @@ static int alloc_regs = 0, valid_regs =
add_to_program (0x48 | (REG)); /* Decrement r32. */ \
else if (val_ < -128 || val_ > 127) { \
/* addl $val,%reg */ \
- if ((REG) == REG_EAX) \
+ if ((REG) == PIKE_REG_EAX) \
add_to_program (0x05); /* Add imm32 to EAX. */ \
else { \
add_to_program (0x81); /* Add imm32 to r/m32. */ \
@@ -334,8 +329,8 @@ ptrdiff_t ia32_prev_stored_pc; /* PROG_P
void ia32_flush_code_generator(void)
{
- next_reg = REG_EAX;
- sp_reg = fp_reg = mark_sp_reg = REG_NONE;
+ next_reg = PIKE_REG_EAX;
+ sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE;
CLEAR_REGS();
ia32_prev_stored_pc = -1;
}
@@ -351,7 +346,7 @@ static enum ia32_reg alloc_reg (int avoi
/* There's a free register. */
for (reg = next_reg; (1 << reg) & used_regs;) {
- reg = (reg + 1) % REG_NONE;
+ reg = (reg + 1) % PIKE_REG_NONE;
#ifdef PIKE_DEBUG
if (reg == next_reg) Pike_fatal ("Failed to find a free register.\n");
#endif
+#ifdef REG_EAX
+#undef REG_EAX
+#endif
+#ifdef REG_EBX
+#undef REG_EBX
+#endif
+#ifdef REG_ECX
+#undef REG_ECX
+#endif
+#ifdef REG_EDX
+#undef REG_EDX
+#endif
@@ -364,15 +359,15 @@ static enum ia32_reg alloc_reg (int avoi
* probably be replaced with an LRU strategy. */
enum ia32_reg {REG_EAX = 0, REG_EBX = 3, REG_ECX = 1, REG_EDX = 2, REG_NONE = 4};
for (reg = next_reg; (1 << reg) & avoid_regs;) {
- reg = (reg + 1) % REG_NONE;
+ reg = (reg + 1) % PIKE_REG_NONE;
#ifdef PIKE_DEBUG
if (reg == next_reg) Pike_fatal ("Failed to find a non-excluded register.\n");
#endif
}
- if (sp_reg == reg) {sp_reg = REG_NONE; DEALLOC_REG (reg);}
- else if (fp_reg == reg) {fp_reg = REG_NONE; DEALLOC_REG (reg);}
- else if (mark_sp_reg == reg) {mark_sp_reg = REG_NONE; DEALLOC_REG (reg);}
+ if (sp_reg == reg) {sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
+ else if (fp_reg == reg) {fp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
+ else if (mark_sp_reg == reg) {mark_sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
}
#ifdef REGISTER_DEBUG
@@ -386,11 +381,11 @@ static enum ia32_reg alloc_reg (int avoi
#define DEF_LOAD_REG(REG, SET) \
static void PIKE_CONCAT(load_,REG) (int avoid_regs) \
{ \
- if (REG == REG_NONE) { \
+ if (REG == PIKE_REG_NONE) { \
REG = alloc_reg (avoid_regs); \
/* Update the round robin pointer here so that we disregard */ \
/* the direct calls to alloc_reg for temporary registers. */ \
- next_reg = (REG + 1) % REG_NONE; \
+ next_reg = (REG + 1) % PIKE_REG_NONE; \
{SET;} \
} \
else \
@@ -410,8 +405,8 @@ DEF_LOAD_REG (mark_sp_reg, {
static void ia32_call_c_function(void *addr)
{
CALL_RELATIVE(addr);
- next_reg = REG_EAX;
- sp_reg = fp_reg = mark_sp_reg = REG_NONE;
+ next_reg = PIKE_REG_EAX;
+ sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE;
CLEAR_REGS();
}
/trunk/debian/changelog
1,3 → 1,11
pike7.8 (7.8.700-4) unstable; urgency=low
 
* reg_enum_conflict.patch: The conflict is with an enum, so we have to
rename our enum constants (really Closes: #708366). Also add DEP-3
header.
 
-- Magnus Holmgren <holmgren@debian.org> Sun, 26 May 2013 21:35:09 +0200
 
pike7.8 (7.8.700-3) unstable; urgency=low
 
* Link pike7.8-odbc to unixodbc, not iodbc, since the latter is not