summaryrefslogtreecommitdiff
path: root/editors/xemacs-current/patches/patch-src_unexelf.c
blob: 89b6a1d0af2be3fb8f178e401bbe4749a9eca084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$NetBSD: patch-src_unexelf.c,v 1.1 2017/11/15 14:53:27 hauke Exp $

Enhance ELF macros to deal with 32/64 bit arches
Special-case alpha

Was patch-ad

--- src/unexelf.c.orig	2013-08-21 17:43:45.000000000 +0000
+++ src/unexelf.c
@@ -490,10 +490,19 @@ typedef struct {
 
 #ifndef ElfW
 # ifdef __STDC__
-#  define ElfW(type)	Elf32_##type
+#  define ElfBitsW(bits, type) Elf##bits##_##type
 # else
-#  define ElfW(type)	Elf32_/**/type
+#  define ElfBitsW(bits, type) Elf/**/bits/**/_/**/type
 # endif
+# if defined (_LP64) || defined(__alpha__)
+#  define ELFSIZE 64
+# else
+#  define ELFSIZE 32
+# endif
+  /* This macro expands `bits' before invoking ElfBitsW.  */
+# define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
+# define ElfW(type) ElfExpandBitsW (ELFSIZE, type)
+
 #endif
 
 #ifndef ELF_BSS_SECTION_NAME
@@ -959,7 +968,7 @@ unexec (Extbyte *new_name, Extbyte *old_
       memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
 	      NEW_SECTION_H (nn).sh_size);
 
-#ifdef __alpha__
+#if defined(__alpha__) && !defined(__NetBSD__)
       /* Update Alpha COFF symbol table: */
       if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug")
 	  == 0)