From owner-freebsd-emulation Sun Feb 1 07:19:25 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA20549 for freebsd-emulation-outgoing; Sun, 1 Feb 1998 07:19:25 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from word.smith.net.au (ppp5.portal.net.au [202.12.71.105]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA20544 for ; Sun, 1 Feb 1998 07:19:20 -0800 (PST) (envelope-from mike@word.smith.net.au) Received: from word (localhost [127.0.0.1]) by word.smith.net.au (8.8.8/8.8.5) with ESMTP id BAA00421; Mon, 2 Feb 1998 01:40:54 +1030 (CST) Message-Id: <199802011510.BAA00421@word.smith.net.au> X-Mailer: exmh version 2.0zeta 7/24/97 To: dmaddox@scsn.net cc: Amancio Hasty , "Helmut F. Wirth" , "Pedro F. Giffuni" , emulation@FreeBSD.ORG Subject: Re: Can't get Linux-gdb (from ports collection) to work In-reply-to: Your message of "Sun, 01 Feb 1998 09:38:39 CDT." <19980201093839.06233@scsn.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 02 Feb 1998 01:40:53 +1030 From: Mike Smith Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" *PLEASE* post emulation-related issues to the -emulation list, not here. > I can build Mesa2.6b5 using the linux-glide target with no problems; > however, if I try to use the linux-386-glide target, every program > that uses the Mesa libraries will coredump with an illegal instruction > exception. It seems that the assembler doesn't do it's job as well > under our emulation as it does under Linux... I don't follow your problem here. Where does running the assembler under emulation come into the picture? -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ From owner-freebsd-emulation Sun Feb 1 07:28:00 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA21664 for freebsd-emulation-outgoing; Sun, 1 Feb 1998 07:28:00 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from mail.scsn.net (scsn.net [206.25.246.12]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA21641 for ; Sun, 1 Feb 1998 07:27:58 -0800 (PST) (envelope-from dmaddox@scsn.net) Received: from rhiannon.scsn.net ([208.133.153.64]) by mail.scsn.net (Post.Office MTA v3.1.2 release (PO205-101c) ID# 0-41950U6000L1100S0) with ESMTP id AAA222; Sun, 1 Feb 1998 10:25:33 -0500 Received: (from root@localhost) by rhiannon.scsn.net (8.8.8/8.8.7) id KAA00227; Sun, 1 Feb 1998 10:27:21 -0500 (EST) (envelope-from root) Message-ID: <19980201102721.01931@scsn.net> Date: Sun, 1 Feb 1998 10:27:21 -0500 From: dmaddox@scsn.net (Donald J. Maddox) To: Mike Smith , dmaddox@scsn.net Cc: Amancio Hasty , "Helmut F. Wirth" , "Pedro F. Giffuni" , emulation@FreeBSD.ORG Subject: Re: Can't get Linux-gdb (from ports collection) to work Reply-To: dmaddox@scsn.net References: <19980201093839.06233@scsn.net> <199802011510.BAA00421@word.smith.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89i In-Reply-To: <199802011510.BAA00421@word.smith.net.au>; from Mike Smith on Mon, Feb 02, 1998 at 01:40:53AM +1030 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" On Mon, Feb 02, 1998 at 01:40:53AM +1030, Mike Smith wrote: > *PLEASE* post emulation-related issues to the -emulation list, not here. > > > I can build Mesa2.6b5 using the linux-glide target with no problems; > > however, if I try to use the linux-386-glide target, every program > > that uses the Mesa libraries will coredump with an illegal instruction > > exception. It seems that the assembler doesn't do it's job as well > > under our emulation as it does under Linux... > > I don't follow your problem here. Where does running the assembler > under emulation come into the picture? I don't think I understand your question... I am talking about building Mesa as Linux-ELF binaries (necessary because glide is only available for linux). This naturally requires using the Linux devel tools, including the assembler. From owner-freebsd-emulation Mon Feb 2 09:32:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA28286 for freebsd-emulation-outgoing; Mon, 2 Feb 1998 09:32:01 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from atlantis.eunet.at (a064.static.Vienna.AT.EU.net [193.154.186.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA28236 for ; Mon, 2 Feb 1998 09:31:54 -0800 (PST) (envelope-from hfwirth@eunet.at) Received: from atlantis (localhost.ping.at [127.0.0.1]) by atlantis.eunet.at (8.8.8/8.6.12) with SMTP id SAA15516; Mon, 2 Feb 1998 18:31:43 +0100 (MET) Message-ID: <34D602FF.167EB0E7@eunet.at> Date: Mon, 02 Feb 1998 18:31:43 +0100 From: "Helmut F. Wirth" X-Mailer: Mozilla 3.04Gold (X11; I; FreeBSD 3.0-CURRENT i386) MIME-Version: 1.0 To: emulation@FreeBSD.ORG Subject: Cross debugging Linux binaries under FreeBSD, instructions Content-Type: multipart/mixed; boundary="------------794BDF32446B9B3D2781E494" Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" This is a multi-part message in MIME format. --------------794BDF32446B9B3D2781E494 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello! I promised detailed instructions to build gdb for ELF and for Linux. Here we go: 1) Get binutils-2.8.1 and install them, where it is convinient for you. You also need the ports linux-devel and linux-libs. Both are binary only and are easy to install. You should now have /compat/linux/... containing libraries, include files and cross development tools. 2) We use the original FreeBSD-current sources of gdb: cd to binutils-2.8.1; there are some subdirectories (binutils, bfd, gas, ...). Make two new directories: mkdir gdb buildgdb. Now copy parts the systems gdb sources into these directories: (cd /usr/src/contrib/gdb; tar cf -)|(cd /bintuils-2.8.1; tar xf -) This copies the basic sources to binutils-2.8.1/gdb. You need only the subdirectory gdb from /usr/src/contrib/gdb! This leaves behind the old bfd library and the rest. Important: After the copy go to binutils-2.8.1/gdb and delete the configuration files: configure, configure.in config.status config.log and config.cache. *Do not remove* config.h and the subdir config. This step is neccessary, because configure of the entire binutils tree would generate some files in the subdirectory gdb (tm.h, nm.h and xm.h) and this is unwanted. These files are in buildgdb and are the original native files from FreeBSD. Next step: Copy the native files and the Makefile, again we only need the gdb subdirectory ! (cd /usr/src/gnu/usr.bin/gdb/gdb; tar cf - *) | (cd/binutils-2.8.1/buildgdb;tar xf -) This brings the Makefile and the native sources to buildgdb. 3) Install patches to the following files in binutils-2.8.1/gdb (All patches are included at the end of this mail as shell archive): solib.c: -> patch with solib-patch utils.c: -> patch with utils-patch 4) Install patches to the following files in binutils-2.8.1/buildgdb: Makefile: -> patch with Makefile-patch nm.h: -> patch with nm-patch 5) Now configure the binutils: configure -host=-host=i386-unknown-freebsd3.0-target=i386-unknown-freebsdelf If you want to use them for the elfkit too, add the option -prefix /usr/local/elf (See John Poltra's elfkit and the instructions there. It is not neccessary to have the elfkit. The configure configures the package for elf binaries. 6) In binutils-2.8.1 do a make. This should build the libraries, the assembler, the linker and the tools. The assembler supports MMX, btw. I am using it instead of the older assembler in the linux_devel, but I am not sure if this works in all cases. This is more a cross tool, not the old Linux assembler of the linux_devel port. I don't think the linker will work in this configuration. 7) Now you have to build gdb, manually: cd to buildgdb. Have a look at the Makefile. After the patch you will find a line: #CFLAGS+=-DLINUX_CROSS_GDB If you do not enable the line, gdb will build and it will even debug Linux binaries, but only if they are statically linked. This version of gdb is useful for elfkit: It is configured to debug FreeBSD native programs, but as ELF binaries (I have not tested this well, yet). If you enable the line, gdb is built for Linux cross debugging: It should work with statically and dynamically linked Linux programs. Don't forget branding the binaries using brandelf -t Linux xxx!! If the Linux emulator is not loaded or you try to use an unbranded binary, gdb won't recognize it as an executable! 8) Manually install gdb as linux-gdb into the /compat/linux tree. 9) If you want to try it, build without LINUX_CROSS_GDB and install this as elf-gdb into the elfkit. If somebody points me to a ftp server I will put the binary for gdb onto it. Helmut -- Helmut F. Wirth Email: hfwirth@ping.at --------------794BDF32446B9B3D2781E494 Content-Type: application/x-shar; name="gdbpatch.shar" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbpatch.shar" # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # Makefile-patch # nm-patch # solib-patch # utils-patch # echo x - Makefile-patch sed 's/^X//' >Makefile-patch << 'END-of-Makefile-patch' Xdiff -c --recursive /usr/src/gnu/usr.bin/gdb/gdb/Makefile ./Makefile X*** /usr/src/gnu/usr.bin/gdb/gdb/Makefile Sun Feb 1 23:41:10 1998 X--- ./Makefile Mon Feb 2 17:09:48 1998 X*************** X*** 2,10 **** X X PROG = gdb X X! GDBDIR= ${.CURDIR}/../../../../contrib/gdb X! .PATH: ${GDBDIR}/gdb X! .PATH: ${GDBDIR}/opcodes X X BINDIR= /usr/bin X XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ X--- 2,10 ---- X X PROG = gdb X X! GDBDIR= ${.CURDIR}/../gdb X! .PATH: ${GDBDIR} X! .PATH: ${.CURDIR}/../opcodes X X BINDIR= /usr/bin X XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ X*************** X*** 32,42 **** X XSRCS+= i386-dis.c dis-buf.c disassemble.c X SRCS= init.c ${XSRCS} X X! CFLAGS+= -g -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd X # use phkmalloc X CFLAGS+= -DNO_MMALLOC X # uncomment the next line if you want to debug gdb X #CFLAGS+= -g X X CLEANFILES+= c-exp.c f-exp.c m2-exp.c init.c y.tab.h init.c-tmp X #beforedepend: c-exp.c f-exp.c m2-exp.c init.c X--- 32,44 ---- X XSRCS+= i386-dis.c dis-buf.c disassemble.c X SRCS= init.c ${XSRCS} X X! CFLAGS+= -I$(GDBDIR) -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd X! CFLAGS+= -I$(.CURDIR)/../include -I$(GDBDIR)/config -I$(.CURDIR) X # use phkmalloc X CFLAGS+= -DNO_MMALLOC X # uncomment the next line if you want to debug gdb X #CFLAGS+= -g X+ #CFLAGS+= -DLINUX_CROSS_GDB X X CLEANFILES+= c-exp.c f-exp.c m2-exp.c init.c y.tab.h init.c-tmp X #beforedepend: c-exp.c f-exp.c m2-exp.c init.c END-of-Makefile-patch echo x - nm-patch sed 's/^X//' >nm-patch << 'END-of-nm-patch' Xdiff -c --recursive /usr/src/gnu/usr.bin/gdb/gdb/nm.h ./nm.h X*** /usr/src/gnu/usr.bin/gdb/gdb/nm.h Fri Aug 22 20:16:01 1997 X--- ./nm.h Mon Feb 2 16:32:59 1998 X*************** X*** 23,29 **** X--- 23,33 ---- X #define ATTACH_DETACH X X /* Be shared lib aware */ X+ /* For Linux debugging under FreeBSD we use SVR4 shared libs */ X #include "solib.h" X+ #ifdef LINUX_CROSS_GDB X+ #define SVR4_SHARED_LIBS X+ #endif X X /* This is the amount to subtract from u.u_ar0 X to get the offset in the core file of the register values. */ X*************** X*** 42,47 **** X--- 46,52 ---- X X #define PTRACE_ARG3_TYPE char* X X+ #ifndef LINUX_CROSS_GDB X /* make structure definitions match up with those expected in solib.c */ X #define link_object sod X #define lo_name sod_name X*************** X*** 94,99 **** X--- 99,105 ---- X #define ldd d_debug X #define ld_un d_un X #define ld_2 d_sdt X+ #endif /* ! LINUX_CROSS_GDB */ X X /* Return sizeof user struct to callers in less machine dependent routines */ X END-of-nm-patch echo x - solib-patch sed 's/^X//' >solib-patch << 'END-of-solib-patch' Xdiff -c --recursive /usr/src/contrib/gdb/gdb/solib.c ./solib.c X*** /usr/src/contrib/gdb/gdb/solib.c Fri Aug 22 20:13:12 1997 X--- ./solib.c Mon Feb 2 16:35:11 1998 X*************** X*** 39,45 **** X--- 39,49 ---- X #include "elf/external.h" X #endif X X+ #ifdef LINUX_CROSS_GDB X+ #include "/compat/linux/usr/include/link.h" X+ #else X #include X+ #endif X X #include "symtab.h" X #include "bfd.h" X*************** X*** 70,75 **** X--- 74,80 ---- X "r_debug_state", X "_r_debug_state", X "_dl_debug_state", X+ "_dl_debug_addr", X NULL X }; X #endif X END-of-solib-patch echo x - utils-patch sed 's/^X//' >utils-patch << 'END-of-utils-patch' Xdiff -c --recursive /usr/src/contrib/gdb/gdb/utils.c ./utils.c X*** /usr/src/contrib/gdb/gdb/utils.c Fri Aug 22 20:13:12 1997 X--- ./utils.c Sun Feb 1 23:50:57 1998 X*************** X*** 772,778 **** X X PTR X xmalloc (size) X! long size; X { X return (xmmalloc ((PTR) NULL, size)); X } X--- 772,778 ---- X X PTR X xmalloc (size) X! size_t size; X { X return (xmmalloc ((PTR) NULL, size)); X } X*************** X*** 782,788 **** X PTR X xrealloc (ptr, size) X PTR ptr; X! long size; X { X return (xmrealloc ((PTR) NULL, ptr, size)); X } X--- 782,788 ---- X PTR X xrealloc (ptr, size) X PTR ptr; X! size_t size; X { X return (xmrealloc ((PTR) NULL, ptr, size)); X } END-of-utils-patch exit --------------794BDF32446B9B3D2781E494-- From owner-freebsd-emulation Mon Feb 2 09:59:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA01702 for freebsd-emulation-outgoing; Mon, 2 Feb 1998 09:59:23 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from bachue.usc.unal.edu.co ([168.176.3.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA01583 for ; Mon, 2 Feb 1998 09:59:05 -0800 (PST) (envelope-from giffunip@asme.org) Received: from pedro.unal.edu.co ([168.176.3.40]) by bachue.usc.unal.edu.co (Netscape Messaging Server 3.0) with SMTP id AAA8652; Mon, 2 Feb 1998 13:01:37 +0500 Message-ID: <34D60951.167EB0E7@asme.org> Date: Mon, 02 Feb 1998 12:58:41 -0500 From: "Pedro F. Giffuni" Organization: U. Nacional de Colombia X-Mailer: Mozilla 3.01Gold (X11; I; FreeBSD 2.2.5-RELEASE i386) MIME-Version: 1.0 To: "Helmut F. Wirth" CC: emulation@FreeBSD.ORG Subject: Re: Cross debugging Linux binaries under FreeBSD, instructions References: <34D602FF.167EB0E7@eunet.at> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" Helmut F. Wirth wrote: > ...info on building cross binutils > > If somebody points me to a ftp server I will put the binary for gdb > onto it. > Please be patient..the correct place for this is the ports tree, and Donald Maddox already has this, he is only solving some problems with the crossgcc (libgcc1.a for linux has to be generated I think). cheers, Pedro. From owner-freebsd-emulation Wed Feb 4 03:50:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA05407 for freebsd-emulation-outgoing; Wed, 4 Feb 1998 03:50:56 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from linum.cofc.edu (linum.cofc.edu [153.9.35.19]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA05382 for ; Wed, 4 Feb 1998 03:50:54 -0800 (PST) (envelope-from astrand@linum.cofc.edu) Received: (from astrand@localhost) by linum.cofc.edu (8.8.7/8.8.7) id GAA16759; Wed, 4 Feb 1998 06:51:31 -0500 (EST) (envelope-from astrand) To: freebsd-emulation@FreeBSD.ORG Subject: NetBSD emulation From: Allan Strand Date: 04 Feb 1998 06:51:30 -0500 Message-ID: <86sopzlha5.fsf@linum.cofc.edu> Lines: 19 X-Mailer: Gnus v5.5/Emacs 20.2 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" Hi, I have searched the archives and never really gleaned a satisfactory answer to the question, can I run NetBSD 1.2 binaries on freebsd? I tried to post to freebsd-questions and basically got the "yeah, I wonder too!" kind of answers. I have two NetBSD binaries that I use for my research. Unfortunately the sources are difficult to come by. These are statically linked, but emulation of binaries that use shared libs would be nice to know about as well. Thanks, A. -- Allan E. Strand Internet: stranda@cofc.edu Department of Biology Phone: (803) 953-8085 College of Charleston Fax: (803) 953-5453 Charleston, SC 29424 From owner-freebsd-emulation Wed Feb 4 07:16:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA29929 for freebsd-emulation-outgoing; Wed, 4 Feb 1998 07:16:12 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from bsd.synx.com (rt.synx.com [194.167.81.239]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id HAA29885 for ; Wed, 4 Feb 1998 07:16:07 -0800 (PST) (envelope-from remy@synx.com) Received: from s3.synx.com (s3 [192.1.1.247]) by bsd.synx.com (8.6.12/8.6.12) with SMTP id QAA11365; Wed, 4 Feb 1998 16:19:45 +0100 Received: from rs1 by s3.synx.com id aa19397; 4 Feb 98 16:05 GMT Date: Wed, 4 Feb 1998 16:10:26 -0100 (GMT) From: Remy NONNENMACHER To: Allan Strand cc: freebsd-emulation@FreeBSD.ORG Subject: Re: NetBSD emulation In-Reply-To: <86sopzlha5.fsf@linum.cofc.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" On 4 Feb 1998, Allan Strand wrote: > Hi, > > I have searched the archives and never really gleaned a satisfactory > answer to the question, can I run NetBSD 1.2 binaries on freebsd? I > tried to post to freebsd-questions and basically got the "yeah, I > wonder too!" kind of answers. > > I have two NetBSD binaries that I use for my research. Unfortunately > the sources are difficult to come by. These are statically linked, > but emulation of binaries that use shared libs would be nice to know > about as well. > NetBSD *IS* emulated by FreeBSD. The problem is that someone (Net ? Free ?) reversed the exec magic number. This means that FreeBSD recognizes the NetBSD Magic, load and starts the binary. The binary try to load the ld.so dynamic linker *BUT*, before, it checks the ld.so magic number and find it reversed !! (then it dies, spiting something about 'bad ld.so magic'). That's an old problem. Nobody seems to worry about since porting from Net to Free is quiet easy. It would be a good solution to create a /emul/NetBSD lookup (like IBSC2) before the / lookup. (Okay, Okay, i now it's easier to say it than to do it. Don't hit on my head !! not my head !! was only a sugestion..). From owner-freebsd-emulation Thu Feb 5 05:21:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA17280 for freebsd-emulation-outgoing; Thu, 5 Feb 1998 05:21:12 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from linum.cofc.edu (linum.cofc.edu [153.9.35.19]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA17264 for ; Thu, 5 Feb 1998 05:20:54 -0800 (PST) (envelope-from astrand@linum.cofc.edu) Received: (from astrand@localhost) by linum.cofc.edu (8.8.7/8.8.7) id IAA19767; Thu, 5 Feb 1998 08:21:27 -0500 (EST) (envelope-from astrand) To: Remy NONNENMACHER Subject: Re: NetBSD emulation cc: freebsd-emulation@FreeBSD.ORG References: From: Allan Strand Date: 05 Feb 1998 08:21:26 -0500 In-Reply-To: Remy NONNENMACHER's message of Wed, 4 Feb 1998 16:10:26 -0100 (GMT) Message-ID: <86wwfaxk4p.fsf@linum.cofc.edu> Lines: 39 X-Mailer: Gnus v5.5/Emacs 20.2 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" Remy NONNENMACHER writes: > > NetBSD *IS* emulated by FreeBSD. The problem is that someone (Net ? Free > ?) reversed the exec magic number. This means that FreeBSD recognizes the > NetBSD Magic, load and starts the binary. The binary try to load the > ld.so dynamic linker *BUT*, before, it checks the ld.so magic number and > find it reversed !! (then it dies, spiting something about 'bad ld.so > magic'). > > That's an old problem. Nobody seems to worry about since porting from > Net to Free is quiet easy. > > It would be a good solution to create a /emul/NetBSD lookup (like IBSC2) > before the / lookup. (Okay, Okay, i now it's easier to say it than to do > it. Don't hit on my head !! not my head !! was only a sugestion..). Remy, It may be easier to say than to do this, but I really have little concept of what is involved in either. My read of your message is that there is currently no way to run the NetBSD binaries and it appears that there will not be any way in the future either given that I don't have the time/ability to fix the incompatibility you mentioned above. By the way, I agree that porting most of the software during my move from NetBSD to freebsd has been quite easy (those things that had not already been ported). I like freebsd. However, I still need to run a couple of NetBSD binaries. Cheers, A. -- Allan E. Strand Internet: stranda@cofc.edu Department of Biology Phone: (803) 953-8085 College of Charleston Fax: (803) 953-5453 Charleston, SC 29424 From owner-freebsd-emulation Thu Feb 5 10:07:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA27969 for freebsd-emulation-outgoing; Thu, 5 Feb 1998 10:07:43 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from pegasus.com (pegasus.com [206.127.225.31]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id KAA27961 for ; Thu, 5 Feb 1998 10:07:39 -0800 (PST) (envelope-from richard@pegasus.com) Received: by pegasus.com (8.6.8/PEGASUS-2.2) id IAA09715; Thu, 5 Feb 1998 08:07:12 -1000 Date: Thu, 5 Feb 1998 08:07:12 -1000 From: richard@pegasus.com (Richard Foulk) Message-Id: <199802051807.IAA09715@pegasus.com> In-Reply-To: Allan Strand "Re: NetBSD emulation" (Feb 5, 8:21am) X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: freebsd-emulation@FreeBSD.ORG Subject: Re: NetBSD emulation Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" } > NetBSD *IS* emulated by FreeBSD. The problem is that someone (Net ? Free } > ?) reversed the exec magic number. This means that FreeBSD recognizes the } > NetBSD Magic, load and starts the binary. The binary try to load the } > ld.so dynamic linker *BUT*, before, it checks the ld.so magic number and } > find it reversed !! (then it dies, spiting something about 'bad ld.so } > magic'). } > So what about fudging a copy with the magic number modified? Richard From owner-freebsd-emulation Fri Feb 6 02:18:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA13581 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 02:18:26 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from bsd.synx.com (rt.synx.com [194.167.81.239]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id CAA13576 for ; Fri, 6 Feb 1998 02:18:15 -0800 (PST) (envelope-from remy@synx.com) Received: from s3.synx.com (s3 [192.1.1.247]) by bsd.synx.com (8.6.12/8.6.12) with SMTP id LAA12687; Fri, 6 Feb 1998 11:22:38 +0100 Received: from rs1 by s3.synx.com id aa14244; 6 Feb 98 11:08 GMT Date: Fri, 6 Feb 1998 11:09:33 -0100 (GMT) From: Remy NONNENMACHER To: Richard Foulk cc: freebsd-emulation@FreeBSD.ORG Subject: Re: NetBSD emulation In-Reply-To: <199802051807.IAA09715@pegasus.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" On Thu, 5 Feb 1998, Richard Foulk wrote: > } > NetBSD *IS* emulated by FreeBSD. The problem is that someone (Net ? Free > } > ?) reversed the exec magic number. This means that FreeBSD recognizes the > } > NetBSD Magic, load and starts the binary. The binary try to load the > } > ld.so dynamic linker *BUT*, before, it checks the ld.so magic number and > } > find it reversed !! (then it dies, spiting something about 'bad ld.so > } > magic'). > } > > > So what about fudging a copy with the magic number modified? > AFAIK (as it was time ago when i switched from Net to Free, when i got the problem) the NetBSD emulation in Free have no 'file lookup' on a specific directory (but it have for Linux and IBCS2). I think it's due to the fact that Net and Free are quiet the same at syscalls level and emul dvl decided not to make a specific lookup environment. I remember i made an horrible hack somewhere to trap the open, by a NetBSD program, of the specific file 'ld.so' to use an /emul lookup. It was so ugly and unreliable that i abandonned the whole thing. (better recompile ...). I can't precisely remember but i believe the a.out Magic Number reversing was done beetween two versions of NetBSD (1.0 to 1.1, i guess). Maybe someone could confirm this historic point ? (I also remember the respect i felt for the ones dealing with shared libs and exec loading... It's far above a simple 'load text, load data, create stack, return to start point'). > > Richard > From owner-freebsd-emulation Fri Feb 6 08:47:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA10207 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 08:47:16 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from spot.cs.utk.edu (SPOT.CS.UTK.EDU [128.169.92.189]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA10184 for ; Fri, 6 Feb 1998 08:47:02 -0800 (PST) (envelope-from moore@cs.utk.edu) Received: from cs.utk.edu by spot.cs.utk.edu with ESMTP (cf v2.11c-UTK) id LAA13854; Fri, 6 Feb 1998 11:45:45 -0500 (EST) Message-Id: <199802061645.LAA13854@spot.cs.utk.edu> X-URI: http://www.cs.utk.edu/~moore/ From: Keith Moore To: Remy NONNENMACHER cc: Allan Strand , freebsd-emulation@FreeBSD.ORG, moore@cs.utk.edu Subject: Re: NetBSD emulation In-reply-to: Your message of "Wed, 04 Feb 1998 16:10:26 -0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 06 Feb 1998 11:45:30 -0500 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" > NetBSD *IS* emulated by FreeBSD. The problem is that someone (Net ? Free > ?) reversed the exec magic number. This means that FreeBSD recognizes the > NetBSD Magic, load and starts the binary. The binary try to load the > ld.so dynamic linker *BUT*, before, it checks the ld.so magic number and > find it reversed !! (then it dies, spiting something about 'bad ld.so > magic'). [...] > It would be a good solution to create a /emul/NetBSD lookup (like IBSC2) > before the / lookup. (Okay, Okay, i now it's easier to say it than to do > it. Don't hit on my head !! not my head !! was only a sugestion..). afaik, it's what NetBSD does. In order to use NetBSD's emulation with dynamic binaries, you typically need the native ld.so and lib*.so library files installed in /emul/whatever. It's probably a good idea to have an /emul directory for every emulation. It provides all kinds of flexibility to work around platform-specific ideosyncracies. Keith From owner-freebsd-emulation Fri Feb 6 12:52:48 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA25522 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 12:52:48 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from atlantis.eunet.at (a064.static.Vienna.AT.EU.net [193.154.186.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA25514; Fri, 6 Feb 1998 12:52:44 -0800 (PST) (envelope-from hfwirth@eunet.at) Received: from atlantis (localhost.ping.at [127.0.0.1]) by atlantis.eunet.at (8.8.8/8.6.12) with SMTP id RAA07731; Mon, 2 Feb 1998 17:25:38 +0100 (MET) Message-ID: <34D5F382.41C67EA6@eunet.at> Date: Mon, 02 Feb 1998 17:25:38 +0100 From: "Helmut F. Wirth" X-Mailer: Mozilla 3.04Gold (X11; I; FreeBSD 3.0-CURRENT i386) MIME-Version: 1.0 To: hackers@FreeBSD.ORG CC: emulation@FreeBSD.ORG Subject: Cross debugging Linux programs on FreeBSD works! Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" Hello ! To all interested parties: I have a solution for debugging Linux programs under FreeBSD. I will give a short description here, because the recent discussion was in hackers too. Look for more in emulation or send an email to me: What I did: According to John Polstra's newer instructions I installed the binutils-2.8.1 and built his elfkit. This step is useful, but not neccessary. What you need in any case are the binutils-2.8.1. I configured them for i386-unknown-freebsdelf. With some small patches (rather hacks) I am able to build the FreeBSD-current sources of gdb in a fresh directory for debugging of native FreeBSD programs in ELF binary format and for debugging Linux ELF binaries, including shared libs. Please keep in mind, that this solution is *not well tested* !! But it seems to work! For detailed instructions and more please refer to emulation@freebsd.org If somebody is willing to contribute free space on a ftp-server I will download the binaries for linux-gdb and elf-gdb Regards Helmut -- Helmut F. Wirth Email: hfwirth@ping.at From owner-freebsd-emulation Fri Feb 6 14:01:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA09763 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 14:01:44 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from mail-relay.ubc.ca (mail-relay.ubc.ca [137.82.1.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA09746 for ; Fri, 6 Feb 1998 14:01:34 -0800 (PST) (envelope-from amor@geop.ubc.ca) Received: from ubc.ca (gafs.geop.ubc.ca [137.82.49.1]) by mail-relay.ubc.ca [137.82.1.2] (8.8.8/8.8.8) with SMTP id OAA24408 for ; Fri, 6 Feb 1998 14:01:23 -0800 (PST) Received: from gepa.geop.ubc.ca (gepa.ARPA) by ubc.ca (4.1/1.14) id AA01002; Fri, 6 Feb 98 14:01:22 PST Received: by gepa.geop.ubc.ca (SMI-8.6/SMI-SVR4) id OAA08564; Fri, 6 Feb 1998 14:01:19 -0800 Date: Fri, 6 Feb 1998 14:01:19 -0800 From: amor@geop.ubc.ca (John Amor) Message-Id: <199802062201.OAA08564@gepa.geop.ubc.ca> To: freebsd-emulation@FreeBSD.ORG Subject: linux emulation problem with floating license server X-Sun-Charset: US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" I am tring to get matlab to run in linux emulation under freebsd 2.2.5. Our matlab license is centrally administered using matlab supplied flexlm and a floating license. Using a ktrace it appears to be getting garbage back from the license server when it tries to sign out a copy. Anyone with any ideas on whats wrong or were to look? Thanks, John ---------------------------------------------------------------------------- John Amor -- Systems Manager -- Geophysical Research Processing Facility amor@eos.ubc.ca (604) 822-6933 Department of Earth and Ocean Sciences http://www.geop.ubc.ca/~amor/amor.html University of British Columbia, Canada =============================================================================== Here is the ktrace in the problem area. ... 2839 matlab CALL reboot(0x4,0x2,0x1) 2839 matlab RET reboot 0 2839 matlab CALL old.recv(0x3,0xefbfd1d4) 2839 matlab RET old.recv 0 2839 matlab CALL write(0x4,0xefbfd338,0x93) 2839 matlab GIO fd 4 wrote 147 bytes "h\M-|13amor\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0wavelet\0\0\0\0\0\0\0\0\0\ \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0MLM\0\0\0\0\0\0\0\0/dev/ttyp3\0\0\0\ \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0T\0\0\0\0\0\0\0\0\0\0\0\000283\ 9\0\0\0\0\0\0\0i86_l1\0\0\0\0\0\0\0\^E\0\0\0\0\0\0\0" 2839 matlab RET write 147/0x93 2839 matlab CALL obs_vread(0xe,0xefbfd1b4,0xefbfd1a4) 2839 matlab RET obs_vread 0 2839 matlab CALL bind(0,0x86632e0,0x86632f0) 2839 matlab RET bind 0 2839 matlab CALL mincore(0xefbfd19c,0xefbfd194) 2839 matlab RET mincore 0 2839 matlab CALL setpgid(0xefbfd198) 2839 matlab RET setpgid 1 2839 matlab CALL mincore(0xefbfd19c,0xefbfd194) 2839 matlab RET mincore 0 2839 matlab CALL obs_vread(0xe,0xefbfd1b4,0xefbfd1a4) 2839 matlab RET obs_vread 0 2839 matlab CALL bind(0,0x86632f0,0) 2839 matlab RET bind 0 2839 matlab CALL mincore(0xefbfd1b8,0xefbfd1b0) 2839 matlab RET mincore 0 2839 matlab CALL mincore(0xefbfd148,0xefbfd140) 2839 matlab RET mincore 0 2839 matlab CALL setpgid(0xefbfd144) 2839 matlab RET setpgid 1 2839 matlab CALL mincore(0xefbfd148,0xefbfd140) 2839 matlab RET mincore 0 2839 matlab CALL read(0x4,0xefbfd2a4,0x93) 2839 matlab GIO fd 4 read 147 bytes "W\M^?-60\0\0002\0\0\0\0\0\^A\0\0\M-p\M-T\M-n\M-D\0\0\0002\0\0\0\0\0\^A\ \0\0\0\0\0\M^H5'V \M-p\M-T\M-n\M-D4\M-U, \0\^E\M-Y\M-p\0\0\0\M-`\0\^ET\ \0\0\0\0007\0\0\0\^C\0\^E\M-Y\M-8\M-o\M^?\M-|(\0\^B\M^V\M^H\0\0\0\0\0\ \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0004\M-U+\M-f\0\^ET\0\0\^B\M^Vx\0\^B\M^V|\ 4\M-U, \0\^ET\0\0\^B\M^Vx\0\^B\M^V|\M^?\0\0\b\0\0\0\b\0\0\0\M^S\0\0\0" 2839 matlab RET read 147/0x93 2839 matlab CALL close(0x4) 2839 matlab RET close 0 2839 matlab CALL old.recv(0xd,0xefbfd1dc) 2839 matlab RET old.recv -1 errno -9 Unknown error: -9 2839 matlab CALL close(0xffffffff) 2839 matlab RET close -1 errno -9 Unknown error: -9 2839 matlab CALL obs_vread(0xe,0xefbfd1b4,0xefbfd1a4) 2839 matlab RET obs_vread 0 2839 matlab CALL bind(0,0x8663300,0) 2839 matlab RET bind 0 2839 matlab CALL write(0x1,0x1069f000,0x1a) 2839 matlab GIO fd 1 wrote 26 bytes "MATLAB cannot be started. " 2839 matlab RET write 26/0x1a 2839 matlab CALL write(0x1,0x1069f000,0x33) 2839 matlab GIO fd 1 wrote 51 bytes "Invalid returned data from license server (-12,16) " 2839 matlab RET write 51/0x33 2839 matlab CALL obs_execv(0x867b8a8,0xefbf5544,0xefbfd618) 2839 matlab NAMI "/compat/linux/usr/local/opt/MATLAB-5.0/etc/lmerror" 2839 matlab NAMI "/usr/local/opt/MATLAB-5.0/etc/lmerror" 2839 matlab NAMI "/bin/sh" ... ================================================================ From owner-freebsd-emulation Fri Feb 6 14:15:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA12015 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 14:15:11 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from dingo.cdrom.com (dingo.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA12010 for ; Fri, 6 Feb 1998 14:15:09 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost [127.0.0.1]) by dingo.cdrom.com (8.8.8/8.8.5) with ESMTP id IAA01299; Sat, 7 Feb 1998 08:36:58 -0800 (PST) Message-Id: <199802071636.IAA01299@dingo.cdrom.com> X-Mailer: exmh version 2.0zeta 7/24/97 To: amor@geop.ubc.ca (John Amor) cc: freebsd-emulation@FreeBSD.ORG Subject: Re: linux emulation problem with floating license server In-reply-to: Your message of "Fri, 06 Feb 1998 14:01:19 PST." <199802062201.OAA08564@gepa.geop.ubc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 07 Feb 1998 08:36:57 -0800 From: Mike Smith Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" > I am tring to get matlab to run in linux emulation under freebsd 2.2.5. > > Our matlab license is centrally administered using matlab supplied flexlm > and a floating license. Using a ktrace it appears to be getting garbage back > from the license server when it tries to sign out a copy. > > Anyone with any ideas on whats wrong or were to look? The emulation of the Linux UDP calls in 2.2.5 is broken, unfortunately. If you can, upgrade to -stable. If this isn't possible, you should be able to build a new Linux LKM by replacing the files in your system's /usr/src/sys/i386/linux with those from -stable, then going to /usr/src/lkm and saying: # make # make install (You will have to reboot after this). The files from -stable you need are available from ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-stable/src/sys/i386/linux Sorry about this. If you have an opportunity to install the FreeBSD-2.2.6 beta when it arrives (a couple of weeks at most) and check Matlab on it we would be *VERY* appreciative. We would like to be sure that as many as possible of the shrinkwrapped applications that are available work properly on 2.2.6 before it's released. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ From owner-freebsd-emulation Fri Feb 6 14:20:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA12584 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 14:20:58 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from sag.space.lockheed.com (sag.space.lockheed.com [192.68.162.134]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id OAA12551 for ; Fri, 6 Feb 1998 14:20:55 -0800 (PST) (envelope-from handy@sag.space.lockheed.com) Received: from localhost by sag.space.lockheed.com; (5.65v3.2/1.1.8.2/21Nov95-0423PM) id AA26889; Fri, 6 Feb 1998 14:20:33 -0800 Date: Fri, 6 Feb 1998 14:20:33 -0800 (PST) From: Brian Handy To: Mike Smith Cc: freebsd-emulation@FreeBSD.ORG Subject: Re: linux emulation problem with floating license server In-Reply-To: <199802071636.IAA01299@dingo.cdrom.com> Message-Id: X-Files: The truth is out there Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" >We would like to be sure that as many as possible of the shrinkwrapped >applications that are available work properly on 2.2.6 before it's >released. I'm running a couple-days-old 2.2-STABLE, and IDL works fine under the linuxulator with the license manager...though I surmise Mike knows this. (I've also run the linux RC5 client on this box, and that works too. I don't know how exactly it talks to the network, but that seemed to work just fine too. :-) Brian From owner-freebsd-emulation Fri Feb 6 19:41:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA28329 for freebsd-emulation-outgoing; Fri, 6 Feb 1998 19:41:38 -0800 (PST) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from rah.star-gate.com (rah.star-gate.com [209.133.7.178]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA28322; Fri, 6 Feb 1998 19:41:35 -0800 (PST) (envelope-from hasty@rah.star-gate.com) Received: from rah (localhost.star-gate.com [127.0.0.1]) by rah.star-gate.com (8.8.8/8.8.8) with ESMTP id TAA00227; Fri, 6 Feb 1998 19:41:19 -0800 (PST) (envelope-from hasty@rah.star-gate.com) Message-Id: <199802070341.TAA00227@rah.star-gate.com> X-Mailer: exmh version 2.0gamma 1/27/96 To: "Helmut F. Wirth" cc: hackers@FreeBSD.ORG, emulation@FreeBSD.ORG Subject: Re: Cross debugging Linux programs on FreeBSD works! In-reply-to: Your message of "Mon, 02 Feb 1998 17:25:38 +0100." <34D5F382.41C67EA6@eunet.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 06 Feb 1998 19:41:19 -0800 From: Amancio Hasty Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-emulation" Just stick the binaries in ftp.freebsd.org:/pub/FreeBSD/incoming Cheers, Amancio