@LocalContext
def make_elf_from_assembly(assembly, vma=None, extract=False, shared=False, strip=False, **kwargs):
 if (shared and vma):
  log.error('Cannot specify a VMA for a shared library.')
 if (vma is None):
  if shared:
   vma = 0
  else:
   vma = 268435456
 if (context.arch == 'thumb'):
  to_thumb = shellcraft.arm.to_thumb()
  if (not assembly.startswith(to_thumb)):
   assembly = (to_thumb + assembly)
 result = asm(assembly, vma=vma, shared=shared, extract=False, **kwargs)
 if (not extract):
  os.chmod(result, 493)
 else:
  with open(result, 'rb') as io:
   result = io.read()
 return result

@ LocalContext def make_elf_from_assembly ( assembly , vma = None , extract = False , shared = False , strip = False , ** kwargs ) : if ( shared and vma ) : log . error ( 'Cannot specify a VMA for a shared library.' ) if ( vma is None ) : if shared : vma = 0 else : vma = 268435456 if ( context . arch == 'thumb' ) : to_thumb = shellcraft . arm . to_thumb ( ) if ( not assembly . startswith ( to_thumb ) ) : assembly = ( to_thumb + assembly ) result = asm ( assembly , vma = vma , shared = shared , extract = False , ** kwargs ) if ( not extract ) : os . chmod ( result , 493 ) else : with open ( result , 'rb' ) as io : result = io . read ( ) return result
make_elf_from_assembly -> str builds an elf file with the specified assembly as its executable code .