Linker set issues with ath(4) HALs

Peter Jeremy peterjeremy at acm.org
Sat Mar 5 08:50:10 UTC 2011


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:

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

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_set_ah_rf
s'
ah.o(.text+0x241):/usr/src/sys/dev/ath/ath_hal/ah.c:142: undefined reference to  `__stop_set_ah_rfs'
ah.o(.text+0x25a):/usr/src/sys/dev/ath/ath_hal/ah.c:142: undefined reference to  `__stop_set_ah_rfs'

Following a suggestion by a friend, I changed that to:

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

and it worked.  Normally, I would leave it at that but I'd like to
understand what is actually going on...

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);

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.

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.

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?

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20110305/baf3986e/attachment.pgp


More information about the freebsd-stable mailing list