File: 1050-writable-swap-inst-len.patch

package info (click to toggle)
nqc 3.1.r6-13
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,536 kB
  • sloc: cpp: 27,206; lex: 319; yacc: 307; makefile: 137; ansic: 36; sh: 22; xml: 18
file content (26 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (2)
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
26
Description: Make sure swan code do not segfault.
 The Swan target try to update a 'const' array at run time.  This do
 not work with modern compilers and operating systems, which make
 the 'const' data segment read only.  Remove the 'const' statement
 to make the nSwanInstructionLength array writable at run time.
Author: Petter Reinholdtsen <pere@hungry.com>
Bug-Debian: https://bugs.debian.org/848962
Forwarded: in email 2017-08-02
Reviewed-By: Petter Reinholdtsen <pere@hungry.com>
Last-Update: 2017-08-02

diff --git a/rcxlib/RCX_Disasm.cpp b/rcxlib/RCX_Disasm.cpp
index ee38608..0229e11 100644
--- a/rcxlib/RCX_Disasm.cpp
+++ b/rcxlib/RCX_Disasm.cpp
@@ -489,8 +489,8 @@ public:
 	long	fOffset;
 };
 
-// Swan support code
-const ubyte nSwanInstructionLength[256] = {
+// Swan support code.  This array is updated at runtime.
+ubyte nSwanInstructionLength[256] = {
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,