From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 13 13:08:29 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D11BF16A41A for ; Tue, 13 Jun 2006 13:08:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2093743D45 for ; Tue, 13 Jun 2006 13:08:28 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k5DD8P94022803; Tue, 13 Jun 2006 09:08:27 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 13 Jun 2006 09:08:24 -0400 User-Agent: KMail/1.9.1 References: <20060606144455.GA502@stud.fit.vutbr.cz> <20060613090111.GS54415@deviant.kiev.zoral.com.ua> In-Reply-To: <20060613090111.GS54415@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200606130908.25380.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Tue, 13 Jun 2006 09:08:28 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1537/Tue Jun 13 07:24:06 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Konstantin Belousov , Divacky Roman Subject: Re: SoC: strange magic with objcopy and module builds 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: Tue, 13 Jun 2006 13:08:29 -0000 On Tuesday 13 June 2006 05:01, Konstantin Belousov wrote: > On Tue, Jun 06, 2006 at 04:44:55PM +0200, Divacky Roman wrote: > > Hi, > >=20 > > I am working on SoC linuxolator and I found strange thing I dont know h= ow to > > cope with: > >=20 > > I made a patch which enables module build of linuxolator on amd64 but it > > refuses to kldload because of missing symbol. I tracked the problem dow= n to > > the fact that i386 module build works in a way that it builds .kld and = then > > turns this into .ko: > >=20 > > ld -Bshareable -d -warn-common -o linux.ko linux.kld > >=20 > > this line makes transition from U symbol to A symbol. > >=20 > > Amd64 version uses only .ko, so this step doesnt exist there so those s= ymbols > > remain U. > >=20 > > can someone explain me whats going on? > >=20 > > thnx roman > In private communication, Roman said that the problem symbols > are __start* and __stop*. That symbols are generated by the static linker > for the section start/end. >=20 > Since AMD64 uses relocatable objects as kld instead of shared ones, > that symbols are leaved undefined. >=20 > Patch below will simulate behaviour of the static linker for the > in-kernel elf_obj linker. The patch makes the linker_set.h > machinery fully operatable on AMD64. Please test. Alternatively you can not use the SET_* macros in kernel modules, but ask the kernel linker to lookup the linker sets you need in your mod_event handler. The linker manually looks up linker sets for things like sysinit and sysctl, so it is probably best if we continue to just look them up manually. You don't want to create duplicate start/stop for existing sets which might confuse things. I have an example of this for HEAD in my crash and crash2 modules available in the smpng branch in p4 at //depot/projects/smpng/src/sys/modules/crash/crash.c and //depot/projects/smpng/src/sys/modules/crash2/crash2.c. I'm not opposed to this fix either though, but peter@ should probably review it. =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org