From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 6 23:11:30 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 532EC2DC for ; Thu, 6 Dec 2012 23:11:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id E47AC8FC08 for ; Thu, 6 Dec 2012 23:11:29 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qB6NBM8E032697; Fri, 7 Dec 2012 01:11:22 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qB6NBM8E032697 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qB6NBMVv032696; Fri, 7 Dec 2012 01:11:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 7 Dec 2012 01:11:22 +0200 From: Konstantin Belousov To: Shrikanth Kamath Subject: Re: ELF symtab and ddbsymtab difference Message-ID: <20121206231122.GE3013@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hRQRnCc2hL38uoUj" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2012 23:11:30 -0000 --hRQRnCc2hL38uoUj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 05, 2012 at 12:13:24PM +0530, Shrikanth Kamath wrote: > This is regarding the fields in the structure "elf_file_t" in link_elf.c. > For some kernel modules the symtab field is different from the ddbsymtab > field for some it is the same, would like to know what is the difference > between the two and how to enable ddbsymtab? Assuming we are talking about the link_elf.c and not about link_elf_obj.c. The symtab and ddbsymtab are first initialized from the dynamic symbol table in the module, and later, in the process of loading the module, if the non-dynamic symbol table is present, ddbsymtab is rewritten to point to the table. >=20 > Does enabling "-g" in CFLAGS make the binary build the ddbsymtab different > from symtab? No. It is strip done on the module which could result in the removal of the non-dynamic symtab. >=20 > The problem is lookup for some symbols in the kernel module that I built > returns with undefined, on inspecting it was getting a ENOENT from the > function > link_elf_lookup_symbol() > { > ... > /* If we have not found it, look at the full table (if loaded) */ > if (ef->symtab =3D=3D ef->ddbsymtab) > return (ENOENT); > ... > } It is not the problem. It just means that you dynamic symbol table does not contain the needed symbol, which is the problem. As a coincident, you also stripped your module, making the problem to be exposed. I guess that you should look at the EXPORT_SYMS feature of the module Makefiles. But I also remember there were some bugs. --hRQRnCc2hL38uoUj Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQwSYZAAoJEJDCuSvBvK1B5bQP+gOsuyPIj4GrcOUt70uVDysS dRWogfQmrBS1CMxflHvEmeR7xvkPwdbYBlPyWcJ4sIKsjQ9GayELHJ+Hm2eD4F4J reuiG6uvBUBRbVaPMalGkjbZ1xgyJL5LAvc8avxlnFl9Hrw39c8gzse/+AZAB+O/ N3bJQ5YxNTXWrp5PZaSOMAuNpYxPLrfjuQxEkCjmDKZ9gbtUgSLrCsadQizrjQlt PojTy3kzTKdt9PM67ZMLI1ahLtOxpghuzZ96M5yJOwqFadpvg9XS5HHTDSu/0XoI gq2wdPEO4HYLoXnUszvgEZ1x3xzoLPD4V1Z6XG5PYKeei2BBK3cujYml3qz6LQ5L SVDjszyiUgi7j33+djaPZZHKiB1Jiti63Kw2t17G1miYlS2Q/LWS3H9ZXd1JuEm/ xcMr1jslMKFCfDa+W9dwYN3hGW4z3ypDmV31N/ZjHp0i982FXdA1BAQcZMBuyb5B 2xAJfvXomrzBXLXaGGsRMYjL+VMXnjkDb3rXSJOyWJP4FiFpVD++xPQehfFfKHtw eKD7mUXtQD0k1PsIHqZ3veHKrnLmW6RyhlCA7WkJ4dTS4bJiK5lW93vbaC/ikrTO RClUdHsjmOJcxu4buzOMYraOozuz56Z6ClbzbaqagqCrj/kP8h7F59g+en9uGnTJ jGeuWqCR8O3Y/YT3TOOE =bkzM -----END PGP SIGNATURE----- --hRQRnCc2hL38uoUj--