From owner-freebsd-hackers Tue Sep 26 05:10:29 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id FAA02245 for hackers-outgoing; Tue, 26 Sep 1995 05:10:29 -0700 Received: from ki1.chemie.fu-berlin.de (ki1.Chemie.FU-Berlin.DE [160.45.24.21]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id FAA02131 for ; Tue, 26 Sep 1995 05:08:14 -0700 Received: by ki1.chemie.fu-berlin.de (Smail3.1.28.1) from mail.hanse.de (134.100.239.2) with smtp id ; Tue, 26 Sep 95 13:06 MET Received: from wavehh.UUCP by mail.hanse.de with UUCP for freebsd-hackers@FreeBSD.ORG id ; Tue, 26 Sep 95 13:06 MET Received: by wavehh.hanse.de (4.1/SMI-4.1) id AA13081; Tue, 26 Sep 95 13:04:17 +0100 Date: Tue, 26 Sep 95 13:04:17 +0100 From: cracauer@wavehh.hanse.de (Martin Cracauer) Message-Id: <9509261204.AA13081@wavehh.hanse.de> To: cstruble@vt.edu Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Objective C Newsgroups: hanse-ml.freebsd.hackers References: <199509260315.XAA04532@quirk.com> Reply-To: cracauer@wavehh.hanse.de Sender: owner-hackers@FreeBSD.ORG Precedence: bulk In hanse-ml.freebsd.hackers you write: >Well, I saw a discussion a while ago, but it seemed without >resolution. I'm very interested in getting Objective C working on >FreeBSD, but so far have been unable to get anywhere. >I compiled gcc 2.7.0 and everything seemed to compile fine. I then >tried to build libobjects-0.1.14 and the test programs. All the >test programs fail with a core dump (floating point exception) in >libobjc.a, the Objective C runtime library. It seems to be a problem >with __builtin_return(), but my compiler knowledge is a bit lacking >so I can't figure out exactly what is wrong. >Has anyone gotten any Objective C programs to work on FreeBSD? If so, >what magic incantations do I have to perform to get them to run? The problem is that FreeBSD does not use IEEE exceptions. Division by zero etc. (that result in NaN or other special IEEE numbers on other machines) will raise the SIGFPE signal, which by default causes a core dump. Linux has the same problem. You can solve it at Linux using -lieee. NetBSD uses full IEEE semantic as does any workstation I have. I don't know the correct FreeBSD solution, since nothing like -lieee seems to exist. Maybe I overlooked the right way to solve this in FreeBSD. Anyway, in the meantime, to run ObjC programs, you can ignore the signal, ObjC message dispatch works nothingtheless. I don't know why gcc-2.7.0 partly produces exceptions and earlier versions did not. At the beginning of your source file: #ifdef __FreeBSD__ #include #endif /* __FreeBSD__ */ Somewhere: #ifdef __FreeBSD__ void signal_dummy(int nix) {}; #endif /* __FreeBSD__ */ At the beginning of the program, before any ObjC message call: #ifdef __FreeBSD__ signal(SIGFPE,signal_dummy); #endif /* __FreeBSD__ */ Note that FP exception (division by zero etc.) will not longer cause your program to terminate, but will result in "0". Since the corrent behaviour is to produce 'NaN' anyway, I find it unlikely that you'll find a program that worked on FreeBSD and will no longer work with this ignored signal. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer . No NeXTMail, please. Norderstedt/Hamburg, Germany. Fax +49 40 522 85 36. This is a private address. At (netless) work programming in data analysis.