gnu: Add intel-xed.
* gnu/packages/assembly.scm (intel-xed): New variable. * gnu/packages/patches/intel-xed-fix-nondeterminism.patch: New file. * gnu/local.mk (dist_patch_DATA): Add reference to new patch. Signed-off-by: Marius Bakke <marius@gnu.org>master
parent
737e9d5665
commit
f3130c6674
|
@ -1134,6 +1134,7 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/ilmbase-fix-tests.patch \
|
||||
%D%/packages/patches/inetutils-hurd.patch \
|
||||
%D%/packages/patches/inkscape-poppler-0.76.patch \
|
||||
%D%/packages/patches/intel-xed-fix-nondeterminism.patch \
|
||||
%D%/packages/patches/intltool-perl-compatibility.patch \
|
||||
%D%/packages/patches/iputils-libcap-compat.patch \
|
||||
%D%/packages/patches/irrlicht-use-system-libs.patch \
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
;;; Copyright © 2019 Andy Tai <atai@atai.org>
|
||||
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
||||
;;; Copyright © 2020 Christopher Lemmer Webber <cwebber@dustycloud.org>
|
||||
;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -47,6 +48,7 @@
|
|||
#:use-module (gnu packages texinfo)
|
||||
#:use-module (gnu packages python)
|
||||
#:use-module (gnu packages sphinx)
|
||||
#:use-module (gnu packages shells)
|
||||
#:use-module (gnu packages xml)
|
||||
#:use-module ((guix utils)
|
||||
#:select (%current-system)))
|
||||
|
@ -405,3 +407,95 @@ Allegrex and RSP instruction sets, partial support for the EmotionEngine
|
|||
instruction set, as well as complete support for the ARM7 and ARM9 instruction
|
||||
sets, both THUMB and ARM mode.")
|
||||
(license license:expat)))
|
||||
|
||||
(define-public intel-xed
|
||||
(package
|
||||
(name "intel-xed")
|
||||
(version "11.2.0")
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/intelxed/xed")
|
||||
(commit version)))
|
||||
(sha256 (base32 "1jffayski2gpd54vaska7fmiwnnia8v3cka4nfyzjgl8xsky9v2s"))
|
||||
(file-name (git-file-name name version))
|
||||
(patches (search-patches "intel-xed-fix-nondeterminism.patch"))))
|
||||
(build-system gnu-build-system)
|
||||
(native-inputs
|
||||
`(("python-wrapper" ,python-wrapper)
|
||||
("tcsh" ,tcsh)
|
||||
;; As of the time of writing this comment, mbuild does not exist in the
|
||||
;; Python Package Index and seems to only be used by intel-xed, so we
|
||||
;; opt to include it here instead of packaging separately. Note also
|
||||
;; that the git repository contains no version tags, so we directly
|
||||
;; reference the "version" variable from setup.py instead.
|
||||
("mbuild"
|
||||
,(let ((name "mbuild")
|
||||
(version "0.2496"))
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/intelxed/mbuild.git")
|
||||
(commit "5304b94361fccd830c0e2417535a866b79c1c297")))
|
||||
(sha256
|
||||
(base32
|
||||
"0r3avc3035aklqxcnc14rlmmwpj3jp09vbcbwynhvvmcp8srl7dl"))
|
||||
(file-name (git-file-name name version)))))))
|
||||
(outputs '("out" "lib"))
|
||||
(arguments
|
||||
`(#:phases
|
||||
;; Upstream uses the custom Python build tool `mbuild', so we munge
|
||||
;; gnu-build-system to fit. The build process for this package is
|
||||
;; documented at https://intelxed.github.io/build-manual/.
|
||||
(let* ((build-dir "build")
|
||||
(kit-dir "kit"))
|
||||
(modify-phases %standard-phases
|
||||
(delete 'configure)
|
||||
(replace 'build
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(let ((mbuild (assoc-ref inputs "mbuild")))
|
||||
(setenv "PYTHONPATH" (string-append
|
||||
(getenv "PYTHONPATH") ":" mbuild))
|
||||
(invoke "./mfile.py"
|
||||
(string-append "--build-dir=" build-dir)
|
||||
(string-append "--install-dir=" kit-dir)
|
||||
"examples"
|
||||
"doc"
|
||||
"install"))))
|
||||
(replace 'check
|
||||
(lambda _
|
||||
;; Skip broken test group `tests/tests-avx512pf'.
|
||||
(invoke "tests/run-cmd.py"
|
||||
(string-append "--build-dir=" kit-dir "/bin")
|
||||
"--tests" "tests/tests-base"
|
||||
"--tests" "tests/tests-avx512"
|
||||
"--tests" "tests/tests-cet"
|
||||
"--tests" "tests/tests-via"
|
||||
"--tests" "tests/tests-syntax"
|
||||
"--tests" "tests/tests-xop")))
|
||||
(replace 'install
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((out (assoc-ref outputs "out"))
|
||||
(lib (assoc-ref outputs "lib")))
|
||||
(copy-recursively (string-append kit-dir "/bin")
|
||||
(string-append out "/bin"))
|
||||
(copy-recursively (string-append kit-dir "/include")
|
||||
(string-append lib "/include"))
|
||||
(copy-recursively (string-append kit-dir "/lib")
|
||||
(string-append lib "/lib"))
|
||||
#t)))))))
|
||||
(home-page "https://intelxed.github.io/")
|
||||
(synopsis "Encoder and decoder for x86 (IA32 and Intel64) instructions")
|
||||
(description "The Intel X86 Encoder Decoder (XED) is a software library and
|
||||
for encoding and decoding X86 (IA32 and Intel64) instructions. The decoder
|
||||
takes sequences of 1-15 bytes along with machine mode information and produces
|
||||
a data structure describing the opcode, operands, and flags. The encoder takes
|
||||
a similar data structure and produces a sequence of 1 to 15 bytes. Disassembly
|
||||
is essentially a printing pass on the data structure.
|
||||
|
||||
The library and development files are under the @code{lib} output, with a
|
||||
family of command line utility wrappers in the default output. Each of the cli
|
||||
tools is named like @code{xed*}. Documentation for the cli tools is sparse, so
|
||||
this is a case where ``the code is the documentation.''")
|
||||
(license license:asl2.0)))
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
This patch removes sources of build non-determinism in the upstream sources.
|
||||
|
||||
In particular, many of the compiled sources are generated with Python code,
|
||||
which in turn uses dictionaries to index the output C functions. However,
|
||||
iterators over Python dictionaries have no guaranteed order, thus resulting in
|
||||
the C functions being output in a random order between builds.
|
||||
|
||||
The patch below fixes this by forcing an order during output in several key
|
||||
places. Note, however, that future updates may uncover new such places that
|
||||
just happen to be non-problematic at the time of this patch. If you are
|
||||
reading this due to finding such issues, feel free to contact me at
|
||||
elaexuotee@wilsonb.com for help.
|
||||
|
||||
diff --git a/pysrc/ild_codegen.py b/pysrc/ild_codegen.py
|
||||
index 628ec45..a9bff79 100755
|
||||
--- a/pysrc/ild_codegen.py
|
||||
+++ b/pysrc/ild_codegen.py
|
||||
@@ -188,14 +188,14 @@ def gen_l2_func_list(agi, target_nt_dict, arg_nt_dict,
|
||||
ild_t_member):
|
||||
"""generate L2 functions"""
|
||||
l2_func_list = []
|
||||
- for (nt_name,array) in target_nt_dict.items():
|
||||
+ for (nt_name,array) in sorted(target_nt_dict.items()):
|
||||
target_opname = array.get_target_opname()
|
||||
if array.is_const_lookup_fun():
|
||||
fo = gen_const_l2_function(agi, nt_name,
|
||||
target_opname, ild_t_member)
|
||||
l2_func_list.append(fo)
|
||||
else:
|
||||
- for arg_nt_seq,arg_arr in arg_nt_dict.items():
|
||||
+ for arg_nt_seq,arg_arr in sorted(arg_nt_dict.items()):
|
||||
fo = gen_scalable_l2_function(agi, nt_name,
|
||||
target_opname, ild_t_member, arg_arr, list(arg_nt_seq))
|
||||
l2_func_list.append(fo)
|
||||
diff --git a/pysrc/ild_disp.py b/pysrc/ild_disp.py
|
||||
index 942c036..cf80e29 100755
|
||||
--- a/pysrc/ild_disp.py
|
||||
+++ b/pysrc/ild_disp.py
|
||||
@@ -350,7 +350,8 @@ def work(agi, united_lookup, disp_nts, brdisp_nts, ild_gendir,
|
||||
disp_dict = _gen_l3_array_dict(agi, disp_nts, _disp_token)
|
||||
|
||||
|
||||
- nt_arr_list = list(brdisp_dict.values()) + list(disp_dict.values())
|
||||
+ nt_arr_list = ([v for (k,v) in sorted(brdisp_dict.items())] +
|
||||
+ [v for (k,v) in sorted(disp_dict.items())])
|
||||
#create function that calls all initialization functions
|
||||
init_f = ild_nt.gen_init_function(nt_arr_list, 'xed_ild_disp_l3_init')
|
||||
|
||||
@@ -367,7 +368,7 @@ def work(agi, united_lookup, disp_nts, brdisp_nts, ild_gendir,
|
||||
l2_functions = []
|
||||
eosz_op = ild_eosz.get_target_opname()
|
||||
easz_op = ild_easz.get_target_opname()
|
||||
- for nt_name,array in list(disp_dict.items()) + list(brdisp_dict.items()):
|
||||
+ for nt_name,array in sorted(disp_dict.items()) + sorted(brdisp_dict.items()):
|
||||
#Some DISP NTs depend on EOSZ, others on EASZ, we need to know
|
||||
#that when we generate L2 functions
|
||||
if eosz_op in array.get_arg_names():
|
||||
diff --git a/pysrc/ild_easz.py b/pysrc/ild_easz.py
|
||||
index 02cd691..c53b9f2 100755
|
||||
--- a/pysrc/ild_easz.py
|
||||
+++ b/pysrc/ild_easz.py
|
||||
@@ -165,9 +165,10 @@ def work(agi, united_lookup, easz_nts, ild_gendir, debug):
|
||||
return
|
||||
nt_seq_arrays[tuple(nt_seq)] = array
|
||||
#init function calls all single init functions for the created tables
|
||||
- init_f = ild_nt.gen_init_function(list(nt_seq_arrays.values()),
|
||||
+ nt_seq_values = [v for (k,v) in sorted(nt_seq_arrays.items())]
|
||||
+ init_f = ild_nt.gen_init_function(nt_seq_values,
|
||||
'xed_ild_easz_init')
|
||||
- ild_nt.dump_lu_arrays(agi, list(nt_seq_arrays.values()), _easz_c_fn,
|
||||
+ ild_nt.dump_lu_arrays(agi, nt_seq_values, _easz_c_fn,
|
||||
mbuild.join('include-private', _easz_header_fn),
|
||||
init_f)
|
||||
getter_fos = []
|
||||
diff --git a/pysrc/ild_eosz.py b/pysrc/ild_eosz.py
|
||||
index 6643bc3..89d2d89 100755
|
||||
--- a/pysrc/ild_eosz.py
|
||||
+++ b/pysrc/ild_eosz.py
|
||||
@@ -200,10 +200,11 @@ def work(agi, united_lookup, eosz_nts, ild_gendir, debug):
|
||||
return None
|
||||
nt_seq_arrays[tuple(nt_seq)] = array
|
||||
#init function calls all single init functions for the created tables
|
||||
- init_f = ild_nt.gen_init_function(list(nt_seq_arrays.values()),
|
||||
+ nt_seq_values = [v for (k,v) in sorted(nt_seq_arrays.items())]
|
||||
+ init_f = ild_nt.gen_init_function(nt_seq_values,
|
||||
'xed_ild_eosz_init')
|
||||
#dump init and lookup functions for EOSZ sequences
|
||||
- ild_nt.dump_lu_arrays(agi, list(nt_seq_arrays.values()), _eosz_c_fn,
|
||||
+ ild_nt.dump_lu_arrays(agi, nt_seq_values, _eosz_c_fn,
|
||||
mbuild.join('include-private', _eosz_header_fn),
|
||||
init_f)
|
||||
#generate EOSZ getter functions - they get xed_decoded_inst_t*
|
||||
diff --git a/pysrc/ild_imm.py b/pysrc/ild_imm.py
|
||||
index 51c413c..0530bae 100755
|
||||
--- a/pysrc/ild_imm.py
|
||||
+++ b/pysrc/ild_imm.py
|
||||
@@ -322,12 +322,14 @@ def work(agi, united_lookup, imm_nts, ild_gendir, eosz_dict,
|
||||
level='l3')
|
||||
nt_dict[nt_name] = array
|
||||
|
||||
+ nt_dict_values = [v for (k,v) in sorted(nt_dict.items())]
|
||||
+
|
||||
#create function that calls all initialization functions for L3
|
||||
- init_f = ild_nt.gen_init_function(list(nt_dict.values()),
|
||||
+ init_f = ild_nt.gen_init_function(nt_dict_values,
|
||||
'xed_ild_imm_l3_init')
|
||||
|
||||
#dump L3 functions
|
||||
- ild_nt.dump_lu_arrays(agi, list(nt_dict.values()), _l3_c_fn,
|
||||
+ ild_nt.dump_lu_arrays(agi, nt_dict_values, _l3_c_fn,
|
||||
mbuild.join('include-private',_l3_header_fn),
|
||||
init_f)
|
||||
|
Reference in New Issue