tinyxml2
tinyxml2 copied to clipboard
Hang on XMLDocument destruction with PIC enabled
Not sure how helpful of a bug report I can make, but I am seeing some evidence of the following:
When building tinyxml 7.0.1 in static mode, the following code will not reach the second print statement, implying that it is hanging in the destructor. (This is on a STM32H750, and it seems GDB / remote debugging support is broken or flakey in ST's tools, so I can't really give more information / get a stack trace. I'm looking into that as well...). Allocation of a stack'd XMLDocument behaves similarly, construction works but destruction crashes.
tinyxml2::XMLDocument* config_doc = new tinyxml2::XMLDocument(); uart1_log<64>(LOG_LEVEL::INFO, "qspi", "sizeof(config_doc): %u", unsigned(sizeof(config_doc))); delete config_doc;////<---- apparent crash here uart1_log<64>(LOG_LEVEL::INFO, "qspi", "delete %u", unsigned(&config_doc));
If I go back to version 6.2.0 and use tinyxml2_static, the code works.
If I go to version 7.0.1 and manually disable PIC
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
the code seems to work.
I'm not really sure why PIC code would be a problem. Any thoughts? Things to try that could provide useful info? Maybe its just a toolchain bug on my side. I haven't tried building all my code in PIC mode, but I didn't think that would matter.