From c76c32104a9586cbdc3d1f5f113de608f2113821 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 6 Oct 1995 06:45:24 +0000 Subject: [PATCH] Retract the most recent changes to get Linux ELF binaries to work. These changes do not and cannot work, because signal handlers cannot be run while the special Scheme segment registers are in use. The reason is that the signal handlers are registered as 32-bit offsets, and the associated segment descriptors are not registered with those offsets; when the signal arrives, the offset is used with whatever segment descriptor happens to be in the CS register. When the Scheme segment descriptors are in place, this offset is meaningless and causes Scheme to die immediately with a SIGSEGV. One possible workaround for this problem would be to re-register the signal handlers whenever the segment registers are hacked, but this is very expensive in time, and the Scheme<->C interface is already too slow. The only other feasibility is to get the Linux kernel changed so that signal handlers are invoked in a known segment without regard to the contents of CS at the time of the signal; but although this is a sensible idea, it's necessary to convince the kernel developer's of it's desirability, and meanwhile the existing Linux installations will not work. --- v7/src/microcode/s/linux.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/v7/src/microcode/s/linux.h b/v7/src/microcode/s/linux.h index 02c7fef17..8b21543ad 100644 --- a/v7/src/microcode/s/linux.h +++ b/v7/src/microcode/s/linux.h @@ -1,7 +1,7 @@ /* -*-C-*- System file for Linux -$Id: linux.h,v 1.5 1995/10/05 06:33:15 cph Exp $ +$Id: linux.h,v 1.6 1995/10/06 06:45:24 cph Exp $ Copyright (c) 1995 Massachusetts Institute of Technology @@ -41,6 +41,21 @@ MIT in each case. */ #define ALTERNATE_M4 s/ultrix.m4 +/* The following change is necessary if ELF binaries are used. + Unfortunately, it is insufficient, because the Linux ELF + implementation also moves the text and data segments to 0x08000000, + which means that all of the pointer manipulation code must be + changed. This is normal for some architectures, e.g. the MIPS and + HPPA, but it make the binaries for Linux ELF different for the + binaries for all other i386 machines. + + Since I don't currently know any way to adjust the mapping of the + segments, if ELF is in use, I'll just force the switch that causes + GCC to generate a.out format instead of ELF. This is a temporary + patch, because one of these days a.out won't be supported, but + hopefully by then we'll know how to fix this correctly. */ + +#if 0 #ifdef __ELF__ #define C_SWITCH_SYSTEM -D_LINUX_ELF #define M4_SWITCH_SYSTEM -P "define(LINUX_ELF,1)" @@ -48,3 +63,12 @@ MIT in each case. */ #define C_SWITCH_SYSTEM #define M4_SWITCH_SYSTEM #endif +#endif + +#ifdef __ELF__ +#define C_SWITCH_SYSTEM -b i486-linuxaout +#define LD_SWITCH_SYSTEM -b i486-linuxaout +#else +#define C_SWITCH_SYSTEM +#define LD_SWITCH_SYSTEM +#endif -- 2.25.1