6 def get_assembled_instruction(instruction
, bigendian
=False):
8 endian_fmt
= "elf64-big"
11 endian_fmt
= "elf64-little"
13 with tempfile
.NamedTemporaryFile(suffix
=".o") as outfile
:
14 args
= ["powerpc64-linux-gnu-as",
18 p
= subprocess
.Popen(args
, stdin
=subprocess
.PIPE
)
19 p
.communicate(instruction
.encode('utf-8'))
22 with tempfile
.NamedTemporaryFile(suffix
=".bin") as binfile
:
23 args
= ["powerpc64-linux-gnu-objcopy",
28 subprocess
.check_output(args
)
29 binary
= struct
.unpack('>i', binfile
.read(4))[0]