From 961403148e57dd2b01dad204561b7c6960fd4d9a Mon Sep 17 00:00:00 2001 From: Mark Mankins Date: Wed, 11 Oct 2023 12:42:11 -0400 Subject: [PATCH] Clear dlerror if magic export symbol is not found. Previously, running panda-system-i386 -panda osi_linux:help=y would output that osi failed to load because PANDA_EXPORT_SYMBOLS_osi_linux was not defined. The error message output had nothing to do with why osi_linux failed to load. In this case, osi_linux doesn't panda_require('osi') (which may be a bug) - so when it calls init_osi_api things go sideways. The error message was being obtained in init_osi_api from calling dlerror() - which was reporting the missing symbol, which isn't an error at all as the symbol is optional and not expected to be found when loading most plugins. --- panda/src/callbacks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panda/src/callbacks.c b/panda/src/callbacks.c index 902eaa074f6..787e71fe3f7 100644 --- a/panda/src/callbacks.c +++ b/panda/src/callbacks.c @@ -181,6 +181,10 @@ static void do_check_export_symbols(panda_plugin *panda_plugin, const char *file LOG_DEBUG(PANDA_MSG_FMT "Exporting symbols for plugin %s\n", PANDA_CORE_NAME, panda_plugin->name); assert(panda_plugin->plugin == dlopen(filename, RTLD_NOW | RTLD_GLOBAL)); panda_plugin->exported_symbols = true; + } else { + // Error condition is not unexpected, clear dlerror(), + // otherwise someone might call it later and be confused + dlerror(); } g_free(export_symbol);