'Custom substitutions for compression in the Itanium ABI

The Itanium ABI has some rules for compressing identifier for name mangling: for instance, given

namespace foo {
  struct string { 
    void f();
  };
};

the function foo::string::f() is encoded as _ZN3foo6string1fEv but given

namespace std {
  struct string { 
    void f();
  };
};

the function std::string::f() is encoded as _ZNSt6string1fEv which is a bit shorter. There are other shortcuts, for instance for std::allocator, std::basic_string, etc.

My question is: is there a way to specify such rules for my own library ? For instance I have an awful lot of symbols containing

_ZZN5boost9container16allocator_traitsINS0_22small_vector_allocatorISt4pairIhhENS0_13new_allocatorIvEEvEEE9constructIS4_JRKS4_EEEvRS7_PT_DpOT0_E5value

_ZGVN5boost4asio6detail30execution_context_service_baseINS1_22deadline_timer_serviceINS1_18chrono_time_traitsINSt6chrono3_V212system_clockENS0_11wait_traitsIS7_EEEEEEE2idE

etc... which bloat my binaries for no good reason.

Pre-emptively answering questions:

  • I already use compressed debug infos, this is not enough
  • I have to export these symbols (but the code dynamically calling them can be assumed to be aware of any change that I would make, I am in control of the entire toolchain)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source