Add ability to specify more parameters to asm()
function to specify target architecture
#2539
Labels
asm()
function to specify target architecture
#2539
The pwntools
asm
andmake_elf_from_assembly
functions are really amazing - they are great for really quickly testing out small snippets of assembly instructions. It would be great to be able to have more fine grained control with the arguments that are passed to the assembler and linker inside of theasm
function.This was spurred by testing a 32-bit RISC-V script that had an assembly instruction that required a RISC-V ISA extension that can be enabled via an assembler flag.
For example, the following RISC-V assembly snippet uses the
bset
instruction specified in the RISC-Vzbs
extension (I tested this with the aptgcc-14-riscv64-linux-gnu
package installed):These extensions are typically enabled by appending strings to the
-march
flag passed to the assembler. For example, to enable thezbs
extension, you can change the following line:pwntools/pwnlib/asm.py
Line 277 in 3eb690b
to
(note the
_zbs
)Perhaps there could be new named parameters such
extensions
that are passed to the assembler, and similarly another parameter to modify/(override?) the binary format.The text was updated successfully, but these errors were encountered: