On Mon, Feb 2, 2009 at 12:53 AM, Stefan Reinauer stepan@coresystems.de wrote:
One thing I wonder though, do we want to call weak symbols unconditionally, as in Rudolf's code? No if() clause catches the case that the symbol isn't there. In a test program that call would segfault a user space program here.
if you're going to have a weak symbol I can't see any reason NOT to call it unconditionally. The symbol is always defined.
If you're going to call it unconditionally then you might as well put it in a file by itself, and either compile that file in or compile in code that has a different definition of the function. That way, if you know which files are used to build a mainboard, you also know exactly which functions are used -- the ones in the files.
Weak symbols can be frustrating when you're using code management tools like kscope or eclipse. You've to two symbols defined in the source code base -- which do you use? (yes, I know we can tell people 'just ignore the weak one' but the code analysis tools are not always that smart).
I'm still not convinced we need them. We can get the same capability (in v3 anyway) just by carefully selecting which files to build into a project.
Weak symbols can make sense in a project (like glibc) where one can never know what files are being compiled in as part of a program (by definition, it's a library), but that logic does not apply to coreboot, which is not a library.
ron