From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 30 18:46:32 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86E551065674 for ; Thu, 30 Oct 2008 18:46:32 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail34.syd.optusnet.com.au (mail34.syd.optusnet.com.au [211.29.133.218]) by mx1.freebsd.org (Postfix) with ESMTP id 1B25F8FC0A for ; Thu, 30 Oct 2008 18:46:31 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-215-175.belrs3.nsw.optusnet.com.au [122.106.215.175]) by mail34.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m9UIkRhQ017108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Oct 2008 05:46:30 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id m9UIkQBf065714; Fri, 31 Oct 2008 05:46:26 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id m9UIkPKn065713; Fri, 31 Oct 2008 05:46:25 +1100 (EST) (envelope-from peter) Date: Fri, 31 Oct 2008 05:46:25 +1100 From: Peter Jeremy To: Andriy Gapon Message-ID: <20081030184625.GA99398@server.vk2pj.dyndns.org> References: <4909DC03.1080901@icyb.net.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline In-Reply-To: <4909DC03.1080901@icyb.net.ua> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org Subject: Re: memtest86+ can not link: binutils issue? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2008 18:46:32 -0000 --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2008-Oct-30 18:08:35 +0200, Andriy Gapon wrote: >1. obtain and extract >http://www.memtest.org/download/2.01/memtest86+-2.01.bin.gz This is a compressed bootable image and can't be compiled. Possibly you mean http://www.memtest.org/download/2.01/memtest86+-2.01.tar.gz >2. run gmake: >$ gmake >gcc -E -traditional head.S -o head.s >as -32 -o head.o head.s >gcc -c -Wall -march=3Di486 -m32 -Os -fomit-frame-pointer -fno-builtin >-ffreestanding -fPIC -fno-strict-aliasing reloc.c >gcc -Wall -march=3Di486 -m32 -Os -fomit-frame-pointer -fno-builtin >-ffreestanding -fPIC -c -o main.o main.c >gcc -c -Wall -march=3Di486 -m32 -Os -fomit-frame-pointer -fno-builtin >-ffreestanding test.c Blows up at this point for me: gcc -c -Wall -march=3Di486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffre= estanding test.c test.c:14:20: error: sys/io.h: No such file or directory test.c: In function 'beep': test.c:1410: warning: implicit declaration of function 'outb_p' test.c:1410: warning: implicit declaration of function 'inb_p' test.c:1417: warning: implicit declaration of function 'outb' gmake: *** [test.o] Error 1 I can't find in CVS or any declarations for outb_p or inb_p in my source tree. >ld --warn-constructors --warn-common -static -T memtest_shared.lds \ > -o memtest_shared head.o reloc.o main.o test.o init.o lib.o >patn.o screen_buffer.o config.o linuxbios.o memsize.o pci.o controller.o >random.o extra.o spd.o error.o dmi.o && \ > ld -shared -Bsymbolic -T memtest_shared.lds -o memtest_shared >head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o >config.o linuxbios.o memsize.o pci.o controller.o random.o extra.o spd.o >error.o dmi.o >head.o(.text+0x7): In function `startup_32': >: undefined reference to `_GLOBAL_OFFSET_TABLE_' >Segmentation fault (core dumped) >gmake: *** [memtest_shared] Error 139 I can't help here. _GLOBAL_OFFSET_TABLE_ is related to the binutils PIC support and it appears that the linker doesn't like the code (in head.S) is explicitly referencing it. >Not only linking fails, but ld even crashes. I agree this shouldn't happen. >Can anybody suggest anything about this problem? It looks like stand-alone PIC code on FreeBSD needs some different incantations to Linux. My understanding is that several of the i386 bootstraps are relocatable so you might like to peruse the code in /usr/src/sys/boot/i386 for ideas. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkKAQEACgkQ/opHv/APuIenPACeP23KxKxwHhnUk82BZHgW0JST 8bQAn1a41Ti/4d8q8ZGSvHBJ/a4grW8x =aW3q -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--