Created attachment 623750 [details]
libusb-dl.h for inclusion from core.c
I got an idea: Load libusb1 by dlopen("libusb-1.0.so.0", RTLD_NOW|RTLD_LOCAL);
and bind symbols during library initialization.
I just listed all calls and made specially crafted include file.
If I include it in core.c, I can remove -lusb-1.0 (well, I have to add -ldl, so
it is theoretically possible to introduce new clashes against libdl. But it is
much less probable.
Now I have to modify the build system to make the solution upstream-able.
To make easy proof of concept, I took testlibusb.c from libusb0 test dir,
renamed print_device to libusb_open, and started with my new libusb.
Before: SIGSEGV
After: Works