Ticket #512: patch-ab

File patch-ab, 1.1 KB (added by heidnes, 5 years ago)

Alternative patch to src/exec_save.c

Line 
1$NetBSD: patch-ab,v 1.6 2009/04/17 22:08:44 he Exp $
2
3The R_PPC_ADDR16{HI,LO} constants are named something else on
4NetBSD, and might be elsewhere.
5Also add workarounds for NetBSD/powerpc 3.x, which has some
6constants defined as enums.
7
8--- src/exec_save.c.orig        2009-03-08 20:32:43.000000000 +0000
9+++ src/exec_save.c
10@@ -30,6 +30,26 @@ static void save_int(FILE *fp, int i);
11 static void save_short(FILE *fp, short s);
12 static void save_struct(FILE *fp, void *sp, size_t size);
13 
14+#if defined(PARROT_PPC)
15+#if !defined(R_PPC_ADDR16_HI) && !defined(R_PPC_ADDR16_LO) && \
16+       defined(R_PPC_16_HI) && defined(R_PPC_16_LO)
17+# define       R_PPC_ADDR16_HI R_PPC_16_HI
18+# define       R_PPC_ADDR16_LO R_PPC_16_LO
19+#endif
20+/*
21+ * NetBSD/powerpc 3.x doesn't define these constants,
22+ * but instead has them as enums, so add some workarounds for it.
23+ */
24+#if !defined(R_PPC_ADDR16_HI) && !defined(R_PPC_ADDR16_LO) && \
25+       defined(__NetBSD__)
26+# define       R_PPC_ADDR16_HI RELOC_16_HI
27+# define       R_PPC_ADDR16_LO RELOC_16_LO
28+#endif
29+#if !defined(R_PPC_REL24) && defined(__NetBSD__)
30+# define       R_PPC_REL24     RELOC_REL24
31+#endif
32+#endif /* PARROT_PPC */
33+
34 #ifdef EXEC_A_OUT
35 
36 #  include <a.out.h>