summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2024-08-07 13:18:46 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2024-11-18 17:19:20 +0900
commit3e4807dad3008fd8afc4759f57ecdb5cf9b1ed2e (patch)
tree6e549d36aa7da32c46f83c7d4e803c51d7d6490d
parentb0416b8503e38746717a2d1167f9d1410634981e (diff)
downloadguix-3e4807dad3008fd8afc4759f57ecdb5cf9b1ed2e.tar.gz
gnu: Add e9patch. e9patch
* gnu/packages/engineering.scm (e9patch): New variable.
* gnu/packages/patches/e9patch-check-intel-format.patch: Add file.
* gnu/packages/patches/e9patch-check-mode.patch: Add file.
* gnu/packages/patches/e9patch-check-mov-imm.patch: Add file.
* gnu/packages/patches/e9patch-check-rflags.patch: Add file.
* gnu/packages/patches/e9patch-check-same_op_2.patch: Add file.
* gnu/packages/patches/e9patch-check.patch: Add file.
* gnu/packages/patches/e9patch-devendor.patch: Add file.
* gnu/packages/patches/e9patch-plugin-api-headers.patch: Add file.
* gnu/local.mk (dist_patch_DATA): Register patches.

Change-Id: I8da4e76043bf6d577e8d14a89cc7bc35caa3933f
-rw-r--r--gnu/local.mk8
-rw-r--r--gnu/packages/engineering.scm67
-rw-r--r--gnu/packages/patches/e9patch-check-intel-format.patch39
-rw-r--r--gnu/packages/patches/e9patch-check-mode.patch20
-rw-r--r--gnu/packages/patches/e9patch-check-mov-imm.patch575
-rw-r--r--gnu/packages/patches/e9patch-check-rflags.patch115
-rw-r--r--gnu/packages/patches/e9patch-check-same_op_2.patch21
-rw-r--r--gnu/packages/patches/e9patch-check.patch439
-rw-r--r--gnu/packages/patches/e9patch-devendor.patch52
-rw-r--r--gnu/packages/patches/e9patch-plugin-api-headers.patch25
10 files changed, 1361 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 60fc8c9d94..ee61a96f8e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1173,6 +1173,14 @@ dist_patch_DATA =						\
   %D%/packages/patches/dvd+rw-tools-add-include.patch 		\
   %D%/packages/patches/dwarves-threading-reproducibility.patch	\
   %D%/packages/patches/dynaconf-unvendor-deps.patch		\
+  %D%/packages/patches/e9patch-check-intel-format.patch		\
+  %D%/packages/patches/e9patch-check-mode.patch			\
+  %D%/packages/patches/e9patch-check-mov-imm.patch		\
+  %D%/packages/patches/e9patch-check-rflags.patch		\
+  %D%/packages/patches/e9patch-check-same_op_2.patch		\
+  %D%/packages/patches/e9patch-check.patch			\
+  %D%/packages/patches/e9patch-devendor.patch			\
+  %D%/packages/patches/e9patch-plugin-api-headers.patch		\
   %D%/packages/patches/efivar-211.patch			\
   %D%/packages/patches/eigen-fix-strict-aliasing-bug.patch	\
   %D%/packages/patches/einstein-build.patch			\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 3ceeb4425a..1979c0dc71 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -97,6 +97,7 @@
   #:use-module (gnu packages digest)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages elf)
   #:use-module (gnu packages file)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
@@ -167,6 +168,7 @@
   #:use-module (gnu packages toolkits)
   #:use-module (gnu packages tree-sitter)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages vim)
   #:use-module (gnu packages web)
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xdisorg)
@@ -1997,6 +1999,71 @@ and a fallback for environments without libc for Zydis.")
 @end itemize")
     (license license:expat)))
 
+(define-public e9patch
+  (let ((commit "b4e7175abb8bd49ebbb6d09c7057aa43ddacac10")
+        (revision "0"))
+    (package
+      (name "e9patch")
+      (version (git-version "1.0.0-dev" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                     (url "https://github.com/GJDuck/e9patch")
+                     (commit commit)))
+                (sha256
+                 (base32
+                  "0a9s7h43ryyl4bvn0sid0dq78v24bnbcf271smj1a8wvffsih0jy"))
+                (file-name (git-file-name name version))
+                (patches (search-patches
+                           ;; https://github.com/GJDuck/e9patch/pull/94
+                           "e9patch-devendor.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/99
+                           "e9patch-plugin-api-headers.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/92
+                           "e9patch-check.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/95
+                           "e9patch-check-intel-format.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/88
+                           "e9patch-check-mode.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/93
+                           "e9patch-check-mov-imm.patch"
+                           ;; https://github.com/GJDuck/e9patch/issues/96
+                           "e9patch-check-rflags.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/97
+                           "e9patch-check-same_op_2.patch"))))
+      (build-system gnu-build-system)
+      (arguments (list #:modules `((ice-9 string-fun) ; string-replace-substring
+                                   ,@%default-gnu-modules)
+                       #:phases
+                       #~(modify-phases %standard-phases
+                           (add-after 'unpack 'fix-prefix
+                             (lambda _
+                               (substitute* "Makefile"
+                                 ;; https://github.com/GJDuck/e9patch/pull/87
+                                 (("\\\\/usr")
+                                  (string-replace-substring #$output "/" "\\/"))
+                                 (("/usr") #$output))))
+                           (delete 'configure))))
+      (native-inputs (list markdown xxd))
+      (inputs (list elfutils zycore zydis zlib))
+      (home-page "https://github.com/GJDuck/e9patch")
+      (synopsis "Static binary rewriting tool")
+      (description
+       "E9Patch is a static binary rewriting tool for x86-64 ELF binaries.
+E9Patch is:
+@itemize
+@item Scalable: E9Patch can reliably rewrite large/complex binaries
+      including web browsers (>100MB in size).
+@item Compatible: The rewritten binary is a drop-in replacement of the original,
+      with no additional dependencies.
+@item Fast: E9Patch can rewrite most binaries in a few seconds.
+@item Low Overheads: Both performance and memory.
+@item Programmable: E9Patch is designed so that it can be easily integrated
+      into other projects.
+@end itemize")
+      (license (list license:expat ;src/e9patch/e9loader_*.cpp
+                     license:gpl3+))))) ;rest
+
 (define-public asco
   (package
     (name "asco")
diff --git a/gnu/packages/patches/e9patch-check-intel-format.patch b/gnu/packages/patches/e9patch-check-intel-format.patch
new file mode 100644
index 0000000000..4f89d0a562
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check-intel-format.patch
@@ -0,0 +1,39 @@
+From 0aac3e4afbdb095b1aad3823698ce2e0a96fc1ee Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= <cnx@loang.net>
+Date: Mon, 18 Nov 2024 15:07:41 +0900
+Subject: [PATCH] Specify qword ptr in Intel test output
+
+---
+ test/regtest/print_intel.exp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/test/regtest/print_intel.exp b/test/regtest/print_intel.exp
+index ae91f44..9bdbe0f 100644
+--- a/test/regtest/print_intel.exp
++++ b/test/regtest/print_intel.exp
+@@ -24,14 +24,14 @@ jmp 0xa000163
+ call 0xa000168
+ jmp 0xa00016d
+ jmp 0xa000177
+-lea r10, [rip+0x14]
++lea r10, qword ptr [rip+0x14]
+ push r10
+ push r11
+ mov rcx, 0xffffffffffff8889
+ jmp qword ptr [rsp+rcx*1+0x777f]
+ call 0xa0001b5
+ add rsp, 0x8
+-lea rdx, [rip+0x2]
++lea rdx, qword ptr [rip+0x2]
+ call rdx
+ pop r14
+ add r9, 0x6
+@@ -85,7 +85,7 @@ xor eax, eax
+ inc eax
+ mov edi, eax
+ inc rdi
+-lea rsi, [rip+0x54]
++lea rsi, qword ptr [rip+0x54]
+ mov rdx, 0x7
+ syscall
+ PASSED
diff --git a/gnu/packages/patches/e9patch-check-mode.patch b/gnu/packages/patches/e9patch-check-mode.patch
new file mode 100644
index 0000000000..ccbead2671
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check-mode.patch
@@ -0,0 +1,20 @@
+From fdfec33e129efc6c08a0c532c309605c9bb09269 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= <cnx@loang.net>
+Date: Wed, 13 Nov 2024 19:55:35 +0900
+Subject: [PATCH] Set expected file mode in test to 644
+
+For real files, git only distinguish between executable or not,
+and the mode of a checked-out file is either 644 or 755.
+---
+ test/regtest/stat.exp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/regtest/stat.exp b/test/regtest/stat.exp
+index 9509b9a..8b78453 100644
+--- a/test/regtest/stat.exp
++++ b/test/regtest/stat.exp
+@@ -1,3 +1,3 @@
+-mode = 100664
++mode = 100644
+ size = 62
+ PASSED
diff --git a/gnu/packages/patches/e9patch-check-mov-imm.patch b/gnu/packages/patches/e9patch-check-mov-imm.patch
new file mode 100644
index 0000000000..697aa0f865
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check-mov-imm.patch
@@ -0,0 +1,575 @@
+From 149018a871547d9ae24a1e00d0ce6e13a2c0f306 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= <cnx@loang.net>
+Date: Mon, 18 Nov 2024 14:46:59 +0900
+Subject: [PATCH] Fix mov's immediates' sign in test expectation
+
+Automatic signedness in Zydis infers from the instruction.
+In this case, the immediate should be signed.
+
+References: https://github.com/zyantific/zydis/discussions/538
+---
+ test/regtest/after.exp            | 2 +-
+ test/regtest/after_print.exp      | 2 +-
+ test/regtest/bb_info.exp          | 2 +-
+ test/regtest/bit_or.exp           | 2 +-
+ test/regtest/callx2.exp           | 2 +-
+ test/regtest/cond_0.exp           | 2 +-
+ test/regtest/cond_1.exp           | 2 +-
+ test/regtest/condjump_0.exp       | 2 +-
+ test/regtest/dst_zero.exp         | 2 +-
+ test/regtest/example_13.exp       | 2 +-
+ test/regtest/example_4.exp        | 2 +-
+ test/regtest/example_5.exp        | 2 +-
+ test/regtest/example_7.exp        | 2 +-
+ test/regtest/f_info.exp           | 2 +-
+ test/regtest/multi.exp            | 2 +-
+ test/regtest/naked.exp            | 2 +-
+ test/regtest/naked_2.exp          | 2 +-
+ test/regtest/next.exp             | 2 +-
+ test/regtest/not_regex.exp        | 1 -
+ test/regtest/optimize_0.exp       | 2 +-
+ test/regtest/optimize_1.exp       | 2 +-
+ test/regtest/optimize_2.exp       | 2 +-
+ test/regtest/optimize_3.exp       | 2 +-
+ test/regtest/optimize_s.exp       | 2 +-
+ test/regtest/print.exp            | 2 +-
+ test/regtest/print_pie.exp        | 2 +-
+ test/regtest/printx2.exp          | 4 ++--
+ test/regtest/reads_leq_writes.exp | 2 +-
+ test/regtest/regs_2.exp           | 2 +-
+ test/regtest/replace_print.exp    | 2 +-
+ test/regtest/rex.exp              | 2 +-
+ test/regtest/rip_rsp_rflags.exp   | 2 +-
+ test/regtest/rip_to_rsp.exp       | 2 +-
+ test/regtest/rotate.exp           | 2 +-
+ test/regtest/skip.exp             | 2 +-
+ test/regtest/src_dst.exp          | 2 +-
+ test/regtest/static.exp           | 2 +-
+ test/regtest/sum.exp              | 2 +-
+ test/regtest/trunc32.exp          | 2 +-
+ test/regtest/types.exp            | 2 +-
+ test/regtest/zero_flags.exp       | 2 +-
+ test/regtest/zero_flags_2.exp     | 2 +-
+ 42 files changed, 42 insertions(+), 43 deletions(-)
+
+diff --git a/test/regtest/after.exp b/test/regtest/after.exp
+index 9c64090..5b3b067 100644
+--- a/test/regtest/after.exp
++++ b/test/regtest/after.exp
+@@ -2,7 +2,7 @@
+ 000000000a000108:000000000c007ff8:0000000000004600: 41 57                   push %r15
+ 000000000a00010a:000000000c007ff8:0000000000004600: 78 fc                   js 0xa000106
+ 000000000a000111:000000000c007ff8:0000000000004600: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a00011b:000000000c007ff8:0000000000004600: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a00011b:000000000c007ff8:0000000000004600: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011e:000000000c007ff8:0000000000004600: 48 39 c3                cmp %rax, %rbx
+ 000000000a000124:000000000c007ff8:0000000000004600: 66 90                   nop
+diff --git a/test/regtest/after_print.exp b/test/regtest/after_print.exp
+index a7b8ea9..6479ba7 100644
+--- a/test/regtest/after_print.exp
++++ b/test/regtest/after_print.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ nop
+ nopl %eax, (%rax)
+diff --git a/test/regtest/bb_info.exp b/test/regtest/bb_info.exp
+index f289f60..b5bc3e3 100644
+--- a/test/regtest/bb_info.exp
++++ b/test/regtest/bb_info.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:0000000000000002:0000000000000004: 41 57                   push %r15
+ 000000000a000106:0000000000000002:0000000000000004: 78 fc                   js 0xa000106
+ 000000000a00010a:0000000000000004:0000000000000016: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a00010a:0000000000000004:0000000000000016: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a00010a:0000000000000004:0000000000000016: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00010a:0000000000000004:0000000000000016: 48 39 c3                cmp %rax, %rbx
+ 000000000a00010a:0000000000000004:0000000000000016: 74 02                   jz 0xa000122
+diff --git a/test/regtest/bit_or.exp b/test/regtest/bit_or.exp
+index 33cca3e..f44dd09 100644
+--- a/test/regtest/bit_or.exp
++++ b/test/regtest/bit_or.exp
+@@ -1,6 +1,6 @@
+ rex=0x41, asm="push %r15"
+ rex=0x48, asm="movq 0x5e(%rip), %rax"
+-rex=0x48, asm="mov $0x8877665544332211, %rbx"
++rex=0x48, asm="mov $-0x778899aabbccddef, %rbx"
+ rex=0x48, asm="cmp %rax, %rbx"
+ rex=0x4C, asm="movq 0x28(%rip), %r8"
+ rex=0x48, asm="movq 0x19a(%rip), %rcx"
+diff --git a/test/regtest/callx2.exp b/test/regtest/callx2.exp
+index 3786bc3..7afc2c8 100644
+--- a/test/regtest/callx2.exp
++++ b/test/regtest/callx2.exp
+@@ -1,6 +1,6 @@
+ movq 0x5e(%rip), %rax
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ nopl %eax, (%rax)
+ movq 0x28(%rip), %r8
+diff --git a/test/regtest/cond_0.exp b/test/regtest/cond_0.exp
+index e52e9cf..d2f3e9a 100644
+--- a/test/regtest/cond_0.exp
++++ b/test/regtest/cond_0.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/cond_1.exp b/test/regtest/cond_1.exp
+index 3a3c426..c24fa2f 100644
+--- a/test/regtest/cond_1.exp
++++ b/test/regtest/cond_1.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ ud2
+diff --git a/test/regtest/condjump_0.exp b/test/regtest/condjump_0.exp
+index e52e9cf..d2f3e9a 100644
+--- a/test/regtest/condjump_0.exp
++++ b/test/regtest/condjump_0.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/dst_zero.exp b/test/regtest/dst_zero.exp
+index 50ca033..61ba3b6 100644
+--- a/test/regtest/dst_zero.exp
++++ b/test/regtest/dst_zero.exp
+@@ -1,3 +1,3 @@
+ movq 0x5e(%rip), %rax # DST 8877665544332211 --> 0x0
+-mov $0x8877665544332211, %rbx # DST 8877665544332211 --> 0x0
++mov $-0x778899aabbccddef, %rbx # DST 8877665544332211 --> 0x0
+ Illegal instruction
+diff --git a/test/regtest/example_13.exp b/test/regtest/example_13.exp
+index d56e101..baff0bf 100644
+--- a/test/regtest/example_13.exp
++++ b/test/regtest/example_13.exp
+@@ -1,6 +1,6 @@
+ 000000000a000106:00000000e9e9e9e9:0000000000000000: 41 57                   push %r15
+ 000000000a00010a:8877665544332211:000000000b0b0b0b: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:8877665544332211:000000003e3e3e3e: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:8877665544332211:000000003e3e3e3e: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a000122:0000000000000000:0000000000000000: 66 90                   nop
+ 000000000a000128:0000000044332211:0000000000000000: 0f 1f 00                nopl %eax, (%rax)
+diff --git a/test/regtest/example_4.exp b/test/regtest/example_4.exp
+index 99b058f..7dbc25c 100644
+--- a/test/regtest/example_4.exp
++++ b/test/regtest/example_4.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000a000106:0000000000000002: 41 57                   push %r15
+ 000000000a000108:000000000a000108:0000000000000002: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000a00010a:0000000000000007: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000a000111:000000000000000a: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000a000111:000000000000000a: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000a00011b:0000000000000003: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000a00011e:0000000000000002: 74 02                   jz 0xa000122
+diff --git a/test/regtest/example_5.exp b/test/regtest/example_5.exp
+index b5b6bf3..67b0168 100644
+--- a/test/regtest/example_5.exp
++++ b/test/regtest/example_5.exp
+@@ -1,5 +1,5 @@
+ 0000000094949494:00000000c7c7c7c7:00000000b6b6b6b6: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-0000000094949494:00000000c7c7c7c7:00000000b6b6b6b6: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++0000000094949494:00000000c7c7c7c7:00000000b6b6b6b6: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 0000000094949494:00000000c7c7c7c7:00000000b6b6b6b6: 48 39 c3                cmp %rax, %rbx
+ 0000000094949494:00000000c7c7c7c7:00000000b6b6b6b6: 0f 1f 00                nopl %eax, (%rax)
+diff --git a/test/regtest/example_7.exp b/test/regtest/example_7.exp
+index fe807b4..0e38761 100644
+--- a/test/regtest/example_7.exp
++++ b/test/regtest/example_7.exp
+@@ -1,3 +1,3 @@
+-000000000a000111:8877665544332211:8877665544332211: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:8877665544332211:8877665544332211: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ PASSED
+diff --git a/test/regtest/f_info.exp b/test/regtest/f_info.exp
+index 569da6c..2c18b98 100644
+--- a/test/regtest/f_info.exp
++++ b/test/regtest/f_info.exp
+@@ -2,7 +2,7 @@
+ 0000000000000000:0000000000000000:0000000000000000: 41 57                   push %r15
+ 0000000000000000:0000000000000000:0000000000000000: 78 fc                   js 0xa000106
+ 0000000000000000:0000000000000000:0000000000000000: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-0000000000000000:0000000000000000:0000000000000000: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++0000000000000000:0000000000000000:0000000000000000: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 0000000000000000:0000000000000000:0000000000000000: 48 39 c3                cmp %rax, %rbx
+ 0000000000000000:0000000000000000:0000000000000000: 74 02                   jz 0xa000122
+diff --git a/test/regtest/multi.exp b/test/regtest/multi.exp
+index ac6c007..8bf6a2d 100644
+--- a/test/regtest/multi.exp
++++ b/test/regtest/multi.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae:
+ push %r15: 
+ js 0xa000106: 
+ movq 0x5e(%rip), %rax: rax 
+-mov $0x8877665544332211, %rbx: rbx 
++mov $-0x778899aabbccddef, %rbx: rbx 
+ cmp %rax, %rbx: rax rbx 
+ jz 0xa000122: 
+ nop: 
+diff --git a/test/regtest/naked.exp b/test/regtest/naked.exp
+index e52e9cf..d2f3e9a 100644
+--- a/test/regtest/naked.exp
++++ b/test/regtest/naked.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/naked_2.exp b/test/regtest/naked_2.exp
+index e52e9cf..d2f3e9a 100644
+--- a/test/regtest/naked_2.exp
++++ b/test/regtest/naked_2.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/next.exp b/test/regtest/next.exp
+index b33cd1a..6939b53 100644
+--- a/test/regtest/next.exp
++++ b/test/regtest/next.exp
+@@ -2,7 +2,7 @@
+ 0xa000106: push %r15 # goto 0xa000108
+ 0xa000108: js 0xa000106 # goto 0xa00010a
+ 0xa00010a: movq 0x5e(%rip), %rax # goto 0xa000111
+-0xa000111: mov $0x8877665544332211, %rbx # goto 0xa00011b
++0xa000111: mov $-0x778899aabbccddef, %rbx # goto 0xa00011b
+ 0xa00011b: cmp %rax, %rbx # goto 0xa00011e
+ 0xa00011e: jz 0xa000122 # goto 0xa000122
+ 0xa000122: nop # goto 0xa000124
+diff --git a/test/regtest/not_regex.exp b/test/regtest/not_regex.exp
+index c4f4004..2f62ac6 100644
+--- a/test/regtest/not_regex.exp
++++ b/test/regtest/not_regex.exp
+@@ -1,5 +1,4 @@
+ push %r15
+-mov $0x8877665544332211, %rbx
+ nop
+ cmp $0x33, %ebx
+ movq 0x28(%rip), %r8
+diff --git a/test/regtest/optimize_0.exp b/test/regtest/optimize_0.exp
+index 1499dc9..ebb0d13 100644
+--- a/test/regtest/optimize_0.exp
++++ b/test/regtest/optimize_0.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000000006f:ffffffffc7c7c7c7: 41 57                   push %r15
+ 000000000a000108:000000000000006e:ffffffffc7c7c7c7: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000000006d:ffffffffc7c7c7c7: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000000006b:ffffffffc7c7c7c7: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000000006a:ffffffffc7c7c7c7: 74 02                   jz 0xa000122
+diff --git a/test/regtest/optimize_1.exp b/test/regtest/optimize_1.exp
+index 1499dc9..ebb0d13 100644
+--- a/test/regtest/optimize_1.exp
++++ b/test/regtest/optimize_1.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000000006f:ffffffffc7c7c7c7: 41 57                   push %r15
+ 000000000a000108:000000000000006e:ffffffffc7c7c7c7: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000000006d:ffffffffc7c7c7c7: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000000006b:ffffffffc7c7c7c7: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000000006a:ffffffffc7c7c7c7: 74 02                   jz 0xa000122
+diff --git a/test/regtest/optimize_2.exp b/test/regtest/optimize_2.exp
+index 1499dc9..ebb0d13 100644
+--- a/test/regtest/optimize_2.exp
++++ b/test/regtest/optimize_2.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000000006f:ffffffffc7c7c7c7: 41 57                   push %r15
+ 000000000a000108:000000000000006e:ffffffffc7c7c7c7: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000000006d:ffffffffc7c7c7c7: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000000006b:ffffffffc7c7c7c7: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000000006a:ffffffffc7c7c7c7: 74 02                   jz 0xa000122
+diff --git a/test/regtest/optimize_3.exp b/test/regtest/optimize_3.exp
+index 1499dc9..ebb0d13 100644
+--- a/test/regtest/optimize_3.exp
++++ b/test/regtest/optimize_3.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000000006f:ffffffffc7c7c7c7: 41 57                   push %r15
+ 000000000a000108:000000000000006e:ffffffffc7c7c7c7: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000000006d:ffffffffc7c7c7c7: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000000006b:ffffffffc7c7c7c7: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000000006a:ffffffffc7c7c7c7: 74 02                   jz 0xa000122
+diff --git a/test/regtest/optimize_s.exp b/test/regtest/optimize_s.exp
+index 1499dc9..ebb0d13 100644
+--- a/test/regtest/optimize_s.exp
++++ b/test/regtest/optimize_s.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000000006f:ffffffffc7c7c7c7: 41 57                   push %r15
+ 000000000a000108:000000000000006e:ffffffffc7c7c7c7: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000000006d:ffffffffc7c7c7c7: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000000006c:ffffffffc7c7c7c7: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000000006b:ffffffffc7c7c7c7: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000000006a:ffffffffc7c7c7c7: 74 02                   jz 0xa000122
+diff --git a/test/regtest/print.exp b/test/regtest/print.exp
+index e52e9cf..d2f3e9a 100644
+--- a/test/regtest/print.exp
++++ b/test/regtest/print.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/print_pie.exp b/test/regtest/print_pie.exp
+index 42cb1b6..5cc8690 100644
+--- a/test/regtest/print_pie.exp
++++ b/test/regtest/print_pie.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/printx2.exp b/test/regtest/printx2.exp
+index 850e733..b80a83d 100644
+--- a/test/regtest/printx2.exp
++++ b/test/regtest/printx2.exp
+@@ -6,8 +6,8 @@ js 0xa000106
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+diff --git a/test/regtest/reads_leq_writes.exp b/test/regtest/reads_leq_writes.exp
+index 1bd6844..e1df687 100644
+--- a/test/regtest/reads_leq_writes.exp
++++ b/test/regtest/reads_leq_writes.exp
+@@ -1,5 +1,5 @@
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ nop
+ cmp $0x33, %ebx
+diff --git a/test/regtest/regs_2.exp b/test/regtest/regs_2.exp
+index 3605b69..141fcef 100644
+--- a/test/regtest/regs_2.exp
++++ b/test/regtest/regs_2.exp
+@@ -1,5 +1,5 @@
+ 000000000b0b0b0b:000000003e3e3e3e:000000002d2d2d2d: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-8877665544332211:000000003e3e3e3e:000000002d2d2d2d: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++8877665544332211:000000003e3e3e3e:000000002d2d2d2d: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 8877665544332211:8877665544332211:000000002d2d2d2d: 48 39 c3                cmp %rax, %rbx
+ 8877665544332211:8877665544332211:000000002d2d2d2d: 48 8b 0d 9a 01 00 00    movq 0x19a(%rip), %rcx
+diff --git a/test/regtest/replace_print.exp b/test/regtest/replace_print.exp
+index 3a3c426..c24fa2f 100644
+--- a/test/regtest/replace_print.exp
++++ b/test/regtest/replace_print.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ ud2
+diff --git a/test/regtest/rex.exp b/test/regtest/rex.exp
+index 5510819..718d536 100644
+--- a/test/regtest/rex.exp
++++ b/test/regtest/rex.exp
+@@ -1,5 +1,5 @@
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ movq 0x19a(%rip), %rcx
+ mov $-0x7777, %rcx
+diff --git a/test/regtest/rip_rsp_rflags.exp b/test/regtest/rip_rsp_rflags.exp
+index 9bd7d19..4de9577 100644
+--- a/test/regtest/rip_rsp_rflags.exp
++++ b/test/regtest/rip_rsp_rflags.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000c008000:0000000000004600: 41 57                   push %r15
+ 000000000a000108:000000000c007ff8:0000000000004600: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000c007ff8:0000000000004600: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000c007ff8:0000000000004600: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000c007ff8:0000000000004600: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000c007ff8:0000000000004600: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000c007ff8:0000000000004600: 74 02                   jz 0xa000122
+diff --git a/test/regtest/rip_to_rsp.exp b/test/regtest/rip_to_rsp.exp
+index b01e804..64e0033 100644
+--- a/test/regtest/rip_to_rsp.exp
++++ b/test/regtest/rip_to_rsp.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae
+ push %r15
+ js 0xa000106
+ movq 0x5e(%rip), %rax
+-mov $0x8877665544332211, %rbx
++mov $-0x778899aabbccddef, %rbx
+ cmp %rax, %rbx
+ jz 0xa000122
+ nop
+diff --git a/test/regtest/rotate.exp b/test/regtest/rotate.exp
+index 33ed619..6f55454 100644
+--- a/test/regtest/rotate.exp
++++ b/test/regtest/rotate.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae [000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E
+ push %r15 [000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:000000004F4F4F4F:0000000050505050:0000000061616161:0000000072727272:0000000083838383:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:]
+ js 0xa000106 [000000001C1C1C1C:000000003E3E3E3E:000000004F4F4F4F:0000000050505050:0000000061616161:0000000072727272:0000000083838383:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:]
+ movq 0x5e(%rip), %rax [000000003E3E3E3E:000000004F4F4F4F:0000000050505050:0000000061616161:0000000072727272:0000000083838383:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:]
+-mov $0x8877665544332211, %rbx [8877665544332211:0000000050505050:0000000061616161:0000000072727272:0000000083838383:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:]
++mov $-0x778899aabbccddef, %rbx [8877665544332211:0000000050505050:0000000061616161:0000000072727272:0000000083838383:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:]
+ cmp %rax, %rbx [0000000050505050:0000000061616161:0000000072727272:8877665544332211:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:8877665544332211:]
+ jz 0xa000122 [0000000061616161:0000000072727272:8877665544332211:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:8877665544332211:0000000050505050:]
+ ud2 [0000000072727272:8877665544332211:0000000094949494:00000000A5A5A5A5:00000000B6B6B6B6:00000000C7C7C7C7:00000000D8D8D8D8:00000000E9E9E9E9:000000000B0B0B0B:000000002D2D2D2D:000000001C1C1C1C:000000003E3E3E3E:8877665544332211:0000000050505050:0000000061616161:]
+diff --git a/test/regtest/skip.exp b/test/regtest/skip.exp
+index e792d93..02eaff7 100644
+--- a/test/regtest/skip.exp
++++ b/test/regtest/skip.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae # %rax=0x000000000b0b0b0b %rbx=0x000000003e3e3e3e
+ push %r15 # %rax=0x000000000b0b0b0b %rbx=0x000000003e3e3e3e
+ js 0xa000106 # %rax=0x000000000b0b0b0b %rbx=0x000000003e3e3e3e
+ movq 0x5e(%rip), %rax # %rax=0x000000000b0b0b0b %rbx=0x000000003e3e3e3e
+-mov $0x8877665544332211, %rbx # %rax=0x8877665544332211 %rbx=0x000000003e3e3e3e
++mov $-0x778899aabbccddef, %rbx # %rax=0x8877665544332211 %rbx=0x000000003e3e3e3e
+ cmp %rax, %rbx # %rax=0x8877665544332211 %rbx=0x8877665544332211
+ ud2 # %rax=0x8877665544332212 %rbx=0x8877665544332211
+ Illegal instruction
+diff --git a/test/regtest/src_dst.exp b/test/regtest/src_dst.exp
+index b0df8e5..a00d06a 100644
+--- a/test/regtest/src_dst.exp
++++ b/test/regtest/src_dst.exp
+@@ -1,5 +1,5 @@
+ 000000000a00010a:8877665544332211:000000000b0b0b0b: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:8877665544332211:000000003e3e3e3e: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:8877665544332211:000000003e3e3e3e: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a000140:8877665544332211:0000000072727272: 4c 8b 05 28 00 00 00    movq 0x28(%rip), %r8
+ 000000000a000147:00ffeeddccbbaa99:000000002d2d2d2d: 48 8b 0d 9a 01 00 00    movq 0x19a(%rip), %rcx
+diff --git a/test/regtest/static.exp b/test/regtest/static.exp
+index e07368d..dc47fe9 100644
+--- a/test/regtest/static.exp
++++ b/test/regtest/static.exp
+@@ -2,7 +2,7 @@
+ 000000000a000106:000000000a000106:0000000000000000: 41 57                   push %r15
+ 000000000a000108:000000000a000108:0000000000000000: 78 fc                   js 0xa000106
+ 000000000a00010a:000000000a00010a:0000000000000000: 48 8b 05 5e 00 00 00    movq 0x5e(%rip), %rax
+-000000000a000111:000000000a000111:0000000000000000: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++000000000a000111:000000000a000111:0000000000000000: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 000000000a00011b:000000000a00011b:0000000000000000: 48 39 c3                cmp %rax, %rbx
+ 000000000a00011e:000000000a00011e:0000000000000000: 74 02                   jz 0xa000122
+diff --git a/test/regtest/sum.exp b/test/regtest/sum.exp
+index 0e2e061..e8a07c7 100644
+--- a/test/regtest/sum.exp
++++ b/test/regtest/sum.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae # 185273099
+ push %r15 # 370546198
+ js 0xa000106 # 555819297
+ movq 0x5e(%rip), %rax # 741092396
+-mov $0x8877665544332211, %rbx # -8613303245179236803
++mov $-0x778899aabbccddef, %rbx # -8613303245179236803
+ cmp %rax, %rbx # 1220137582609985614
+ jz 0xa000122 # -7393165663310343585
+ nop # 2440275164478878832
+diff --git a/test/regtest/trunc32.exp b/test/regtest/trunc32.exp
+index 0b914fe..0832ba3 100644
+--- a/test/regtest/trunc32.exp
++++ b/test/regtest/trunc32.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae [0B0B0B0B:2D2D2D2D:1C1C1C1C:3E3E3E3E:4F4F4F4F:50505050:61616161:72
+ push %r15 [0B0B0B0B:2D2D2D2D:1C1C1C1C:3E3E3E3E:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+ js 0xa000106 [0B0B0B0B:2D2D2D2D:1C1C1C1C:3E3E3E3E:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+ movq 0x5e(%rip), %rax [44332211:2D2D2D2D:1C1C1C1C:3E3E3E3E:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+-mov $0x8877665544332211, %rbx [44332211:2D2D2D2D:1C1C1C1C:44332211:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
++mov $-0x778899aabbccddef, %rbx [44332211:2D2D2D2D:1C1C1C1C:44332211:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+ cmp %rax, %rbx [44332211:2D2D2D2D:1C1C1C1C:44332211:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+ nop [44332211:2D2D2D2D:1C1C1C1C:44332211:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+ nopl %eax, (%rax) [44332211:2D2D2D2D:1C1C1C1C:44332211:4F4F4F4F:50505050:61616161:72727272:83838383:94949494:A5A5A5A5:B6B6B6B6:C7C7C7C7:D8D8D8D8:E9E9E9E9:]
+diff --git a/test/regtest/types.exp b/test/regtest/types.exp
+index baa55e1..6d75a84 100644
+--- a/test/regtest/types.exp
++++ b/test/regtest/types.exp
+@@ -1,4 +1,4 @@
+-0000000000000016:000000000a000111:000000000a000111: 48 bb 11 22 33 44 55 66 mov $0x8877665544332211, %rbx
++0000000000000016:000000000a000111:000000000a000111: 48 bb 11 22 33 44 55 66 mov $-0x778899aabbccddef, %rbx
+                                                     77 88 
+ 0000000000000015:000000000a000133:000000000a000133: 83 fb 33                cmp $0x33, %ebx
+ 0000000000000014:000000000a000182:000000000a000182: 48 c7 c1 89 88 ff ff    mov $-0x7777, %rcx
+diff --git a/test/regtest/zero_flags.exp b/test/regtest/zero_flags.exp
+index 6ea2c37..ac678cc 100644
+--- a/test/regtest/zero_flags.exp
++++ b/test/regtest/zero_flags.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae	# ZERO FLAGS -Z-P-
+ push %r15	# ZERO FLAGS -----
+ js 0xa000106	# ZERO FLAGS -----
+ movq 0x5e(%rip), %rax	# ZERO FLAGS -----
+-mov $0x8877665544332211, %rbx	# ZERO FLAGS -----
++mov $-0x778899aabbccddef, %rbx	# ZERO FLAGS -----
+ cmp %rax, %rbx	# ZERO FLAGS -Z-P-
+ jz 0xa000122	# ZERO FLAGS -----
+ Illegal instruction
+diff --git a/test/regtest/zero_flags_2.exp b/test/regtest/zero_flags_2.exp
+index 6ea2c37..ac678cc 100644
+--- a/test/regtest/zero_flags_2.exp
++++ b/test/regtest/zero_flags_2.exp
+@@ -2,7 +2,7 @@ jnz 0xa0002ae	# ZERO FLAGS -Z-P-
+ push %r15	# ZERO FLAGS -----
+ js 0xa000106	# ZERO FLAGS -----
+ movq 0x5e(%rip), %rax	# ZERO FLAGS -----
+-mov $0x8877665544332211, %rbx	# ZERO FLAGS -----
++mov $-0x778899aabbccddef, %rbx	# ZERO FLAGS -----
+ cmp %rax, %rbx	# ZERO FLAGS -Z-P-
+ jz 0xa000122	# ZERO FLAGS -----
+ Illegal instruction
diff --git a/gnu/packages/patches/e9patch-check-rflags.patch b/gnu/packages/patches/e9patch-check-rflags.patch
new file mode 100644
index 0000000000..2c6977e827
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check-rflags.patch
@@ -0,0 +1,115 @@
+diff --git a/test/regtest/after.exp b/test/regtest/after.exp
+index 9c6409090159..68a393d66ef1 100644
+--- a/test/regtest/after.exp
++++ b/test/regtest/after.exp
+@@ -25,22 +25,22 @@
+ 000000000a0001cb:000000000c007fe0:0000000000000600: 4d 01 ca                add %r9, %r10
+ 000000000a0001cf:000000000c007fe0:ffffffffffff9600: 49 83 e8 08             sub $0x8, %r8
+ 000000000a0001d2:000000000c007fe0:0000000000000700: 4d 29 c2                sub %r8, %r10
+-000000000a0001d5:000000000c007fe0:0000000000000301: 49 f7 ea                imul %r10
+-000000000a0001d9:000000000c007fe0:ffffffffffff8701: 4d 0f af d3             imul %r11, %r10
+-000000000a0001dd:000000000c007fe0:0000000000000200: 4d 6b d3 77             imul $0x77, %r11, %r10
++000000000a0001d5:000000000c007fe0:0000000000000701: 49 f7 ea                imul %r10
++000000000a0001d9:000000000c007fe0:0000000000000701: 4d 0f af d3             imul %r11, %r10
++000000000a0001dd:000000000c007fe0:0000000000000600: 4d 6b d3 77             imul $0x77, %r11, %r10
+ 000000000a0001e3:000000000c007fe0:0000000000000200: 48 25 fe 00 00 00       and $0xfe, %rax
+ 000000000a0001e6:000000000c007fe0:0000000000000200: 48 21 c3                and %rax, %rbx
+ 000000000a0001ea:000000000c007fe0:0000000000000200: 48 83 cb 13             or $0x13, %rbx
+ 000000000a0001ed:000000000c007fe0:ffffffffffff8200: 48 09 cb                or %rcx, %rbx
+ 000000000a0001f0:000000000c007fe0:ffffffffffff8200: 48 f7 d1                not %rcx
+ 000000000a0001f3:000000000c007fe0:ffffffffffff9300: 48 f7 d9                neg %rcx
+-000000000a0001f7:000000000c007fe0:0000000000000200: 48 c1 e7 07             shl $0x7, %rdi
+-000000000a0001fb:000000000c007fe0:0000000000000200: 48 c1 ff 03             sar $0x3, %rdi
+-000000000a0001fd:000000000c007fd8:0000000000000200: 41 55                   push %r13
+-000000000a000204:000000000c007fd8:0000000000000200: 48 c7 c0 19 45 00 00    mov $0x4519, %rax
+-000000000a000208:000000000c007fd8:0000000000000200: 66 0f ef c0             pxor %xmm0, %xmm0
+-000000000a00020d:000000000c007fd8:0000000000000200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
+-000000000a000211:000000000c007fd8:0000000000000200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
++000000000a0001f7:000000000c007fe0:0000000000001200: 48 c1 e7 07             shl $0x7, %rdi
++000000000a0001fb:000000000c007fe0:0000000000001200: 48 c1 ff 03             sar $0x3, %rdi
++000000000a0001fd:000000000c007fd8:0000000000001200: 41 55                   push %r13
++000000000a000204:000000000c007fd8:0000000000001200: 48 c7 c0 19 45 00 00    mov $0x4519, %rax
++000000000a000208:000000000c007fd8:0000000000001200: 66 0f ef c0             pxor %xmm0, %xmm0
++000000000a00020d:000000000c007fd8:0000000000001200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
++000000000a000211:000000000c007fd8:0000000000001200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
+ 000000000a000214:000000000c007fd8:0000000000000300: 0f 2f c8                comiss %xmm0, %xmm1
+ 000000000a000216:000000000c007fd8:0000000000000300: 74 e5                   jz 0xa0001fb
+ 000000000a00021b:000000000c007fd8:0000000000000300: f3 48 0f 2c c1          cvttss2si %xmm1, %rax
+diff --git a/test/regtest/example_12.exp b/test/regtest/example_12.exp
+index 1260881659dc..161a195bcd21 100644
+--- a/test/regtest/example_12.exp
++++ b/test/regtest/example_12.exp
+@@ -7,16 +7,16 @@
+ 0000000000000600:0000000000000008:8877665544332211: 49 83 e8 08             sub $0x8, %r8
+ ffffffffffff9600:8877665544332209:000000008d83851b: 4d 29 c2                sub %r8, %r10
+ 0000000000000700:778899ab49506312:0000000000000000: 49 f7 ea                imul %r10
+-0000000000000301:00000000a5a5a5a5:778899ab49506312: 4d 0f af d3             imul %r11, %r10
+-ffffffffffff8701:0000000000000077:00000000a5a5a5a5: 4d 6b d3 77             imul $0x77, %r11, %r10
+-0000000000000200:00000000000000fe:2d9bfa6b1014f832: 48 25 fe 00 00 00       and $0xfe, %rax
++0000000000000701:00000000a5a5a5a5:778899ab49506312: 4d 0f af d3             imul %r11, %r10
++0000000000000701:0000000000000077:00000000a5a5a5a5: 4d 6b d3 77             imul $0x77, %r11, %r10
++0000000000000600:00000000000000fe:2d9bfa6b1014f832: 48 25 fe 00 00 00       and $0xfe, %rax
+ 0000000000000200:0000000000000032:8877665544332211: 48 21 c3                and %rax, %rbx
+ 0000000000000200:0000000000000013:0000000000000010: 48 83 cb 13             or $0x13, %rbx
+ 0000000000000200:ffffffffffff8889:0000000000000013: 48 09 cb                or %rcx, %rbx
+ ffffffffffff8200:0000000000007776:0000000000000000: 48 f7 d9                neg %rcx
+ ffffffffffff9300:0000000000000007:0000000061616161: 48 c1 e7 07             shl $0x7, %rdi
+-0000000000000200:0000000000000003:00000030b0b0b080: 48 c1 ff 03             sar $0x3, %rdi
+-0000000000000200:0000000000000000:0000000000000000: 0f 2f c8                comiss %xmm0, %xmm1
++0000000000001200:0000000000000003:00000030b0b0b080: 48 c1 ff 03             sar $0x3, %rdi
++0000000000001200:0000000000000000:0000000000000000: 0f 2f c8                comiss %xmm0, %xmm1
+ 0000000000000300:0000000000000085:0000000000000085: 48 3d 85 00 00 00       cmp $0x85, %rax
+ 0000000000004600:0000000000000000:0000000000000000: 48 85 c0                test %rax, %rax
+ 0000000000004600:0000000050505050:0000000050505050: 31 f6                   xor %esi, %esi
+diff --git a/test/regtest/rip_rsp_rflags.exp b/test/regtest/rip_rsp_rflags.exp
+index 9bd7d19e6c9c..4f7ddc935ae6 100644
+--- a/test/regtest/rip_rsp_rflags.exp
++++ b/test/regtest/rip_rsp_rflags.exp
+@@ -40,22 +40,22 @@
+ 000000000a0001cb:000000000c007fe0:0000000000000600: 49 83 e8 08             sub $0x8, %r8
+ 000000000a0001cf:000000000c007fe0:ffffffffffff9600: 4d 29 c2                sub %r8, %r10
+ 000000000a0001d2:000000000c007fe0:0000000000000700: 49 f7 ea                imul %r10
+-000000000a0001d5:000000000c007fe0:0000000000000301: 4d 0f af d3             imul %r11, %r10
+-000000000a0001d9:000000000c007fe0:ffffffffffff8701: 4d 6b d3 77             imul $0x77, %r11, %r10
+-000000000a0001dd:000000000c007fe0:0000000000000200: 48 25 fe 00 00 00       and $0xfe, %rax
++000000000a0001d5:000000000c007fe0:0000000000000701: 4d 0f af d3             imul %r11, %r10
++000000000a0001d9:000000000c007fe0:0000000000000701: 4d 6b d3 77             imul $0x77, %r11, %r10
++000000000a0001dd:000000000c007fe0:0000000000000600: 48 25 fe 00 00 00       and $0xfe, %rax
+ 000000000a0001e3:000000000c007fe0:0000000000000200: 48 21 c3                and %rax, %rbx
+ 000000000a0001e6:000000000c007fe0:0000000000000200: 48 83 cb 13             or $0x13, %rbx
+ 000000000a0001ea:000000000c007fe0:0000000000000200: 48 09 cb                or %rcx, %rbx
+ 000000000a0001ed:000000000c007fe0:ffffffffffff8200: 48 f7 d1                not %rcx
+ 000000000a0001f0:000000000c007fe0:ffffffffffff8200: 48 f7 d9                neg %rcx
+ 000000000a0001f3:000000000c007fe0:ffffffffffff9300: 48 c1 e7 07             shl $0x7, %rdi
+-000000000a0001f7:000000000c007fe0:0000000000000200: 48 c1 ff 03             sar $0x3, %rdi
+-000000000a0001fb:000000000c007fe0:0000000000000200: 41 55                   push %r13
+-000000000a0001fd:000000000c007fd8:0000000000000200: 48 c7 c0 19 45 00 00    mov $0x4519, %rax
+-000000000a000204:000000000c007fd8:0000000000000200: 66 0f ef c0             pxor %xmm0, %xmm0
+-000000000a000208:000000000c007fd8:0000000000000200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
+-000000000a00020d:000000000c007fd8:0000000000000200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
+-000000000a000211:000000000c007fd8:0000000000000200: 0f 2f c8                comiss %xmm0, %xmm1
++000000000a0001f7:000000000c007fe0:0000000000001200: 48 c1 ff 03             sar $0x3, %rdi
++000000000a0001fb:000000000c007fe0:0000000000001200: 41 55                   push %r13
++000000000a0001fd:000000000c007fd8:0000000000001200: 48 c7 c0 19 45 00 00    mov $0x4519, %rax
++000000000a000204:000000000c007fd8:0000000000001200: 66 0f ef c0             pxor %xmm0, %xmm0
++000000000a000208:000000000c007fd8:0000000000001200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
++000000000a00020d:000000000c007fd8:0000000000001200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
++000000000a000211:000000000c007fd8:0000000000001200: 0f 2f c8                comiss %xmm0, %xmm1
+ 000000000a000214:000000000c007fd8:0000000000000300: 74 e5                   jz 0xa0001fb
+ 000000000a000216:000000000c007fd8:0000000000000300: f3 48 0f 2c c1          cvttss2si %xmm1, %rax
+ 000000000a00021b:000000000c007fd8:0000000000000300: 48 3d 85 00 00 00       cmp $0x85, %rax
+diff --git a/test/regtest/xmm.exp b/test/regtest/xmm.exp
+index 6d14efe6145f..b8778457492c 100644
+--- a/test/regtest/xmm.exp
++++ b/test/regtest/xmm.exp
+@@ -1,6 +1,6 @@
+-000000000a000204:0000000000004519:0000000000000200: 66 0f ef c0             pxor %xmm0, %xmm0
+-000000000a000208:0000000000004519:0000000000000200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
+-000000000a00020d:0000000000004519:0000000000000200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
+-000000000a000211:0000000000004519:0000000000000200: 0f 2f c8                comiss %xmm0, %xmm1
++000000000a000204:0000000000004519:0000000000001200: 66 0f ef c0             pxor %xmm0, %xmm0
++000000000a000208:0000000000004519:0000000000001200: f3 48 0f 2a c0          cvtsi2ss %rax, %xmm0
++000000000a00020d:0000000000004519:0000000000001200: f3 0f 51 c8             sqrtss %xmm0, %xmm1
++000000000a000211:0000000000004519:0000000000001200: 0f 2f c8                comiss %xmm0, %xmm1
+ 000000000a000216:0000000000004519:0000000000000300: f3 48 0f 2c c1          cvttss2si %xmm1, %rax
+ PASSED
diff --git a/gnu/packages/patches/e9patch-check-same_op_2.patch b/gnu/packages/patches/e9patch-check-same_op_2.patch
new file mode 100644
index 0000000000..f87285a8ac
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check-same_op_2.patch
@@ -0,0 +1,21 @@
+From d457613c546e1e936440d4a9085f5dfea9a76f0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= <cnx@loang.net>
+Date: Mon, 18 Nov 2024 15:59:15 +0900
+Subject: [PATCH] Fix same_op_2 test expectation
+
+---
+ test/regtest/same_op_2.exp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/test/regtest/same_op_2.exp b/test/regtest/same_op_2.exp
+index f99033a..45790b8 100644
+--- a/test/regtest/same_op_2.exp
++++ b/test/regtest/same_op_2.exp
+@@ -12,6 +12,7 @@ shl $0x7, %rdi
+ sar $0x3, %rdi
+ pxor %xmm0, %xmm0
+ cvtsi2ss %rax, %xmm0
++sqrtss %xmm0, %xmm1
+ xor %esi, %esi
+ xor %eax, %eax
+ PASSED
diff --git a/gnu/packages/patches/e9patch-check.patch b/gnu/packages/patches/e9patch-check.patch
new file mode 100644
index 0000000000..f149b78496
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check.patch
@@ -0,0 +1,439 @@
+commit c1cbf11348a18773fb67a5114cc3fe78f5e1d1a3
+Author: Nguyễn Gia Phong <cnx@loang.net>
+Date:   2024-11-18 14:06:32 +0900
+
+    Rework regtest runner
+    
+    The C++ script is rewritten in Makefile and shell script for concision.
+
+diff --git a/Makefile b/Makefile
+index 1218c65d1818..6c786bb91a1d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -181,3 +181,8 @@ tool.sanitize: $(E9TOOL_OBJS) $(E9TOOL_LIBS)
+ 	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) $(E9TOOL_LIBS) -o e9tool \
+         $(E9TOOL_LDFLAGS)
+ 
++check: e9tool
++	$(MAKE) -C test/regtest
++
++.PHONY: all clean install check\
++	release debug sanitize tool tool.debug tool.sanitize
+diff --git a/test/regtest/Makefile b/test/regtest/Makefile
+index 992b1bc40984..9b29e0f72408 100644
+--- a/test/regtest/Makefile
++++ b/test/regtest/Makefile
+@@ -3,32 +3,69 @@ FCF_NONE := $(shell \
+         then true; \
+         else echo -fcf-protection=none; fi)
+ 
+-all:
++BASE ::= test test.pie bugs test.libc libtest.so test_c test_c.debug example.so
++TRAMPOLINE ::= inst patch dl init fini
++IN ::= $(wildcard *.in)
++EXE ::= $(IN:.in=.exe)
++
++check: regtest $(EXE)
++	./$^
++
++%.exe: in=$(shell head -1 $<)
++%.exe: %.in $(BASE) $(TRAMPOLINE)
++	../../e9tool $(E9TOOL_OPTIONS) -M 'addr >= &"entry"' $(in)\
++		-E data..data_END -E data2...text -E .text..begin -o $@
++
++test:
+ 	gcc -x assembler-with-cpp -o test test.s -no-pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=0
++
++test.pie:
+ 	gcc -x assembler-with-cpp -o test.pie test.s -pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
+ 		-Wl,--export-dynamic
++
++bugs:
+ 	gcc -x assembler-with-cpp -o bugs bugs.s -no-pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=0
++
++test.libc:
+ 	gcc -x assembler-with-cpp -o test.libc test_libc.s -pie -Wl,--export-dynamic
++
++libtest.so:
+ 	gcc -x assembler-with-cpp -shared -o libtest.so libtest.s 
++
++test_c:
+ 	gcc -O2 -fPIC $(FCF_NONE) -pie -o test_c test_c.c \
+ 		-Wl,--export-dynamic -U_FORTIFY_SOURCE
+ 	strip test_c
++
++test_c.debug:
+ 	gcc -O0 -g -fPIC -pie -o test_c.debug test_c.c
++
++inst:
+ 	../../e9compile.sh inst.c -I ../../examples/ 
++
++patch:
+ 	../../e9compile.sh patch.cpp -std=c++11 -I ../../examples/ 
++
++dl:
+ 	NO_SIMD_CHECK=1 ../../e9compile.sh dl.c -I ../../examples/
++
++init:
+ 	../../e9compile.sh init.c -I ../../examples/ 
++
++fini:
+ 	../../e9compile.sh fini.c -I ../../examples/
++
++example.so:
+ 	g++ -std=c++11 -fPIC -shared -o example.so -O2 \
+         ../../examples/plugins/example.cpp -I ../../src/e9tool/
+-	g++ -std=c++11 -pie -fPIC -o regtest regtest.cpp -O2
+ 
+-clean:
+-	rm -f *.log *.out *.exe test test.pie test.libc libtest.so inst inst.o \
+-        patch patch.o init init.o regtest
++clean-check:
++	rm -f $(BASE) $(TRAMPOLINE) $(EXE)
++
++.PHONY: check clean-check
+diff --git a/test/regtest/README.md b/test/regtest/README.md
+index be3f6dd664b3..662c2af68a14 100644
+--- a/test/regtest/README.md
++++ b/test/regtest/README.md
+@@ -3,6 +3,4 @@ README
+ 
+ To run the tests:
+ 
+-    $ make
+-    $ ./regtest
+-
++    make E9TOOL_OPTIONS=
+diff --git a/test/regtest/init_dso.cmd b/test/regtest/init_dso.cmd
+index 94f6855c5d60..db31c55672fe 100644
+--- a/test/regtest/init_dso.cmd
++++ b/test/regtest/init_dso.cmd
+@@ -1 +1 @@
+-LD_PRELOAD=$PWD/init_dso.exe ./test.pie
++LD_PRELOAD=./init_dso.exe ./test.pie
+diff --git a/test/regtest/init_dso_2.cmd b/test/regtest/init_dso_2.cmd
+index d2d56823ff80..d6d59f7b3cfd 100644
+--- a/test/regtest/init_dso_2.cmd
++++ b/test/regtest/init_dso_2.cmd
+@@ -1 +1 @@
+-LD_PRELOAD=$PWD/init_dso.exe ./test.pie a b c 1 2 3
++LD_PRELOAD=./init_dso.exe ./test.pie a b c 1 2 3
+diff --git a/test/regtest/regtest b/test/regtest/regtest
+new file mode 100755
+index 000000000000..07d9577b3da4
+--- /dev/null
++++ b/test/regtest/regtest
+@@ -0,0 +1,32 @@
++#!/bin/sh
++fails=()
++for exe in $*
++do
++  tst=${exe%.exe}
++  cmd=$tst.cmd
++  out=$tst.out
++  exp=$tst.exp
++
++  if test -f $cmd
++  then env $(cat $cmd) 1>$out 2>&1
++  else ./$exe 1>$out 2>&1
++  fi 2>/dev/null
++  case $? in
++    "132") echo Illegal instruction;;
++    "133") echo Trace/breakpoint trap;;
++    "134") echo Aborted;;
++    "138") echo User defined signal 1;;
++    "139") echo Segmentation fault;;
++  esac >>$out
++
++  diff -u $out $exp
++  if test $? -ne 0
++  then fails+=($tst)
++  fi
++done
++
++if test "$fails"
++then
++  echo "Failing ${#fails[@]}/$# tests: ${fails[@]}"
++  exit 1
++fi
+diff --git a/test/regtest/regtest.cpp b/test/regtest/regtest.cpp
+deleted file mode 100644
+index e86e0af03228..000000000000
+--- a/test/regtest/regtest.cpp
++++ /dev/null
+@@ -1,269 +0,0 @@
+-/*
+- * Copyright (C) 2022 National University of Singapore
+- *
+- * This program is free software: you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation, either version 3 of the License, or
+- * (at your option) any later version.
+- * 
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+- * GNU General Public License for more details.
+- * 
+- * You should have received a copy of the GNU General Public License
+- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+- */
+-
+-#include <string>
+-#include <vector>
+-
+-#include <cctype>
+-#include <cstdio>
+-#include <cstdlib>
+-#include <cstring>
+-
+-#include <sys/types.h>
+-#include <sys/wait.h>
+-#include <dirent.h>
+-#include <unistd.h>
+-
+-static bool option_tty = false;
+-
+-#define RED     "\33[31m"
+-#define GREEN   "\33[32m"
+-#define YELLOW  "\33[33m"
+-#define WHITE "\33[0m"
+-
+-#define error(msg, ...)                                                 \
+-    do                                                                  \
+-    {                                                                   \
+-        fprintf(stderr, "%serror%s: " msg "\n",                         \
+-            (option_tty? RED: ""), (option_tty? WHITE: ""),           \
+-            ##__VA_ARGS__);                                             \
+-        exit(EXIT_FAILURE);                                             \
+-    }                                                                   \
+-    while (false)
+-
+-/*
+- * Run a single test case.
+- */
+-static bool runTest(const struct dirent *test, const std::string &options)
+-{
+-    std::string in(test->d_name);
+-    std::string basename(in, 0, in.size()-3);
+-    std::string out(basename);
+-    out += ".out";
+-    std::string exp(basename);
+-    exp += ".exp";
+-    std::string exe(basename);
+-    exe += ".exe";
+-    std::string log(basename);
+-    log += ".log";
+-    std::string cmd(basename);
+-    cmd += ".cmd";
+-    std::string diff(basename);
+-    diff += ".diff";
+-
+-    // Step (0): reset
+-    unlink(out.c_str());
+-    unlink(exe.c_str());
+-    unlink(log.c_str());
+-    unlink(diff.c_str());
+-
+-    // Step (1): generate the EXE
+-    std::string command("../../e9tool ");
+-    if (options != "")
+-    {
+-        command += options;
+-        command += ' ';
+-    }
+-    command += "-M 'addr >= &\"entry\"' ";
+-    FILE *IN = fopen(in.c_str(), "r");
+-    if (IN == nullptr)
+-        error("failed to open file \"%s\": %s", in.c_str(), strerror(errno));
+-    char c;
+-    for (int i = 0; (c = getc(IN)) != '\n' && isprint(c) && i < 1024; i++)
+-        command += c;
+-    fclose(IN);
+-    command += " -E data..data_END -E data2...text -E .text..begin -o ";
+-    command += exe;
+-    command += " >>";
+-    command += log;
+-    command += " 2>&1";
+-
+-    FILE *LOG = fopen(log.c_str(), "w");
+-    if (LOG != NULL)
+-    {
+-        fprintf(LOG, "%s\n", command.c_str());
+-        fclose(LOG);
+-    }
+-    printf("\n\t%s\n", command.c_str());
+-    int r = system(command.c_str());
+-    if (r != 0)
+-    {
+-        printf("%s%s%s: %sFAILED%s (patching failed with status %d, see %s)\n",
+-            (option_tty? YELLOW: ""), basename.c_str(), (option_tty? WHITE: ""),
+-            (option_tty? RED: ""), (option_tty? WHITE: ""),
+-            r, log.c_str());
+-        return false;
+-    }
+-
+-    // Step (2): execute the EXE
+-    FILE *CMD = fopen(cmd.c_str(), "r");
+-    command.clear();
+-    if (CMD != NULL)
+-    {
+-        for (int i = 0; (c = getc(CMD)) != '\n' && isprint(c) && i < 1024; i++)
+-            command += c;
+-        fclose(CMD);
+-    }
+-    else
+-    {
+-        command += "./";
+-        command += exe;
+-    }
+-    command += " >";
+-    command += out;
+-    command += " 2>&1";
+-    printf("\t%s\n", command.c_str());
+-    r = system(command.c_str());
+-    if (r != 0 && /*Ignore signals=*/
+-        !(WIFEXITED(r) && WEXITSTATUS(r) >= 128 && WEXITSTATUS(r) <= 128+32))
+-    {
+-        printf("%s%s%s: %sFAILED%s (execution failed with status %d, see %s)\n",
+-            (option_tty? YELLOW: ""), basename.c_str(), (option_tty? WHITE: ""),
+-            (option_tty? RED: ""), (option_tty? WHITE: ""),
+-            r, out.c_str());
+-        return false;
+-    }
+-    command.clear();
+-    command = "sed -i 's/ (core dumped)//g' ";
+-    command += out;
+-    system(command.c_str());
+-
+-    // Step (3): compare the output
+-    FILE *OUT = fopen(out.c_str(), "r");
+-    if (OUT == nullptr)
+-        error("failed to open file \"%s\" for reading: %s", out.c_str(),
+-            strerror(errno));
+-    FILE *EXP = fopen(exp.c_str(), "r");
+-    if (EXP == nullptr)
+-    {
+-        if (errno == ENOENT)
+-            EXP = fopen("/dev/null", "r");	// Missing = empty file
+-        if (EXP == nullptr)
+-            error("failed to open file \"%s\" for reading: %s", exp.c_str(),
+-                strerror(errno));
+-    }
+-    const int LIMIT = 100000;   
+-    for (int i = 0; i < LIMIT; i++)
+-    {
+-        char c = getc(OUT), d = getc(EXP);
+-        if (c != d)
+-        {
+-            fclose(OUT); fclose(EXP);
+-            command.clear();
+-            command += "diff ";
+-            command += out;
+-            command += ' ';
+-            command += exp;
+-            command += " >";
+-            command += diff;
+-            printf("\t%s\n", command.c_str());
+-            (void)system(command.c_str());
+-            printf("%s%s%s: %sFAILED%s (miscompare, see %s)\n",
+-                (option_tty? YELLOW: ""), basename.c_str(),
+-                (option_tty? WHITE: ""), (option_tty? RED: ""),
+-                (option_tty? WHITE: ""), diff.c_str());
+-            return false;
+-        }
+-        if (c == EOF)
+-            break;
+-    }
+-    fclose(OUT); fclose(EXP);
+-
+-    // Success!
+-    printf("%s%s%s: %spassed%s\n",
+-        (option_tty? YELLOW: ""), basename.c_str(), (option_tty? WHITE: ""),
+-        (option_tty? GREEN: ""), (option_tty? WHITE: ""));
+-    return true;
+-}
+-
+-/*
+- * Test if directory entry is a test case (i.e., ends with ".in").
+- */
+-static int isTest(const struct dirent *entry)
+-{
+-    size_t len = strlen(entry->d_name);
+-    if (len <= 3)
+-        return false;
+-    if (entry->d_name[len-1] != 'n' || entry->d_name[len-2] != 'i' ||
+-            entry->d_name[len-3] != '.')
+-        return false;
+-    return true;
+-}
+-
+-/*
+- * Entry.
+- */
+-int main(int argc, char **argv)
+-{
+-    std::string options;
+-    for (int i = 1; i < argc; i++)
+-    {
+-        if (i > 1)
+-            options += ' ';
+-        options += argv[i];
+-    }
+-
+-    option_tty = (isatty(STDOUT_FILENO) && isatty(STDERR_FILENO));
+-    struct dirent **tests = nullptr;
+-    int n = scandir(".", &tests, isTest, alphasort);
+-    if (n < 0)
+-        error("failed to scan current directory: %s", strerror(errno));
+-    size_t passed = 0, failed = 0, total = 0;
+-    std::vector<std::string> fails;
+-    for (int i = 0; i < n; i++)
+-    {
+-        total++;
+-        if (runTest(tests[i], options))
+-            passed++;
+-        else
+-        {
+-            fails.push_back(tests[i]->d_name);
+-            failed++;
+-        }
+-    }
+-
+-    const char *highlight = "", *off = "";
+-    if (option_tty)
+-    {
+-        if (passed == total)
+-            highlight = GREEN, off = WHITE;
+-        else if (passed == 0)
+-            highlight = RED, off = WHITE;
+-        else
+-            highlight = YELLOW, off = WHITE;
+-    }
+-    putchar('\n');
+-    printf("PASSED = %s%.2f%%%s (%zu/%zu); FAILED = %s%.2f%%%s (%zu/%zu)\n\n",
+-        highlight, (double)passed / (double)total * 100.0, off, passed, total,
+-        highlight, (double)failed / (double)total * 100.0, off, failed, total);
+-    if (fails.size() > 0)
+-    {
+-        printf("FAILED = {");
+-        bool prev = false;
+-        for (const auto &fail: fails)
+-        {
+-            if (prev)
+-                putchar(',');
+-            prev = true;
+-            printf("%s", fail.c_str());
+-        }
+-        printf("}\n\n");
+-    }
+-
+-    return 0;
+-}
+-
diff --git a/gnu/packages/patches/e9patch-devendor.patch b/gnu/packages/patches/e9patch-devendor.patch
new file mode 100644
index 0000000000..e9ee2921d9
--- /dev/null
+++ b/gnu/packages/patches/e9patch-devendor.patch
@@ -0,0 +1,52 @@
+diff --git a/Makefile b/Makefile
+index 1218c65d1818..0ebdf24ea259 100644
+--- a/Makefile
++++ b/Makefile
+@@ -37,10 +37,7 @@ E9TOOL_OBJS=\
+ E9TOOL_LIBS=\
+     contrib/zydis/libZydis.a \
+     contrib/libdw/libdw.a
+-E9TOOL_CXXFLAGS=\
+-    -I src/e9tool/ -Wno-unused-function \
+-    -I contrib/zydis/include/ \
+-    -I contrib/zydis/dependencies/zycore/include/
++E9TOOL_CXXFLAGS= -I src/e9tool/ -Wno-unused-function
+ E9TOOL_LDFLAGS=\
+     -Wl,--dynamic-list=src/e9tool/e9tool.syms \
+     -ldl -lz
+@@ -52,9 +49,9 @@ E9TOOL_LDFLAGS=\
+ all: e9tool e9patch
+ 
+ e9tool: CXXFLAGS += -O2 -DSYSTEM_LIBDW $(E9TOOL_CXXFLAGS)
+-e9tool: contrib/zydis/libZydis.a $(E9TOOL_OBJS)
+-	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) contrib/zydis/libZydis.a -o e9tool \
+-	    $(E9TOOL_LDFLAGS) -ldw
++e9tool: $(E9TOOL_OBJS)
++	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) -o e9tool \
++	    $(E9TOOL_LDFLAGS) -ldw -lZydis
+ 	strip e9tool
+ 
+ e9patch: CXXFLAGS += -O2 
+diff --git a/src/e9tool/e9x86_64.cpp b/src/e9tool/e9x86_64.cpp
+index 6a7f5cff3692..03eb3a41dd66 100644
+--- a/src/e9tool/e9x86_64.cpp
++++ b/src/e9tool/e9x86_64.cpp
+@@ -152,8 +152,7 @@ void e9tool::getInstrInfo(const ELF *elf, const Instr *I, InstrInfo *info,
+     ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
+ 
+     ZyanStatus result = ZydisDecoderDecodeFull(&decoder,
+-        elf->data + I->offset, I->size, D, operands, ZYDIS_MAX_OPERAND_COUNT,
+-        0);
++        elf->data + I->offset, I->size, D, operands);
+     if (!ZYAN_SUCCESS(result) || I->size != D->length ||
+             D->operand_count > sizeof(info->op) / sizeof(info->op[0]))
+         error("failed to decompress instruction at address 0x%lx; decode "
+@@ -336,7 +335,7 @@ void e9tool::getInstrInfo(const ELF *elf, const Instr *I, InstrInfo *info,
+         info->string.section    = elf->strs + shdr->sh_name;
+         result = ZydisFormatterFormatInstruction(&formatter, D, operands,
+             D->operand_count_visible, info->string.instr,
+-            sizeof(info->string.instr)-1, I->address);
++            sizeof(info->string.instr)-1, I->address, ZYAN_NULL);
+         if (!ZYAN_SUCCESS(result))
+             error("failed to decompress instruction at address 0x%lx; "
+                 "formatting failed", I->address);
diff --git a/gnu/packages/patches/e9patch-plugin-api-headers.patch b/gnu/packages/patches/e9patch-plugin-api-headers.patch
new file mode 100644
index 0000000000..f24f80d677
--- /dev/null
+++ b/gnu/packages/patches/e9patch-plugin-api-headers.patch
@@ -0,0 +1,25 @@
+From 13ddf96e29edfea8e6af5d3a3dfea8d1315fa761 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= <cnx@loang.net>
+Date: Mon, 18 Nov 2024 16:40:56 +0900
+Subject: [PATCH] Install plugin API headers to C_INCLUDE_PATH
+
+---
+ Makefile | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1218c65..20c5584 100644
+--- a/Makefile
++++ b/Makefile
+@@ -110,9 +110,8 @@ install: all
+         doc/e9tool-user-guide.md | markdown > \
+         "$(DESTDIR)/usr/share/doc/e9tool/e9tool-user-guide.html"
+ 	install -m 444 LICENSE "$(DESTDIR)/usr/share/doc/e9tool/LICENSE"
+-	install -d "$(DESTDIR)/usr/share/e9tool/include/"
+-	install -m 444 src/e9tool/e9tool.h "$(DESTDIR)/usr/share/e9tool/include/e9tool.h"
+-	install -m 444 src/e9tool/e9plugin.h "$(DESTDIR)/usr/share/e9tool/include/e9plugin.h"
++	install -Dm 444 src/e9tool/e9tool.h "$(DESTDIR)/usr/include/e9tool/e9tool.h"
++	install -Dm 444 src/e9tool/e9plugin.h "$(DESTDIR)/usr/include/e9tool/e9plugin.h"
+ 	install -d "$(DESTDIR)/usr/share/e9tool/examples/"
+ 	install -m 444 examples/bounds.c "$(DESTDIR)/usr/share/e9tool/examples/bounds.c"
+ 	sed \