cojocar / bin2llvm Goto Github PK
View Code? Open in Web Editor NEWA binary to LLVM translator
License: Apache License 2.0
A binary to LLVM translator
License: Apache License 2.0
Tried to build this project on Ubuntu 18.04 with gcc 7.3.0. I executed the scripts setup.sh and build.sh as written in README and got this error:
In file included from /media/UserData/Youda/CVUT/DIP/Implementace/frameworks/bin2llvm-build/llvm-native/include/llvm/Support/DataTypes.h:37:
/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cmath:45:15: fatal error: 'math.h' file not found
#include_next <math.h>
^
Looks like the build script somehow messes up with the environment and include directories, so that it cannot find them at their standard locations.
Is support of AMD64 planned?
[xaionaro@void helloworld]$ readelf -h /tmp/helloworld/helloworld
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x44e250
Start of program headers: 64 (bytes into file)
Start of section headers: 456 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 7
Size of section headers: 64 (bytes)
Number of section headers: 23
Section header string table index: 3
[xaionaro@void helloworld]$ docker run -v /tmp:/tmp --rm -t docker.io/cojocar/bin2llvm /bin/bash -c "/usr/local/bin2llvm/bin/bin2llvm.py --file /tmp/helloworld/helloworld"
Press Ctrl+C
INFO:bin2llvm:Using /tmp/bin2llvm-3jkewR as temp_dir
Traceback (most recent call last):
File "/usr/local/bin2llvm/bin/bin2llvm.py", line 855, in <module>
main()
File "/usr/local/bin2llvm/bin/bin2llvm.py", line 631, in main
cfg, isThumbIn = do_elf(args.file[0], args.temp_dir)
File "/usr/local/bin2llvm/bin/bin2llvm-pymodules/elf_parser.py", line 51, in do_elf
raise Exception("Architecture not supported")
Exception: Architecture not supported
INFO:bin2llvm:Use entry: 0x0001b71c
INFO:bin2llvm:Use entry: 0x00026efc
INFO:bin2llvm:Use entry: 0x00000000
WARNING:bin2llvm:(passes) crashed with entry: 0x00000000
INFO:bin2llvm:FINAL output is in /tmp/bin2llvm-n349ai/final.bc (370 functions)
I ran the sample command in the docker container and I get this end result. However, I cannot fine the /tmp/bin2llvm-n349ai/final.bc file. Where is this located?
Seems like a issue related to LLVM3.2 itself, can I replace it with LLVM5.X/4.X ?
Development/bin2llvm-build/llvm-3.2.src.native/lib/Analysis/LazyValueInfo.cpp:998:14: error:
no matching member function for call to 'insert'
worklist.insert(worklist.end(), succ_begin(ToUpdate), succ_end(ToUpdate));
~~~~~~~~~^~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:706:14: note:
candidate function not viable: no known conversion from 'succ_iterator'
(aka 'SuccIterator<llvm::TerminatorInst *, llvm::BasicBlock>') to
'size_type' (aka 'unsigned long') for 2nd argument
iterator insert(const_iterator __position, size_type __n, const_refe...
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:710:14: note:
candidate template ignored: disabled by 'enable_if' [with _InputIterator =
llvm::SuccIterator<llvm::TerminatorInst *, llvm::BasicBlock>]
__is_input_iterator <_InputIterator>::value &&
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:721:13: note:
candidate template ignored: disabled by 'enable_if' [with _ForwardIterator
= llvm::SuccIterator<llvm::TerminatorInst *, llvm::BasicBlock>]
__is_forward_iterator<_ForwardIterator>::value &&
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:698:14: note:
candidate function not viable: requires 2 arguments, but 3 were provided
iterator insert(const_iterator __position, const_reference __x);
^
1 error generated.
And this is my native compiler:
[bin2llvm] clang -v master ✱
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Hi.
I want to translate arm assembly code to llvm-ir staticly for a try by translating simple code. In my opinion, I should translate arm instruction to llvm-ir one by one, and then replace arm instructions by a script. Maybe I think it too simple.
But I didn't find enough data to do this. It seems that the instructions about jump is difficult and the list of AMT is too large. What's more, I'm not sure how to translate some arm instructions to llvm-ir, and how to design whole infrastructure of target .ll file just according to assembly code?
Do you have some reference data about the translation job? And could you give me some references?
best regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.