[cfe-dev] Problem with using shared library built with Clang on Linux in -O0 mode
Eugene Zelenko via cfe-dev
cfe-dev at lists.llvm.org
Wed Mar 30 16:19:18 PDT 2016
My application generates C code and compile shared library to be
loaded and used by application later. We use GCC and consider to use
Clang as alternative for that purpose.
Library fills structure with information about code, some fields
pointing to local static variables (strings and arrays).
Everything worked when library was compiled with -O1, -O2, O3, but
when library was built with -O0, application crashed because of
invalid content of that data structure. At least fields which point to
strings were shown as empty strings in debugger.
I experimented on RHEL 6. Clang used default operation system GCC and
ld, but I also tried same GCC and ld which were used during my
application build with same result.
I also tried to add/remove compiler flags shown -n -v output and
different between -O0 and -O1 without success.
I tried Clang from 3.4 up to trunk.
May be somebody dealt with similar problems in past?
More information about the cfe-dev