1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 19:29:53 +03:00
aports/testing/openocd-git/fix-dynamic-linking.patch
Sören Tempel a95affc10d testing/openocd-git: use packaged versions of jimtcl and libjaylink
OpenOCD vendors version 0.80 of jimtcl and version 0.2 of libjaylink
both of these are available as binary packages. As such, it makes more
sense to just use the packages instead.
2021-10-04 08:18:25 +02:00

25 lines
1.3 KiB
Diff

Without this patch, linking against libjim dynamically will cause an
infinite loop. We just fix the memory leak, for which this thingy is
supposed to be a workaround, directly in the jimtcl package instead.
See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13046#note_182639
diff -upr a/src/helper/command.c b/src/helper/command.c
--- a/src/helper/command.c 2021-10-02 11:47:43.452995606 +0200
+++ b/src/helper/command.c 2021-10-02 11:51:10.803049538 +0200
@@ -148,9 +148,14 @@ static void command_log_capture_finish(s
* If jimtcl is linked-in from a precompiled library, either static or dynamic,
* the symbol Jim_CreateCommandObj is not exported and the build will use the
* bugged API.
+ *
+ * This workaround creates an infinite loop when OpenOCD is linked
+ * dynamically against jimtcl on Alpine and thus only enabled if the internal
+ * version of jimtcl is used.
+ *
* To be removed when OpenOCD will switch to jimtcl 0.81
*/
-#if JIM_VERSION == 80 && defined __linux__
+#if JIM_VERSION == 80 && defined __linux__ && defined INTERNAL_JIMTCL
static int workaround_createcommand(Jim_Interp *interp, const char *cmdName,
Jim_CmdProc *cmdProc, void *privData, Jim_DelCmdProc *delProc);
int Jim_CreateCommandObj(Jim_Interp *interp, Jim_Obj *cmdNameObj,