`cls_timeindex_entry` defines `encode()` and `decode()` inline in
`cls_timeindex_types.h`, but `dump()` and `generate_test_instances()` are
defined out of line in `cls_timeindex_types.cc`. That `.cc` was compiled
only into `cls_timeindex_client`, not into the `cls_timeindex objclass`
shared library. At `-O2` the optimizer inlines and dead-code-eliminates
these unused `dump()` paths, so `cls_timeindex.so` ends up with no
reference to the out-of-line symbols and loads fine. At `-O0` nothing is
inlined or eliminated: the header-inline `dump()` is emitted and leaves
an undefined reference to `cls_timeindex_entry::dump()` in
`cls_timeindex.so`, so `dlopen()` of the objclass fails at load time.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
# cls_timeindex
-set(cls_timeindex_srcs timeindex/cls_timeindex.cc)
+set(cls_timeindex_srcs timeindex/cls_timeindex.cc timeindex/cls_timeindex_types.cc)
add_library(cls_timeindex SHARED ${cls_timeindex_srcs})
set_target_properties(cls_timeindex PROPERTIES
VERSION "1.0.0"