(Please suscribe to the list to not miss replies.) Kári Davíðsson <k...@6000k.net> wrote:
> I can compile my application and link in this library without errors, > but then .init8 and .fini8 sections are stripped out of the final > executable, e.g. No, they are not "stripped", they simply never made it there, because the linker had no reason to include those object modules in the first place. > If I on the other hand link the application by specifying all of the > library object files on the command line, every thing works just fine. Sure, object files specified on the command line are always linked. Object modules within a library are only pulled in to satisfy global references which are undefined at the point where the library is being processed (that's why the position of a library on the command line is important). Presumably, your init/fini object modules don't define any symbol that is being needed by the linker, so they are not considered. What you could do is putting one global symbol into each of your modules (perhaps you've already got some?), and then explicitly tell the linker that just this symbol is global undefined, using the -u option. This will make the linker pull in that entire object module from the library. avr-g++ -g -Os -DF_CPU=16000000UL -mmcu=atmega328p myapp.o \ -Wl,-u,symbol1 -Wl,-u,symbol2 \ -L. -lmylib -o myapp (The -Wl option is used to prefix a linker-only option on the compiler command line.) -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list