wargio/r2dec-js

Linking issues

Opened this issue · 7 comments

Looks like r2dec is linking qjs dynamically, so it's using r2's qjs instead of its own implementation. This causes a crash because now in r2 we are not using bellard's qjs. We may probably not expose the qjs apis out there.. but r2dec should not be lazily resolving them either. Can you take a look at this?

qjs should be only statically linked: https://github.com/wargio/r2dec-js/blob/master/subprojects/packagefiles/libquickjs/meson.build#L84
Are you sure that is not the opposite? since pdd may have symbols of qjs, r2 is crashing trying to use its api?

the backtrace makes me think that comes from r2dec

photo_2024-10-15_10-59-26

just out of curiosity, did you try to rebuild the plugin? that trace looks weird. especially crashing with a valid pointer.

fixed here #331

r2 is abi stable theres no need to rebuild plugins because they dont break. but still yes i did rebuilds and the linkage and symbol visibility and resolution is the problem. i did a PR that fixes the problem. btw this thing was only happening on linux, macos was fine. feel free to pick the changes you like from the pr, but only the -Bsymbolic is necesary, the rest just reduce the amount of public symbols and optimize the final linkage with LTO. this stuff can be probably optional and i didnt tested this outside linux

i'm ok with the changes, just test for the compiler args.

also i was thinking to try to port r2dec to qjs-ng