aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openocd-git/fix-dynamic-linking.patch
blob: 44cec60630828545ffa16694da70960908a94c3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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,