[U-Boot-Users] Can't get strong symbol to override weak one
Wolfgang Denk
wd at denx.de
Fri Jun 13 09:09:46 CEST 2008
In message <f8328f7c0806122238p24054afcx5190acfda8a794c6 at mail.gmail.com> you wrote:
>
> I've played around a bit more and found that if I move my function to
> an existing file containing functions called from elsewhere, my code
> gets linked in. Further research shows that a 'feature' of ld is that
> it won't pull in a module that only has symbols that have already been
> resolved, even if the previously found version is weak.
Argh...
That's evil, but given the way ld works, I think I can understand it.
> IMHO, developers should be able to write board and cpu code to
> override weak symbols in libraries/drivers without having to worry
> about whether the intention was obeyed or not. ld has a switch
> '--whole-archive', that will pull in an entire archive, not just the
> modules that are referenced elsewhere with strong linkage.
Oh no. Please don;t even mention this...
> I propose to wrap both the 'board/$(BOARDDIR)/lib$(BOARD).a' and
> 'cpu/$(CPU)/lib$(CPU).a' arguments to ld in
> --whole-module/--no-whole-module in order to accomplish this goal. We
> definitely don't want to do this across the board because image size
> will increase quite a bit due to unused code. I believe that the
> board and cpu code, though, should be mostly free of cruft. If not,
> it should be restructured with appropriate CONFIGs, either in
> Makefiles or C code.
No, please do NOT do that. This will become a PITA.
Maybe somebody has a really clever idea, but I'm afraid we might end
up having to put all "strong" functions that are supposed to
overwrite weak ones into separate modules that get pulled in
unconditionally :-(
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Committee, n.: A group of men who individually can do nothing but as
a group decide that nothing can be done. - Fred Allen
More information about the U-Boot
mailing list