From patchwork Tue Jun 23 06:04:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "ashish.is--- via Guix-patches\" via" X-Patchwork-Id: 22832 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9C03C27BBE1; Tue, 23 Jun 2020 07:05:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id B824F27BBE3 for ; Tue, 23 Jun 2020 07:05:10 +0100 (BST) Received: from localhost ([::1]:54744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnc3S-0002c0-7F for patchwork@mira.cbaines.net; Tue, 23 Jun 2020 02:05:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnc3K-0002ZW-St for guix-patches@gnu.org; Tue, 23 Jun 2020 02:05:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnc3K-0003eP-Im for guix-patches@gnu.org; Tue, 23 Jun 2020 02:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jnc3K-00078m-CF for guix-patches@gnu.org; Tue, 23 Jun 2020 02:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41574] gnu: Add intel-xev. Resent-From: elaexuotee@wilsonb.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 23 Jun 2020 06:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41574 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Marius Bakke Cc: 41574@debbugs.gnu.org Received: via spool by 41574-submit@debbugs.gnu.org id=B41574.159289228027417 (code B ref 41574); Tue, 23 Jun 2020 06:05:02 +0000 Received: (at 41574) by debbugs.gnu.org; 23 Jun 2020 06:04:40 +0000 Received: from localhost ([127.0.0.1]:35296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnc2o-00077x-Dx for submit@debbugs.gnu.org; Tue, 23 Jun 2020 02:04:40 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]:61226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnc2h-00077e-QS for 41574@debbugs.gnu.org; Tue, 23 Jun 2020 02:04:28 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1592892263; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: Subject: From: Cc: To: Date: Sender; bh=Wm1DdQREGJ6Mny25U5NwwfRGqUSLZarKjIPFJ3wtVzA=; b=a+3GNNr5o1V6d2vX1lSAchs0yAAVC89yiy/f44qPHr3eYZ3Gy3cYzhxzGolQJmT8xP3ynYD9 jNrgnG830yRYakDc5VW18KK6fjUvVfsKPfpaXMcjZJQ71+vZHVjVoluW/biKcpRM7+e0PhVB oPxHUpAKvSwZUMdhOE4uZz0oeNaAExEYREqGMMFgtiCcQ5TdOWRtH0M20+9GcptSYhxW3xg+ +Jf6GZulL9lzDk4WFYdx5gohmUyQOrX5wNc5wCaLCFesIppaGXWxMB3jtjg4sJ75whdF+NPY 50GCw6ennZaaQa+vpJ0VscJzJ4WP3vpM/k/tzjBW3HhuivzbjIijTg== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyIwYzVjZiIsICI0MTU3NEBkZWJidWdzLmdudS5vcmciLCAiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n08.prod.us-east-1.postgun.com with SMTP id 5ef19b618fe116ddd9a604af (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Tue, 23 Jun 2020 06:04:17 GMT Received: from localhost (KD111239209250.au-net.ne.jp [111.239.209.250]) by wilsonb.com (Postfix) with ESMTPSA id A208CA2B2C; Tue, 23 Jun 2020 06:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1592892255; bh=Wm1DdQREGJ6Mny25U5NwwfRGqUSLZarKjIPFJ3wtVzA=; h=Date:To:Cc:From:Subject:References:In-Reply-To:From; b=oU5sP+k7MdoKpXS5suZ8+byUiOyuregDnyf10KA+UPSBlvip3crPtDT6zQSIgiKZF VGP94QxbvTairfoPn8rl2P0KOsp+e4eHpBVuQWSfrlYrYtm1xOMu6X0+CqgrYT7Lcs kJXq/11DEkvbzgaY6EnuzsngWb/kFPQYUPFiOF/K+NZONKiakoRIWqg1ACJyvrmTqX qFBCPSBtRdH0msr6i76SM7At7CH0iuDliIOef5Ugbo6YqqxNVB+IAr57xGXVJJJ6c+ +mUYRcjq4ZnWSAn+Vjihv3mTJ1Ehff7V1xAIpLmrOoc3bTgxBv26QQsLVzkEynmQcn YEvsAlo5/atBBgGXbq/xkARNAvIXqzEIxMr3IX48HKnbJv/lmUY+BAzz1amHiTAFiP ZygCfnq1M96hW/3fz71HY1WX8USobTqV1QpLdK+c2sJswtlE9DPfBywWCBA+K9/8wR gNMZ8Z2tFqBUl7J4EAmbKlrSFSYg3CPgFkeiKKn5r3Ta/Eezk8lMwyeTILuKXaM7Dn 2zEp7fASjZS1hMzJOZsm1WyB09oo5M+v17VlOipRvnEV417HGM0u0nrgrQjYaSPUFQ BwCSiTr8/WDiNNU0hfjijyDfD5lEnbJJGYZxHcX2idh8KXh0MOrwG0I9yvZ58JARFp e8xSGK3EZ1Bnpt0BNcnlXyN8= Date: Tue, 23 Jun 2020 15:04:06 +0900 References: <30SSS7KMH7STU.2VZS2NNFF6QOP@wilsonb.com> <338KSVUXDSMM8.2HI3H62CJZAVU@wilsonb.com> <878sgebzbx.fsf@gnu.org> In-Reply-To: <878sgebzbx.fsf@gnu.org> Message-Id: <337PSS1AAVGN7.2MVZ1RZ09WTJA@wilsonb.com> User-Agent: mblaze/0.7 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: elaexuotee@wilsonb.com, elaexuotee--- via Guix-patches X-Patchwork-Original-From: elaexuotee--- via Guix-patches via From: "ashish.is--- via Guix-patches\" via" X-getmail-retrieved-from-mailbox: Patches Marius, Thanks for taking a look at this. > Were these two downgrades intended? I'm assuming no, since the new > package don't appear to use them. Definitely not. Looks like I was sloppy with a local rebase. Thanks for catching this. > Does it work to use 'python-wrapper' instead of providing both Python 2 > and Python 3 here? Beautiful; 'python-wrapper' is exactly what I was looking for. > Is the src output used for other things than documentation? If not, I > think we can drop it and let users do 'guix build --source intel-xed' > instead. The description should be modified accordingly. Sounds emminently reasonable to me. > Apart from this the package LGTM. Probably it should have: > > (supported-systems '("x86_64-linux" "i686-linux")) > > too? I'm not so sure, actually. The tool and library simply facilitate translating to/from x86 opcodes, but as far as I can tell it doesn't actually *execute* any architecture-specific instructions. > Can you add a short description at the top of the patch file explaining > what it does any why? Oh, neat. I didn't know this was possible. > Can you send an updated patch? Thanks! Done! From a90ef5e79d863201d990d607c2926400654bfd9b Mon Sep 17 00:00:00 2001 From: "B. Wilson" Date: Thu, 28 May 2020 07:32:28 +0900 Subject: [PATCH] gnu: Add intel-xed. To: guix-patches@gnu.org * gnu/packages/assembly.scm (intel-xed): New variable. --- gnu/local.mk | 1 + gnu/packages/assembly.scm | 89 ++++++++++++++ .../intel-xed-fix-nondeterminism.patch | 113 ++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 gnu/packages/patches/intel-xed-fix-nondeterminism.patch diff --git a/gnu/local.mk b/gnu/local.mk index 1b9fabd2ad..69884b0451 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1104,6 +1104,7 @@ dist_patch_DATA = \ %D%/packages/patches/ilmbase-fix-test-arm.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 \ diff --git a/gnu/packages/assembly.scm b/gnu/packages/assembly.scm index c9582bc596..452d458272 100644 --- a/gnu/packages/assembly.scm +++ b/gnu/packages/assembly.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2019 Andy Tai ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Christopher Lemmer Webber +;;; Copyright © 2020 B. Wilson ;;; ;;; 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))) @@ -371,3 +373,90 @@ It understands mnemonics and generates code for NMOS 6502s (such as 6502A, 6504, 6507, 6510, 7501, 8500, 8501, 8502 ...), CMOS 6502s (65C02 and Rockwell R65C02) and the 65816.") (license license:gpl2))) + +(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.git") + (commit "40125558530137444b4ee6fd26b445bfa105b543"))) + (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) + ("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" "src")) + (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))) diff --git a/gnu/packages/patches/intel-xed-fix-nondeterminism.patch b/gnu/packages/patches/intel-xed-fix-nondeterminism.patch new file mode 100644 index 0000000000..c81bd0edde --- /dev/null +++ b/gnu/packages/patches/intel-xed-fix-nondeterminism.patch @@ -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) + -- 2.27.0