Oracle Developer Studio 12.6 C++ Compiler Creates Identical Names In Separate Object Files For Symbols In Unnamed Namespace In Different Translation Units When Using -g Flag
(Doc ID 2798274.1)
Last updated on AUGUST 11, 2021
Applies to:Oracle Solaris Studio - Version 12.6 to 12.6 [Release 12]
Information in this document applies to any platform.
Two translation units have the same code in terms of namespace, class, struct, members and methods.
However, when compiling the two different translation units with Oracle Developer Studio 12.6 C++ compiler using -g flag, the produced binary code shows the same symbols like:
in contrast with the information in document:
<Document:1009220.1> When Recompiling Code, Identical Object Files Are Not Obtained.
For unnamed name spaces, the C++ compiler creates a pseudo-random hash from the name of the item, its scoping level, the name of the file in which it appears, and the compilation time stamp.
This means that Oracle Developer Studio 12.6 C++ compiler is not decorating the symbols with an expected pseudo-random hash to ensure no symbols collision occurs at link time.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document