[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 4f86bae37e 144/323: Add rmsbolt-asm-format fo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 4f86bae37e 144/323: Add rmsbolt-asm-format for toggling between asm formats. |
Date: |
Thu, 9 Mar 2023 10:58:25 -0500 (EST) |
branch: externals/beardbolt
commit 4f86bae37e4bfd75f7506a57099c5ed89e3882f1
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add rmsbolt-asm-format for toggling between asm formats.
nil/t use tool defaults (ie: don't specify anything)
a string is passed directly to the tool in most cases.
Usually "intel" or "att" will work, in the case of disassembly, many
more will work (see objdump(1)).
See #11
---
README.org | 2 +-
rmsbolt.el | 64 ++++++++++++++++++++++++++++++++++++++++++++------------------
2 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/README.org b/README.org
index 8cd6a09254..4f7a658de2 100644
--- a/README.org
+++ b/README.org
@@ -85,7 +85,7 @@ Notable options:
| ~rmsbolt-default-directory~ | determines the default-drectory to compile
from.
|
| ~rmsbolt-disassemble~ | disassemble from a compiled binary with
objdump, if supported.
|
| ~rmsbolt-filter-*~ | Tweak filtering of binary output
|
-| ~rmsbolt-intel-x86~ | Toggle between intel and att syntax if
supported
|
+| ~rmsbolt-asm-format~ | Switch between different output formats.
Most binary formats support "att" and "intel"
|
| ~rmsbolt-demangle~ | Demangle the output, if supported.
|
| ~rmsbolt-ignore-binary-limit~ | Ignore the binary size limit for
disassembly. This will almost certainly cause Emacs to hang during large
processing. |
diff --git a/rmsbolt.el b/rmsbolt.el
index c57d70e519..8aee85d443 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -49,7 +49,7 @@
;; `rmsbolt-default-directory': determines the default-drectory to compile
from.
;; `rmsbolt-disassemble': disassemble from a compiled binary with objdump, if
supported.
;; `rmsbolt-filter-*': Tweak filtering of binary output.
-;; `rmsbolt-intel-x86': Toggle between intel and att syntax if supported.
+;; `rmsbolt-asm-format': Choose between intel att, and other syntax if
supported.
;; `rmsbolt-demangle': Demangle the output, if supported.
;;
;; For more advanced configuration (to the point where you can override almost
@@ -125,10 +125,32 @@ Some exporters (such as pony) may not work with this set."
;; nil means use default command
:safe (lambda (v) (or (booleanp v) (stringp v)))
:group 'rmsbolt)
-(defcustom rmsbolt-intel-x86 t
- "Whether to use intel x86 format or att."
- :type 'boolean
- :safe 'booleanp
+(define-obsolete-variable-alias 'rmsbolt-intel-x86
+ 'rmsbolt-asm-format "RMSBolt-0.2"
+ "Sorry about not providing a proper migration for this variable.
+Unfortunately the new options aren't a straightforward mapping.
+Most likely what you want:
+
+t -> \"intel\"
+nil -> \"att\"
+tool defaults -> nil
+
+This means that if you had rmsbolt-intel-x86 set manually, you
+are now getting tool defaults.")
+(defcustom rmsbolt-asm-format "intel"
+ "Which output assembly format to use.
+
+The supported values depend highly on the exporter, but typical
+values are: intel, att, <nil/t> (for using tool defaults).
+Invalid values will be passed onto the disassembly tools, which
+may throw errors.
+
+If you are not on x86, you most likely want to set this to nil.
+
+Since this defaults to 'intel, implementers must support this
+being set (at worst falling back to nil if passed 'intel)."
+ :type 'string
+ :safe (lambda (v) (or (booleanp v) (stringp v)))
:group 'rmsbolt)
(defcustom rmsbolt-filter-directives t
"Whether to filter assembly directives."
@@ -350,17 +372,20 @@ Return value is quoted for passing to the shell."
"Process a compile command for gcc/clang."
(rmsbolt--with-files
src-buffer
- (let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
+ (let* ((asm-format (buffer-local-value 'rmsbolt-asm-format src-buffer))
+ (disass (buffer-local-value 'rmsbolt-disassemble src-buffer))
+ (cmd (buffer-local-value 'rmsbolt-command src-buffer))
(cmd (mapconcat #'identity
(list cmd
"-g"
- (if (buffer-local-value 'rmsbolt-disassemble
src-buffer)
+ (if disass
"-c"
"-S")
src-filename
"-o" output-filename
- (when (buffer-local-value 'rmsbolt-intel-x86
src-buffer)
- "-masm=intel"))
+ (when (and (not (booleanp asm-format))
+ (not disass))
+ (concat "-masm=" asm-format)))
" ")))
cmd)))
(cl-defun rmsbolt--ocaml-compile-cmd (&key src-buffer)
@@ -426,18 +451,21 @@ Return value is quoted for passing to the shell."
"Process a compile command for rustc."
(rmsbolt--with-files
src-buffer
- (let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
+ (let* ((asm-format (buffer-local-value 'rmsbolt-asm-format src-buffer))
+ (disass (buffer-local-value 'rmsbolt-disassemble src-buffer))
+ (cmd (buffer-local-value 'rmsbolt-command src-buffer))
(cmd (mapconcat #'identity
(list cmd
"-g"
"--emit"
- (if (buffer-local-value 'rmsbolt-disassemble
src-buffer)
+ (if disass
"link"
"asm")
src-filename
"-o" output-filename
- (when (buffer-local-value 'rmsbolt-intel-x86
src-buffer)
- "-Cllvm-args=--x86-asm-syntax=intel"))
+ (when (and (not (booleanp asm-format))
+ (not disass))
+ (concat "-Cllvm-args=--x86-asm-syntax="
asm-format)))
" ")))
cmd)))
(cl-defun rmsbolt--pony-compile-cmd (&key src-buffer)
@@ -461,7 +489,7 @@ Return value is quoted for passing to the shell."
"cd" dir "&&"
cmd
"-g"
- ;; TODO: find a good way to expose -r=ir for llvm IR
+ ;; FIXME: test this properly and use
rmsbolt-asm-format to expose it.
(if dis
"-r=obj"
"-r=asm")
@@ -1165,7 +1193,8 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
(func (rmsbolt-l-compile-cmd-function lang))
;; Generate command
(cmd (funcall func :src-buffer src-buffer))
-
+ (asm-format
+ (buffer-local-value 'rmsbolt-asm-format src-buffer))
(default-directory (or rmsbolt-default-directory
rmsbolt--temp-dir)))
(when (buffer-local-value 'rmsbolt-disassemble src-buffer)
@@ -1178,9 +1207,8 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
"&&"
"objdump" "-d" (rmsbolt-output-filename
src-buffer)
"-C" "--insn-width=16" "-l"
- "-M" (if (buffer-local-value
'rmsbolt-intel-x86 src-buffer)
- "intel"
- "att")
+ (when (not (booleanp asm-format))
+ (concat "-M " asm-format))
">" (rmsbolt-output-filename src-buffer t))
" ")))
('cat
- [elpa] externals/beardbolt 6a71a16619 319/323: Simplify rainbow-clearing logic, (continued)
- [elpa] externals/beardbolt 6a71a16619 319/323: Simplify rainbow-clearing logic, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e403331350 322/323: * beardbolt.el (bb--synch-relation-overlays): Fix bug., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a6f289c94 002/323: Add very basic compilation of c files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ac893146e3 019/323: Force dissasembly if we don't support asm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f30a05624d 051/323: Add support for parsing .file directives, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 865d5a8c1a 111/323: Clean up CI config, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7f61815c17 121/323: Try to fix bytecode issues, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e517cd4dbc 142/323: Remove unneeded disass-hidden-funcs overrides, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f89875215b 128/323: Fix byte-compilation warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cb0b781e82 143/323: Add rudimentary support for hack/hhvm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4f86bae37e 144/323: Add rmsbolt-asm-format for toggling between asm formats.,
ELPA Syncer <=
- [elpa] externals/beardbolt 20fa6a76e0 150/323: Clear out unset or nil variables after setting them via defaults, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt fc712fe954 147/323: Fix typo in readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 56f8fd2037 148/323: Add additional salespitch, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0c19afca2d 157/323: Simplify d support, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f7aab87454 162/323: Fix README link, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 097abb56de 154/323: Fix tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9fb117d6c9 159/323: Add docs for D language, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1916179672 166/323: Add support for Zig, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8cf49aeac6 167/323: Add zig starter, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2a83b76cd9 172/323: Prevent overriding windows when no output window available, ELPA Syncer, 2023/03/09