
Dear Wolfgang,
On 11/05/2010 01:14 PM, Wolfgang Denk wrote:
1.1) Stop using weak symbols; use pre-initialized function pointers instead (possibly grouped in a struct, for cleanliness). This has the benefit of offering a clear interface and being independent of toolchain details.
And where would the "pre-initialized function pointers" come from? Without adding a hell of #ifdef's ?
It would not be pretty, and, as pointed out by Joakim Tjernlund, it would not work before relocation.
1.2) Use regular (non-weak) extern declarations for overridable stuff; collect all default weak symbols into a separate library archive, to be supplied last to the linker.
Not realy practicable, as the code is distributed all over the place, and should remain where it logically belongs.
Each module could have its own "defaults.c" for overridable implementations, and the build system could collect all of these. It is not a pain-free solution.
1.3) Stop using a library archive for the board specific stuff. Instead, collect and link all the object files to produce the output binary. Only Makefile changes are involved, but correct behavior depends on all boards doing the right thing.
Close. I think stop using a library archives and do what Linux does instead is the way to go.
Partial linking with ld -r ? That does seem like a fairly simple change.
Regards,
Sebastien Carlier