SPRUIG8J January 2018 – March 2024
Symbol hiding prevents the symbol from being listed in the output file's symbol table. While localization is used to prevent name space clashes in a link unit (see Section 12.4.16), symbol hiding is used to obscure symbols which should not be visible outside a link unit. Such symbol’s names appear only as empty strings or “no name” in object file readers. The linker supports symbol hiding through the --hide and --unhide options.
The syntax for these options are:
--hide='pattern'
--unhide='pattern'
The pattern is a "glob" (a string with optional ? or * wildcards). Use ? to match a single character. Use * to match zero or more characters.
The --hide option hides global symbols with a linkname matching the pattern. It hides symbols matching the pattern by changing the name to an empty string. A global symbol that is hidden is also localized.
The --unhide option reveals (un-hides) global symbols that match the pattern that are hidden by the --hide option. The --unhide option excludes symbols that match pattern from symbol hiding provided the pattern defined by --unhide is more restrictive than the pattern defined by --hide.
These options have the following properties:
In map files these symbols are listed under the Hidden Symbols heading.