Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

challenge: Decompile the mini-c compiler, and recompile it producing byte identical output #186

Open
mewmew opened this issue Mar 23, 2017 · 2 comments
Milestone

Comments

@mewmew
Copy link
Member

mewmew commented Mar 23, 2017

The idea of the challenge issue series is to stress test the decompiler pipeline using semi-real world software.

This is the second challenge in this series, and it is based on the mini-c compiler, a self-hosting C compiler which produces 32-bit x86 assembly.

  1. Compile the mini-c compiler using a binary produced from the original C source code of mini-c. Let the output file be called mini-c_by_mini-c.
  2. Recompile the original C source code of mini-c using mini-c_by_mini-c and validate that the output is byte identical with the first version of mini-c_by_mini-c.
  3. Use Clang to emit LLVM IR assembly for the C source code of mini-c.
  4. Decompile the LLVM IR assembly of the mini-c compiler into Go source code.
  5. Compile the recovered Go source code of the mini-c compiler, and let the output file be called mini-c_go.
  6. Compile the original C source code of the mini-c compiler using mini-c_go. Let the output file be called mini-c_by_decomp.
  7. Validate that the binaries mini-c_by_mini-c and mini-c_by_decomp are byte identical.
  8. ...
  9. profit :)
@mewmew mewmew added this to the v0.3 milestone Mar 23, 2017
@mewmew

This comment has been minimized.

mewmew referenced this issue in cznic/ir May 6, 2017
* Add Switch operation.

* Finish switch branch.

Squashed commit of the following:

commit 49d5280dab8a4dbd13419360bc0bf992da444b4e
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 16:07:46 2017  0200

    WIPS

commit 127b35dd82c0980c591848280619ef6f6de5dd3f
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 15:31:35 2017  0200

    WIPS

commit 0205c8b377ff506fce92e1c128ede521b3d63d8e
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 15:19:27 2017  0200

    WIPS

commit 3acb0a215a1c61adc715d8b275f264756891cb83
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 15:14:38 2017  0200

    WIPS

commit 98f520c9c30ad150affecda390e52e13c906e344
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 03:04:06 2017  0200

    WIPS

commit 09a19e92dbc2142a94c3dd5a5ea491d410990260
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 02:37:28 2017  0200

    WIPS

commit 7ed7ce62f9f0381673b75e766ac4e96c109e6029
Author: Jan Mercl <[email protected]>
Date:   Sat Apr 29 00:20:55 2017  0200

    Try to fix "..\cc\testdata\tcc-0.9.26\tests\tests2\40_stdio.c:5:14: undefined fopen" on Windows.

commit 401ecab6670c777da18610f170a0621d4638a6b7
Author: Jan Mercl <[email protected]>
Date:   Fri Apr 28 22:27:25 2017  0200

    WIPS

commit f409c2dadc61ffef89d13f2c81ea6bdb17b6335c
Author: Jan Mercl <[email protected]>
Date:   Fri Apr 28 22:05:38 2017  0200

    WIPS
@mewmew

This comment has been minimized.

@mewmew mewmew modified the milestones: v0.3, v0.4 Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant