Hi Florian,

What would be the most ELF-flavored way to implement this?  After the
final link, I expect that the count (or counts, we need a separate
counter for thread-local storage) would show up under a new dynamic tag
in the dynamic segment.  This is actually a very good fit because older
loaders will just ignore it.  But the question remains what GCC should
emit into assembler & object files, so that the link editor can compute
the total count from that.

(It would worthwhile asking this question of the LLVM community too,
since ideally we would like to use the same method in both compilers).


This sounds like an opportunity to add a couple of new GNU object
attributes:

  .gnu_attribute Tag_gnu_destructor_count, <number>
  .gnu_attribute Tag_gnu_tld_count, <count>

Which would then translate into a GNU object attribute notes in the
object file.

Cheers
  Nick

Reply via email to