Forum Discussion
Altera_Forum
Honored Contributor
20 years agolinker question
hello, In my project, some global variables are placed in a library. These variables are used in a class that also has a global instance in that library. The constructor of that class places po...
Altera_Forum
Honored Contributor
20 years agoHi Steffan,
Ok, I think I understand now: Your application, and the library code that your application references does not actually reference the underlying file data symbols -- yes? When the linker searches archive files, it only seeks to resolve undefined symbol references. When the reference is found, the contents of the file (from the archive) where the symbol is defined is linked in. If it searches an archive and does not find any unresolved symbols, the contents are _not_ linked in. A way around this is to use the the --whole-archive option. This will force all of the object files in an archive to be linked in -- even when no undefined references are found. You can (should) turn this option off again with --no-whole-archive. I have rarely used this feature, and I have yet to try it with nios2-elf ... so my experience with this is out-of-date and foggy at best. You might want to dig into the man pages ... or perhaps someone else can offer some insight. Very sorry I haven't been much help :-/ Regards, --Scott