SEARCH  

NEWS

2010.10.06:11:36:28
Samochód w firmie - dodatek CD do Dziennika Gazety Prawnej
W środę, 6 października do „Dziennika Gazety Prawnej” dołączona zostanie płyta w całości poświęcona zagadnieniu użytkowania auta w firmie.

 

messageID:503060007874
author:Adrian Bunk
title:Re weak vs ifdef
On Wed, 17 Feb 2010, Grant Likely wrote: Question. If I use this pattern, and use the __weak attribute on core code functions wrapped with a #ifndef, then how does it mesh with EXPORT_SYMBOL*() statements? You cant. Or at least not the traditional way, which is to put the EXPORT_SYMBOL next to the definition of what gets exported. If you use __weak, you need to make sure that all users of said weak symbol are in another file. There are some compiler and/or binutils bugs with using weak symbols in the same translation unit, so the rule is that a weak definition hes to be somewhere else from the use - including EXPORT_SYMBOL. I also assume that at the core code site, the EXPORT_SYMBOL() must appear inside the #ifndef block so that a #define override doesnt break things. Correct? See above. You cant put it inside the _same_ #ifndef block. Youd have to put it in a different file, but yes, inside an ifndef. At which point the linker will just pick the right definition. However, in general, this probably gets ugly enough that the whole __weak thing is not great for exported stuff. Its likely mostly useful for some "generic" arch functionality that is always compiled in. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at rel="nofollow" vger.kernel.org/majordomo-info.html vger.kernel.org/majordomo-info.html
Index