Forum Discussion
Altera_Forum
Honored Contributor
12 years agoThank you for the precise analysis!
Some additional comments: 1) http://www.altera.com/literature/hb/nios2/n2cpu_nii5v1.pdf 7-12 documents the 64KB GOT limit: Because the GOT-relative and TP-relative relocations are 16-bit relocations, no single object file can require more than 64 KB of GOT and no dynamic object using local dynamic or local executable thread-local storage (TLS) can have more than 64 KB of TLS data. New relocations might be added to support this in the future. It may be time to think about the mentioned future support for larger GOT via -fPIC. 2) To date this limitation seems to mainly affect C++ programs. C++ apparently likes to generate lots of global symbols. This URL documents a C++ library with 200,000 global symbols: http://gcc.gnu.org/wiki/visibility. Clearly that would swamp a 64KB GOT table, at least when naively used. (-fsection-anchors sounds like an attempt to be smarter about such things, but is apparently not supported on Nios2, at least as yet.) 3) I have one report of -Os (or -O2) resolving a similar issue. This is a workaround rather than a fix, but might be useful all the same.