From owner-freebsd-stable@FreeBSD.ORG Sat Mar 5 09:49:02 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E67B21065677 for ; Sat, 5 Mar 2011 09:49:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 80FFF8FC21 for ; Sat, 5 Mar 2011 09:49:01 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p259msmc091974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Mar 2011 11:48:54 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p259msvw070601; Sat, 5 Mar 2011 11:48:54 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p259ms5l070600; Sat, 5 Mar 2011 11:48:54 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 5 Mar 2011 11:48:54 +0200 From: Kostik Belousov To: Peter Jeremy Message-ID: <20110305094854.GM78089@deviant.kiev.zoral.com.ua> References: <20110305085004.GA70142@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M0Yq1Q+lJysaJ3ln" Content-Disposition: inline In-Reply-To: <20110305085004.GA70142@server.vk2pj.dyndns.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-stable@freebsd.org Subject: Re: Linker set issues with ath(4) HALs X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Mar 2011 09:49:02 -0000 --M0Yq1Q+lJysaJ3ln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 05, 2011 at 07:50:05PM +1100, Peter Jeremy wrote: > I have a Atheros AR5424 and so, based on the 8.2-STABLE i386 NOTES > and some rummaging in the sources, I tried to build a kernel with: >=20 > device ath # Atheros pci/cardbus NIC's > device ath_ar5212 # HAL for Atheros AR5212 and derived chips > device ath_rate_sample # SampleRate tx rate control for ath >=20 > and this died during the kernel linking with: > linking kernel.debug > ah.o(.text+0x23c): In function `ath_hal_rfprobe': > /usr/src/sys/dev/ath/ath_hal/ah.c:142: undefined reference to `__start_se= t_ah_rf > s' > ah.o(.text+0x241):/usr/src/sys/dev/ath/ath_hal/ah.c:142: undefined refere= nce to `__stop_set_ah_rfs' > ah.o(.text+0x25a):/usr/src/sys/dev/ath/ath_hal/ah.c:142: undefined refere= nce to `__stop_set_ah_rfs' >=20 > Following a suggestion by a friend, I changed that to: >=20 > device ath # Atheros pci/cardbus NIC's > options AH_SUPPORT_AR5416 > device ath_hal # Atheros HAL > device ath_rate_sample # SampleRate tx rate control for ath >=20 > and it worked. Normally, I would leave it at that but I'd like to > understand what is actually going on... >=20 > In both cases, ah.o contains the following 4 references: > U __start_set_ah_chips > U __start_set_ah_rfs > U __stop_set_ah_chips > U __stop_set_ah_rfs > generated by: > /* linker set of registered chips */ > OS_SET_DECLARE(ah_chips, struct ath_hal_chip); > /* linker set of registered RF backends */ > OS_SET_DECLARE(ah_rfs, struct ath_hal_rf); >=20 > These symbols do not appear in any other .o files, though there are a > variety of other __{start,stop}_set_* symbols - all of which show up > as 'A' (absolule) values in the final kernel. >=20 > My questions are: > How are these linker set references resolved? I can't find anything > that defines these symbols - either in .o files or in ldscript files. >=20 > In the first case, there are 2 pairs of undefined linker set variables > but the linker only reports one pair as unresolved. Why don't both > sets show up as resolved or unresolved? Why does using the generic > "ath_hal", rather than the hardware-specific HAL fix the problem? Linker synthesizes the symbols assuming the following two conditions are met: - the symbols are referenced; - there exists an ELF section named `set_ah_rfs'. It assigns the (relocated) start of the section to __start_, and end to __stop_. Most likely, omitting the option causes some SET_ENTRY() macro, which put a symbol into linker set, to be ommitted. Then, no section is created and linker does not synthesizes the missed symbols. --M0Yq1Q+lJysaJ3ln Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1yBwUACgkQC3+MBN1Mb4htQgCgtjZZsrmuhJ6qcQEGmtySwJv1 acsAoO39NeYz3lDohvc4ftEHLOCbh2dE =7ihQ -----END PGP SIGNATURE----- --M0Yq1Q+lJysaJ3ln--