-3

I have a section of ASM code, a subroutine from a older executable that I need to either turn into a shared library, or C code so that I can incorporate it into a newer, rewritten version of the software. I no longer have access to the original source code, so unfortunately, it's attempt this, or rewrite the entire massive function from scratch.

I have access to software like IDA/Hex Rays, but my problem there is those will not turn ASM into pseudocode unless it can first decompile a binary. I don't have a binary - I have the ASM code. I can't (or rather, do not know how to) compile the ASM into a binary, as it's just a section of the code.

Is there a simple way to turn a section of ASM code into a compiled binary, or an ASM to C converter that does not require a binary to be decompiled first?

  • 1
    I think you need an *assembler.* – fuz Oct 24 '16 at 11:56
  • What operating system are you on? What is the target platform? What is the assembler format? – Some programmer dude Oct 24 '16 at 11:56
  • Usually you compile your .C code stuff to .obj, before you link them together. Using an assembler, you can compile your .ASM code to .obj and link them the same way, even mixed .objs from .C and .ASM, the linker doesnt care for what it came from – Tommylee2k Oct 24 '16 at 13:04
  • Whatever platform you're on, building object files from asm source is pretty similar to building them from C source. Just find a compiler/assembler that understands the flavour of asm your source uses. – Peter Cordes Oct 24 '16 at 14:41

1 Answers1

2

You didn't mention what platform you are on, but assuming you have access to Linux, you can compile ASM using as(1) (https://linux.die.net/man/1/as).

BTW: You might want to look at the Bomerang project which is an open source decompiler http://boomerang.sourceforge.net/

user590028
  • 11,364
  • 3
  • 40
  • 57
  • 1) That's a comment, not an answer. 2) Assembler code even for the same machine is not necessarily compatible between different Assembler programms. There is no standard syntax like HLL. – too honest for this site Oct 24 '16 at 12:00
  • @Olaf OPs question is sadly not answerable as is because it lacks this critical information (what assembly dialect he needs). – fuz Oct 24 '16 at 12:05
  • 1
    "OPs question is sadly not answerable as is because it lacks this critical information" - Which means you should have left a comment for clarification and possibly CVed as "unclear". Please re-read the rules. – too honest for this site Oct 24 '16 at 12:10
  • @FUZxxl: Sorry, I didn't notice it was not from the answerer so I omitted the address. The comment above is to you. – too honest for this site Oct 24 '16 at 12:27