Skip to content

ABI may depend on NDEBUG #9947

Closed
Closed
@pitrou

Description

In changeset ab4585a, the InternalMetadata destructor changed to the following:

#if defined(NDEBUG) || defined(_MSC_VER)
  ~InternalMetadata() {
    if (HasMessageOwnedArenaTag()) {
      delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask);
    }
  }
#else
  ~InternalMetadata();
#endif

This causes ABI problems between debug and non-debug in one specific case: when the -fvisibility-inlines-hidden compiler option is being used. According to the GCC wiki, that option has the following effect:

This causes all inlined class member functions to have hidden visibility, causing significant export symbol table size & binary size reductions

However, when libprotobuf.so was compiled in non-debug mode with -fvisibility-inlines-hidden enabled, any debug build of a third-party application will fail looking up ~InternalMetadata()

What version of protobuf and what language are you using?
Version: v3.20.1
Language: C++

What runtime / compiler are you using (e.g., python version or gcc version)
gcc 10.3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions