~ chicken-core (chicken-5) 5a347891f29b04e6005874a7c9f2b9bcc871def6


commit 5a347891f29b04e6005874a7c9f2b9bcc871def6
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Jul 11 19:46:45 2015 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Jul 11 19:46:45 2015 +0200

    removed apply-hack

diff --git a/Makefile.aix b/Makefile.aix
index 68e86baa..6cc68910 100644
--- a/Makefile.aix
+++ b/Makefile.aix
@@ -100,9 +100,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.android b/Makefile.android
index c0bb6e28..23c8e636 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -94,9 +94,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.bsd b/Makefile.bsd
index 334c3d7a..1444b7a9 100644
--- a/Makefile.bsd
+++ b/Makefile.bsd
@@ -100,9 +100,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.cross-linux-mingw b/Makefile.cross-linux-mingw
index 424a9ab2..6bb28be4 100644
--- a/Makefile.cross-linux-mingw
+++ b/Makefile.cross-linux-mingw
@@ -30,7 +30,6 @@ SRCDIR ?= ./
 
 DLLSINPATH = 1
 ARCH ?= x86
-HACKED_APPLY = 1
 WINDOWS = 1
 
 # file extensions
@@ -66,7 +65,6 @@ TARGET_CXX_COMPILER = g++
 
 # special files
 
-APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
 POSIXFILE = posixwin
 
 # select default and internal settings
@@ -119,7 +117,6 @@ endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
 endif
-	echo "#define C_HACKED_APPLY" >>$@
 	cat chicken-defaults.h >>$@
 
 include $(SRCDIR)rules.make
diff --git a/Makefile.cygwin b/Makefile.cygwin
index baf1069a..87e866b6 100644
--- a/Makefile.cygwin
+++ b/Makefile.cygwin
@@ -29,7 +29,6 @@ SRCDIR ?= ./
 # platform configuration
 
 ARCH ?= x86
-HACKED_APPLY ?= 1
 DLLSINPATH = 1
 
 # options
@@ -71,7 +70,6 @@ LIBCHICKEN_IMPORT_LIBRARY = lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).dll.a
 # special files
 
 CHICKEN_CONFIG_H = chicken-config.h
-APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
 
 # select default and internal settings
 
@@ -116,9 +114,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifdef HACKED_APPLY
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.haiku b/Makefile.haiku
index 0dffe951..f271144d 100644
--- a/Makefile.haiku
+++ b/Makefile.haiku
@@ -94,9 +94,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.hurd b/Makefile.hurd
index 17c60db6..a8f703cf 100644
--- a/Makefile.hurd
+++ b/Makefile.hurd
@@ -95,9 +95,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.ios b/Makefile.ios
index 6c99c47c..54b88b3c 100644
--- a/Makefile.ios
+++ b/Makefile.ios
@@ -36,7 +36,6 @@ XCODE_TOOLPATH ?= $(XCODE_DEVELOPER)/usr/bin
 # for simulator:  XCODE_SDK ?= $(XCODE_DEVELOPER)/Platforms/iPhoneSimulator.platform/Developer/SDKs/ipHoneSimulator7.0.sdk
 XCODE_SDK ?= $(XCODE_DEVELOPER)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
 STATICBUILD = 1
-HACKED_APPLY =
 
 # options
 
diff --git a/Makefile.linux b/Makefile.linux
index 0e7d69a1..45ae3a28 100644
--- a/Makefile.linux
+++ b/Makefile.linux
@@ -95,9 +95,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.macosx b/Makefile.macosx
index 0c649683..d480032a 100644
--- a/Makefile.macosx
+++ b/Makefile.macosx
@@ -63,8 +63,6 @@ SO = .dylib
 # special files
 
 CHICKEN_CONFIG_H = chicken-config.h
-APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
-HACKED_APPLY ?= 1
 
 # architectures
 
@@ -125,26 +123,7 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
-ifeq ($(ARCH),universal)
-ifneq ($(HACKED_APPLY),)
-# We undefine HACKED_APPLY in order to override rules.make
-# with our own build rules.
-HACKED_APPLY=
-apply-hack.ppc.darwin$(O): $(SRCDIR)apply-hack.ppc.darwin.S
-	$(ASSEMBLER) $(ASSEMBLER_OPTIONS) -arch ppc \
-           $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
-apply-hack.x86$(O): $(SRCDIR)apply-hack.x86.S
-	$(ASSEMBLER) $(ASSEMBLER_OPTIONS) -arch i386 \
-           $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
-$(APPLY_HACK_OBJECT): apply-hack.x86$(O) apply-hack.ppc.darwin$(O)
-	lipo -create -output $@ $^
-endif
-endif
-
 include $(SRCDIR)/rules.make
diff --git a/Makefile.mingw b/Makefile.mingw
index e9feb491..a0ca8d94 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -35,12 +35,6 @@ WINDOWS = 1
 WINDOWS_SHELL = 1
 UNAME_SYS = MinGW
 
-ifeq ($(ARCH),x86)
-HACKED_APPLY ?= 1
-else
-HACKED_APPLY =
-endif
-
 # file extensions
 
 SO = .dll
@@ -72,7 +66,6 @@ MAKEDIR_COMMAND_OPTIONS =
 # special files
 
 CHICKEN_CONFIG_H = chicken-config.h
-APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
 POSIXFILE = posixwin
 
 # select default and internal settings
@@ -109,9 +102,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo #define C_COLLECT_ALL_SYMBOLS >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo #define C_HACKED_APPLY >>$@
 endif
 	type chicken-defaults.h >>$@
 
diff --git a/Makefile.mingw-msys b/Makefile.mingw-msys
index c15ecda1..981b8d5e 100644
--- a/Makefile.mingw-msys
+++ b/Makefile.mingw-msys
@@ -30,11 +30,6 @@ SRCDIR ?= ./
 
 DLLSINPATH = 1
 ARCH ?= x86
-ifeq ($(ARCH),x86)
-HACKED_APPLY ?= 1
-else
-HACKED_APPLY =
-endif
 WINDOWS = 1
 
 # file extensions
@@ -76,7 +71,6 @@ MAKEDIR_COMMAND_OPTIONS = -p
 # special files
 
 CHICKEN_CONFIG_H = chicken-config.h
-APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
 POSIXFILE = posixwin
 
 # select default and internal settings
@@ -114,9 +108,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/Makefile.solaris b/Makefile.solaris
index ae89b3ec..583c9249 100644
--- a/Makefile.solaris
+++ b/Makefile.solaris
@@ -124,9 +124,6 @@ ifdef GCHOOKS
 endif
 ifdef SYMBOLGC
 	echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
-endif
-ifneq ($(HACKED_APPLY),)
-	echo "#define C_HACKED_APPLY" >>$@
 endif
 	cat chicken-defaults.h >>$@
 
diff --git a/apply-hack.ppc.darwin.S b/apply-hack.ppc.darwin.S
deleted file mode 100644
index 87520ac9..00000000
--- a/apply-hack.ppc.darwin.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* apply-hack.ppc.s
-;
-; Copyright (c) 2008-2015, The CHICKEN Team
-; Copyright (c) 2007, Felix L. Winkelmann
-; All rights reserved.
-;
-; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-; conditions are met:
-;
-;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-;     disclaimer. 
-;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-;     disclaimer in the documentation and/or other materials provided with the distribution. 
-;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
-;     products derived from this software without specific prior written permission. 
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-; POSSIBILITY OF SUCH DAMAGE.
-*/
-
-	.text
-
-	.globl _C_do_apply_hack
-	.align 2
-	
-_C_do_apply_hack:
-	mr r13, r3		/* r13=proc */
-	mr r14, r4		/* r14=buf */
-	mr r15, r5		/* r15=count */
-	cmpwi r15, 8
-	bge l1
-	li r3, 8		/* offset is (8 - count) * 4 */
-	sub r15, r3, r15
-	slwi r15, r15, 2
-	bl l2			/* compute branch address */
-l2:	mflr r4
-	add r15, r4, r15
-	addi r15, r15, lo16(l1 - l2)
-	mtctr r15
-	bctr
-l1:	lwz r10, 28(r14)	/* load register arguments */
-	lwz r9, 24(r14)
-	lwz r8, 20(r14)
-	lwz r7, 16(r14)
-	lwz r6, 12(r14)
-	lwz r5, 8(r14)
-	lwz r4, 4(r14)
-	lwz r3, 0(r14)
-	lwz r15, 20(r1)		/* save link area above faked argument area */
-	stw r15, -4(r14)	/* (start from end if destination overlaps) */
-	lwz r15, 16(r1)		/* is this needed at all? at least for proper gdb backtraces? */
-	stw r15, -8(r14)
-	lwz r15, 12(r1)
-	stw r15, -12(r14)
-	lwz r15, 8(r1)
-	stw r15, -16(r14)
-	lwz r15, 4(r1)
-	stw r15, -20(r14)
-	lwz r15, 0(r1)
-	stw r15, -24(r14)
-	addi r1, r14, -24	/* set frame-pointer to faked frame */
-	mtctr r13		/* jump to proc, lr is invalid, but we won't return anyway */
-	bctr
diff --git a/apply-hack.ppc.sysv.S b/apply-hack.ppc.sysv.S
deleted file mode 100644
index b0fd2a6c..00000000
--- a/apply-hack.ppc.sysv.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* apply-hack.ppc.s
-;
-; Copyright (c) 2008-2015, The CHICKEN Team
-; Copyright (c) 2007, Felix L. Winkelmann
-; All rights reserved.		
-;
-; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-; conditions are met:
-;
-;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-;     disclaimer. 
-;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-;     disclaimer in the documentation and/or other materials provided with the distribution. 
-;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
-;     products derived from this software without specific prior written permission. 
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-; POSSIBILITY OF SUCH DAMAGE.
-*/
-
-	.text
-
-	.globl _C_do_apply_hack
-	.align 2
-
-_C_do_apply_hack:
-	mr %r13, %r3		/* r13=proc */
-	mr %r14, %r4		/* r14=buf */
-	mr %r15, %r5		/* r15=count */
-	li %r16, 8		/* Assume count >= 8 */
-	cmpwi %r15, 8
-	bge l1
-	li %r3, 8		/* offset is (8 - count) * 4 */
-	mr %r16, %r15		/* Remember count */
-	sub %r15, %r3, %r15
-	slwi %r15, %r15, 2
-	bl l2			/* compute branch address */
-l2:	mflr %r4
-	add %r15, %r4, %r15
-	addi %r15, %r15, (l1 - l2)@l
-	mtctr %r15
-	bctr
-l1:	lwz %r10, 28(%r14)	/* load register arguments */
-	lwz %r9, 24(%r14)
-	lwz %r8, 20(%r14)
-	lwz %r7, 16(%r14)
-	lwz %r6, 12(%r14)
-	lwz %r5, 8(%r14)
-	lwz %r4, 4(%r14)
-	lwz %r3, 0(%r14)
-	lwz %r15, 4(%r1)	/* LR (needed?) */
-	stw %r15, -4(%r14)
-	lwz %r15, 0(%r1)	/* Back chain (needed?) */
-	stw %r15, -8(%r14)
-	slwi %r16, %r16, 2      /* (Count * 4, but never > 8) can be shifted from params list */
-	add %r1, %r14, %r16 	/* set frame-pointer to faked frame */
-	subi %r1, %r1, 8	/* Add LR and back chain save word */
-	mtctr %r13		/* jump to proc */
-	bctr
diff --git a/apply-hack.x86-64.S b/apply-hack.x86-64.S
deleted file mode 100644
index 8a6ab323..00000000
--- a/apply-hack.x86-64.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Apply-hack.x86-64.S
-;
-; Copyright (c) 2008-2015, The CHICKEN Team
-; Copyright (c) 2007, Felix L. Winkelmann
-; All rights reserved.
-;
-; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-; conditions are met:
-;
-;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-;     disclaimer. 
-;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-;     disclaimer in the documentation and/or other materials provided with the distribution. 
-;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
-;     products derived from this software without specific prior written permission. 
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-; POSSIBILITY OF SUCH DAMAGE.
-*/
-
-	.text
-
-	.globl _C_do_apply_hack
-#ifndef __APPLE__
-	.type _C_do_apply_hack, @function
-#endif
-
-_C_do_apply_hack:
-	subq $8, %rsp		/* force non-16 byte alignment */
-	movq %rdi, %r11		/* get proc */
-	movq %rsi, %r10		/* save buffer address, before we clobber %rsi */
-	cmpl $6, %edx		/* clamp at 6 */
-	ja l2
-	je l3
-	movq $6, %rbx		/* (6 - count) * 4 gives instruction address */
-	subq %rdx, %rbx
-	shlq $2, %rbx
-	lea l3(%rip), %rdx
-	addq %rdx, %rbx
-	jmp *%rbx
-l2:	lea 48(%r10), %rsp	/* %r10 must be 16-byte aligned at this point */
-l3:	movq 40(%r10), %r9      /* fill registers... */
-	movq 32(%r10), %r8
-	movq 24(%r10), %rcx
-	movq 16(%r10), %rdx
-	movq 8(%r10), %rsi
-	movq (%r10), %rdi
-	xorq %rax, %rax
-	call *%r11
-
-/* Set non-executable stack for Linux ELF target */
-#if defined(__ELF__)
-	.section .note.GNU-stack,"",%progbits
-#endif
diff --git a/apply-hack.x86.S b/apply-hack.x86.S
deleted file mode 100644
index 60b7210d..00000000
--- a/apply-hack.x86.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/* apply-hack.x86.S
-;
-; Copyright (c) 2008-2015, The CHICKEN Team
-; Copyright (c) 2007, Felix L. Winkelmann
-; All rights reserved.
-;
-; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-; conditions are met:
-;
-;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-;     disclaimer. 
-;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-;     disclaimer in the documentation and/or other materials provided with the distribution. 
-;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
-;     products derived from this software without specific prior written permission. 
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-; POSSIBILITY OF SUCH DAMAGE.
-*/
-
-	.text
-
-	.globl _C_do_apply_hack
-	
-_C_do_apply_hack:
-	movl 4(%esp), %eax
-	movl 8(%esp), %esp
-	call *%eax
-
-/* Set non-executable stack for Linux ELF target */
-#if defined(__ELF__)
-	.section .note.GNU-stack,"",%progbits
-#endif
-
diff --git a/defaults.make b/defaults.make
index e53900db..80cd2d5c 100644
--- a/defaults.make
+++ b/defaults.make
@@ -224,16 +224,6 @@ ASM ?= .S
 POSIXFILE ?= posixunix
 CHICKEN_CONFIG_H = chicken-config.h
 
-ifneq ($(ARCH),)
-HACKED_APPLY ?= 1
-APPLY_HACK_SRC ?= apply-hack.$(ARCH)$(ASM)
-APPLY_HACK_OBJECT ?= apply-hack.$(ARCH)$(O)
-endif
-
-ifeq ($(HACKED_APPLY),)
-APPLY_HACK_OBJECT =
-endif
-
 # bootstrapping compiler
 
 CHICKEN ?= chicken$(EXE)
diff --git a/distribution/manifest b/distribution/manifest
index 4ef3d1dc..430f4691 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -210,10 +210,6 @@ tests/signal-tests.scm
 tests/version-tests.scm
 tweaks.scm
 utils.scm
-apply-hack.x86.S
-apply-hack.x86-64.S
-apply-hack.ppc.darwin.S
-apply-hack.ppc.sysv.S
 Makefile
 Makefile.android
 Makefile.aix
diff --git a/rules.make b/rules.make
index 62dfc197..33c3ffeb 100644
--- a/rules.make
+++ b/rules.make
@@ -177,13 +177,6 @@ endef
 $(foreach obj, $(COMPILER_OBJECTS_1),\
           $(eval $(call declare-static-compiler-object,$(obj))))
 
-# assembler objects
-
-ifneq ($(HACKED_APPLY),)
-$(APPLY_HACK_OBJECT): $(SRCDIR)apply-hack.$(ARCH)$(ASM)
-	$(ASSEMBLER) $(ASSEMBLER_OPTIONS) $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
-endif
-
 # program objects
 
 define declare-utility-program-object
@@ -221,24 +214,24 @@ $(foreach obj, $(ALWAYS_STATIC_UTILITY_PROGRAM_OBJECTS_1),\
 
 libs: $(TARGETLIBS)
 
-lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO): $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
+lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO): $(LIBCHICKEN_SHARED_OBJECTS)
 	$(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_LINKER_OPTIONS) \
 	  $(LINKER_OUTPUT) $^ $(LIBCHICKEN_SO_LIBRARIES)
 ifdef USES_SONAME
 	ln -sf $(LIBCHICKEN_SO_FILE) $(LIBCHICKEN_SO_FILE).$(BINARYVERSION)
 endif
 
-cyg$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)-0.dll: $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
+cyg$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)-0.dll: $(LIBCHICKEN_SHARED_OBJECTS)
 	$(LINKER) -shared -o $(LIBCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
 	    -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
 	    -Wl,--dll-search-prefix=cyg -Wl,--allow-multiple-definition \
 	    -Wl,--allow-shlib-undefined \
 	    -Wl,--out-implib=libchicken.dll.a -Wl,--export-all-symbols \
 	    -Wl,--enable-auto-import \
-	    -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
+	    -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) \
 	    -Wl,--no-whole-archive $(LIBCHICKEN_SO_LIBRARIES)
 
-lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKEN_STATIC_OBJECTS)
+lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A): $(LIBCHICKEN_STATIC_OBJECTS)
 	$(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
 
 # import libraries and extensions
@@ -675,7 +668,7 @@ bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)$(EXE
 boot-chicken:
 	"$(MAKE)" PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
 	  CHICKEN=$(CHICKEN) PROGRAM_SUFFIX=-boot-stage1 STATICBUILD=1 \
-	  C_COMPILER_OPTIMIZATION_OPTIONS="$(C_COMPILER_OPTIMIZATION_OPTIONS)" C_HACKED_APPLY= BUILDING_CHICKEN_BOOT=1 \
+	  C_COMPILER_OPTIMIZATION_OPTIONS="$(C_COMPILER_OPTIMIZATION_OPTIONS)" BUILDING_CHICKEN_BOOT=1 \
 	  confclean chicken-boot-stage1$(EXE)
 	"$(MAKE)" PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
 	  CHICKEN=.$(SEP)chicken-boot-stage1$(EXE) PROGRAM_SUFFIX=-boot \
Trap