Javier-varez / Postform

Postponed formatting experiments with string interning in C++. Inspired by the defmt Rust crate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String interning is broken on GCC

Javier-varez opened this issue · comments

It seems GCC ignores section attributes for static members of a template class. This causes the interned strings to be stored in .rodata instead of the custom interned sections .interned_strings. This is currently supported by clang (at least from version 10), but GCC silently ignores the section attribute and does not even provide a warning message.

https://stackoverflow.com/questions/36279162/section-attribute-of-a-function-template-is-silently-ignored-in-gcc
https://stackoverflow.com/questions/54040665/gcc-section-attribute-ignored-in-a-templated-function
https://stackoverflow.com/questions/42513904/is-attribute-section-something-on-a-static-member-of-a-template-class
https://answers.launchpad.net/gcc-arm-embedded/+question/615576

It appears to be reported as a bug in GCC too:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70435