I was looking at the size of the libraries in rust installations, and I noticed that .note.rust
is a big chuck. AIUI this is metadata that’s only needed at compile time to link to that library. So I have a few questions:
-
This section is marked WA, writable and allocated, which both seem unnecessary. If this data isn’t needed at runtime, then it doesn’t need to be allocated in memory at all, let alone writable, right? It’s probably not a big deal for memory use, since it won’t get paged in if it’s never touched, but it still seems wasteful.
-
If this section is not actually needed at runtime, then it could be stripped from the installed libraries in
$libdir
used by rustc et al. Only the libraries underrustlib/$target
actually need to keep the metadata for linking, right? -
It doesn’t seem to follow the standard note format (see here), which means commands like
readelf -n
can’t make sense of it at all. If rust followed this format, it could at least be listed properly, even if the contents are a mystery. Could this be changed?
Thoughts?