By adding a --whole-archive flag to the ld command, I made it include everything, but this is a kludge. I know now why it did this "optimization": The drivers are never called into by name. The function pointer gives the initilization routine the address, but ld has no way to assocate this to the symbol, so it thinks they're all unused. It's too smart for its own good
I'd like to have a better solution than what I did, maybe something to let it associate the pointer to the symbol?
Thanks anyways
Problem solved, sort of
RE:Problem solved, sort of
I do use a custom link script. The .text section looks like this:
.text :
{
*(.text);
__boot_init_begin = .;
*(.boot_init);
__boot_init_end = .;
}
That way, the pointer list gets wrapped up with the rest of the code. The problem was that since ld didn't think that those object files were being used, it thought it was safe to discard them (and with them went the .boot_init data). What it didn't realize was that those pointers were the entry point into the object files.
.text :
{
*(.text);
__boot_init_begin = .;
*(.boot_init);
__boot_init_end = .;
}
That way, the pointer list gets wrapped up with the rest of the code. The problem was that since ld didn't think that those object files were being used, it thought it was safe to discard them (and with them went the .boot_init data). What it didn't realize was that those pointers were the entry point into the object files.