On Wed, 7 Feb 2018, Paul Smith wrote:

My question is, what do I need to do to ensure this behavior
persists if I create a global operator new/delete?

Is it sufficient to ensure that the symbol for our shared library
global new/delete symbols are hidden and not global, using a linker
map or -fvisibility=hidden?

I think so (hidden implies not-interposable, so locally bound), but
I don't have much experience there.

OK I'll pursue this for now.

I answered too fast. It isn't just new/delete that need to be hidden. It is also anything that uses them and might be used in both contexts. For instance, std::allocator<char>::allocate is an inline function that calls operator new. You get one version that calls new1, and one version that calls new2. If you don't do anything special, the linker keeps only one (more or less arbitrarily). So I believe you need -fvisibility=hidden to hide everything but a few carefully chosen interfaces.

--
Marc Glisse

Reply via email to