From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 21 20:44:35 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1205) id 2620C106566C; Mon, 21 Jun 2010 20:44:35 +0000 (UTC) Date: Mon, 21 Jun 2010 20:44:35 +0000 From: Navdeep Parhar To: John Baldwin Message-ID: <20100621204435.GA98177@hub.freebsd.org> Mail-Followup-To: John Baldwin , Andriy Gapon , freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org References: <4C1F798C.7010204@freebsd.org> <201006211143.26459.jhb@freebsd.org> <4C1F8BDD.9010408@freebsd.org> <201006211610.45811.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201006211610.45811.jhb@freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org, Andriy Gapon Subject: Re: amd64 kernel modules: mapping sections to addresses 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: Mon, 21 Jun 2010 20:44:35 -0000 On Mon, Jun 21, 2010 at 04:10:45PM -0400, John Baldwin wrote: > On Monday 21 June 2010 11:57:17 am Andriy Gapon wrote: > > on 21/06/2010 18:43 John Baldwin said the following: > > > np@ has a patch to gdb to fix this for kgdb. I haven't committed it as it > > > patched gdb internals and wasn't in a kgdb-specific place, but I'm not > sure of > > > a better way to fix kgdb. > > > > Oh, yes, section mapping is done in common gdb code. > > Perhaps kld.c shouldn't call build_section_table, but directly call > > bfd_map_over_sections with a custom variant of add_to_section_table? > > Can you please share the patch? > > It was deeper level than that, I'd have to dig it up. I'm using this patch these days: http://people.freebsd.org/~np/kgdb+kld+amd64.diff The changes to the kernel linker were not required originally. See this for why they had to be made: http://lists.freebsd.org/pipermail/freebsd-hackers/2009-November/030093.html The patch is quite crude and I have no idea how it behaves on other platforms. Regards, Navdeep > > > Still, what about a small tool, elf(3)-base porgram or objdump+objcopy shell > > script, that would set section addresses in amd64 .ko (relocatable object > file) > > similarly to how they are set in i386 .ko (full-blown DSO)? > > Or is this too much useless hassle? > > No idea. If this worked and just let gdb work automatically that would be a > nice fix to just put into the build process. > > -- > John Baldwin