From owner-freebsd-hackers Wed Apr 10 09:00:53 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA16381 for hackers-outgoing; Wed, 10 Apr 1996 09:00:53 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id JAA16375 for ; Wed, 10 Apr 1996 09:00:45 -0700 (PDT) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id BAA24172 for hackers@freebsd.org; Thu, 11 Apr 1996 01:58:52 +0930 From: Michael Smith Message-Id: <199604101628.BAA24172@genesis.atrad.adelaide.edu.au> Subject: DOS emulator; seek linker guru 8) To: hackers@freebsd.org Date: Thu, 11 Apr 1996 01:58:51 +0930 (CST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hot on the heels of Jordan's little announcement, I'm looking for a linker guru (John P?) to resolve the "put the pieces together" part for the user code. The scenario is this : most of the emulator code goes into a module called "doscmd.kernel". This has a private crt0.o module, and its own main() function. It's linked as : doscmd.kernel: crt0.o ${OBJS} ld -N -T 110000 -o doscmd.kernel ${LDFLAGS} crt0.o ${OBJS} ${LDADD} This is then loaded by a bootstrapper, "doscmd", that reads the OMAGIC format kernel in at its load address, and jumps to said start address. Its built as : doscmd: doscmd.kernel doscmd_loader.o ld -N -o doscmd ${LDFLAGS} /usr/lib/crt0.o doscmd_loader.o ${LDADD} In both cases: LDFLAGS+=-L/usr/X11R6/lib LDADD+= -lX11 -lc The former builds (after some work 8) but linking dies thus: ld -N -T 110000 -o doscmd.kernel -L/usr/X11R6/lib crt0.o AsyncIO.o ParseBuffer.o bios.o cmos.o config.o cwd.o device.o disktab.o doscmd.o exe.o i386-pinsn.o inout.o int10.o int11.o int12.o int13.o int14.o int15.o int16.o int17.o int1a.o int20.o int21.o int2f.o int33.o intff.o mem.o port.o setver.o signal.o trace.o trap.o tty.o -lX11 -lc ld: No reference to __DYNAMIC The second fails with : cc -O -I/sys -I/usr/X11R6/include -I. -DDISASSEMBLER -c doscmd_loader.c ld -N -o doscmd -L/usr/X11R6/lib /usr/lib/crt0.o doscmd_loader.o -lX11 -lc doscmd_loader.o: Undefined symbol `___main' referenced from text segment I'm aware I probably haven't covered enough here for a full answer, but if anyone can offer any suggestions, I'm keen. Alternatively, I'll put what diffs I have somewhere that said enthusiast can get at to alleviate the tedium of getting the rest to compile. -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[