Make this build (and work) again on hppa and powerpc.

ok jca@
This commit is contained in:
kettenis 2016-06-28 14:06:59 +00:00
parent ab72ea3c58
commit 782bb99e83
2 changed files with 47 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.85 2016/06/06 22:15:05 jca Exp $
# $OpenBSD: Makefile,v 1.86 2016/06/28 14:06:59 kettenis Exp $
COMMENT-main= GNU editor: extensible, customizable, self documenting
COMMENT-el= elisp sources for those who want to read/modify them
@ -11,7 +11,7 @@ FULLPKGNAME-el= emacs-el-${VERSION}
FULLPKGPATH-el= editors/emacs21,-el
FULLPKGNAME-leim= emacs-leim-${VERSION}
FULLPKGPATH-leim= editors/emacs21,-leim
REVISION-main= 34
REVISION-main= 35
REVISION-el= 7
REVISION-leim= 7
@ -38,7 +38,8 @@ CONFIGURE_STYLE= gnu dest
CONFIGURE_ARGS= ${GCCARCH} --with-pop --with-system-malloc
# ld -Z doesn't work with secure-PLT
.if ${MACHINE_ARCH} == "powerpc"
ARCH_LDFLAGS = -Z -Wl,--bss-plt
ARCH_LDFLAGS = -Wl,-G0
CFLAGS += -mno-sdata
.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "sparc64"
ARCH_LDFLAGS =
.else

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_unexelf_c,v 1.2 2014/03/30 18:15:43 landry Exp $
--- src/unexelf.c.orig Tue Oct 15 08:21:44 2002
+++ src/unexelf.c Sun Mar 30 11:10:05 2014
$OpenBSD: patch-src_unexelf_c,v 1.3 2016/06/28 14:06:59 kettenis Exp $
--- src/unexelf.c.orig Tue Oct 15 16:21:44 2002
+++ src/unexelf.c Mon Jun 27 23:19:45 2016
@@ -460,7 +460,7 @@ extern void fatal (char *, ...);
#define MAP_FAILED ((void *) -1)
#endif
@ -27,3 +27,43 @@ $OpenBSD: patch-src_unexelf_c,v 1.2 2014/03/30 18:15:43 landry Exp $
# endif
/* This macro expands `bits' before invoking ElfBitsW. */
# define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
@@ -753,10 +755,12 @@ unexec (new_name, old_name, data_start, bss_start, ent
old_bss_index = find_section (".bss", old_section_names,
old_name, old_file_h, old_section_h, 0);
+#ifndef __powerpc__
old_sbss_index = find_section (".sbss", old_section_names,
old_name, old_file_h, old_section_h, 1);
if (old_sbss_index != -1)
if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS)
+#endif
old_sbss_index = -1;
if (old_sbss_index == -1)
@@ -786,8 +790,16 @@ unexec (new_name, old_name, data_start, bss_start, ent
#endif
new_data2_addr = old_bss_addr;
new_data2_size = new_bss_addr - old_bss_addr;
+#if defined (__hppa__) || defined (__powerpc__)
+ new_data2_offset = OLD_SECTION_H (old_bss_index).sh_offset +
+ (new_data2_addr - OLD_SECTION_H (old_bss_index).sh_addr);
+ new_data2_offset =
+ round_up (new_data2_offset,
+ OLD_SECTION_H (old_bss_index).sh_addralign);
+#else
new_data2_offset = OLD_SECTION_H (old_data_index).sh_offset +
(new_data2_addr - OLD_SECTION_H (old_data_index).sh_addr);
+#endif
#ifdef DEBUG
fprintf (stderr, "old_bss_index %d\n", old_bss_index);
@@ -891,6 +903,9 @@ unexec (new_name, old_name, data_start, bss_start, ent
/* Make sure that the size includes any padding before the old .bss
section. */
+#if defined (__hppa__) || defined (__powerpc__)
+ NEW_PROGRAM_H (n).p_offset = new_data2_offset;
+#endif
NEW_PROGRAM_H (n).p_filesz = new_bss_addr - NEW_PROGRAM_H (n).p_vaddr;
NEW_PROGRAM_H (n).p_memsz = NEW_PROGRAM_H (n).p_filesz;