Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We supply our own module _init (rce_modinit) and module _fini (rce_modfinish) code. Another reason not to use the standard _init/_fini code is that their source code was compiled with -fpic.
-nostdlib also prevents searching of the standard C++ libraries. Instead we'll want to search the symbol table of the RTEMS+newlib executable either at the time the module is produced or at run time.|

-fvisiblity=hidden

A shared object actually has two symbol tables, the normal one and a special "dynamic" table. The latter is the one that is searched in order to resolve inter-object references. In the past pretty much every non-static symbol from every object code file used to make the shared object went into the dynamic table. Since GCC 4.0 the compiler recognizes the -visibility option which controls the default visibility of symbols. Using -fvisibility=hidden makes "hidden" the default. Hidden symbols don't go into the dynamic symbol table so one can dramatically reduce its size. To make sure that the symbols associated with a variable, function or class do make it into the dynamic symbol table you need to mark it with _attribute_ ((visibility ("default"))):

...