sms wrote: ↑Tue Aug 22, 2023 12:11 am
Let's imagine that I have built some open-source C++ program on
various VMS system types, and intended to distribute objects as well as
executables, in case the victim might wish to re-link an executable.
I know approximately nothing about C++, but my keen observational
skills suggest that the compiler creates a [.cxx_repository] directory.
On IA64, this directory is populated with a single CXX$DEMANGLER_DB.;1,
and on Alpha, with a bunch of individual <MANGLED_NAME>.obj;* files.
Questions:
1. Would the repository file(s) be of any use to a potential victim
(who might wish to re-link an executable)?
2. Assuming that they're potentially useful:
On Alpha, it seems that there might be multiple versions of any
random <MANGLED_NAME>.obj file. In that case, are they _all_ useful,
or could the repository be purged with no loss of usefulness?
If this is documented someplace, a pointer to the useful doc should
suffice, but an actual answer would be at least as appreciated.
On Alpha, there are template instantiation objects in the repository directory. On Alpha, to [re-]link an application that uses templates, these objects must be available. The latest version of any such object file is sufficient.
On Alpha, to [re-]link an application, that uses templates, the CXXLINK tool must be used. (This is the tool which locates the instantiation objects and includes them in a subsequent LINK command).
On x86 and IA64 template instantiations are not in separate objects, so there are no such instantiation objects in the repository directory. On x86 and IA64 CXXLINK is not needed at all.
On x86, IA64 and Alpha the demangler database is in the repository. It is created/written by the C++ and C compilers. The latter uses it for long names with /NAME=SHORTENED. It's purpose is to demangle C++ and shortened C symbols. The tool to do the demangling for both types of symbols is CXXDEMANGLE. The database is not used by the linker.
On (x86 and) IA64 the linker can demangle C++ names for the map file and linker messages. It uses a demangling routine provided by the C++ RTL. It uses demangling information from the object. For x86, the demangling information is not yet included in the objects.
That is, for Alpha and using templates you need to provide the instantiation objects from the repository directory. For Alpha a "potential victim" needs CXXLINK to [re-]link, which to my knowledge is only provided with C++.