Problem solved, sort of

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
VE3MTM

Problem solved, sort of

Post by VE3MTM »

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
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

RE:Problem solved, sort of

Post by df »

tried using a custom link script?
-- Stu --
VE3MTM

RE:Problem solved, sort of

Post by VE3MTM »

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.
Post Reply