mardi 25 juillet 2017

Finding the memory location of a compile-time constructed class

I'm trying to do some memory-usage analysis of using compile-time constructed classes by looking at the artifacts generated by compilation. I've marked several class constructors with "constexpr" and made sure they're trivial to ensure compile-time construction. Viewing the map file, I can see that the constructors and destructor functions are not included in the .text section any more.

Where, though, do these classes appear? I had assumed that they would be included in the .data section as a static instance of the class, but that doesn't seem to be the case. The .text section has shrunk but all other sections seem to be the same. Where is this data going?

(I'm using GCC 5.2.0 and creating a statically-linked ELF.)

Aucun commentaire:

Enregistrer un commentaire