Some linker related answers by Ciro Santilli:
Not possible it seems:
"automatic programming has always been a euphemism for programming in a higher-level language than was then available to the programmer" sums it up.
The ultimate high level is of course to program with: "computer, make money", which is the goal of artificial general intelligence.
Lowering means translating to a lower level representation.
Raising means translating to a higher level representation.
Decompilation is basically a synonym, or subset, of raising.
Saves preprocessor output and generated assembly to separate files.
- preprocessor:
- assembly:
Very hot stuff! It's like ISA-portable assembly, but with types! In particular it also it deals with calling conventions for us (since it is ISA-portable). TODO: isn't that exactly what C does? :-) LLVM IR vs C
Documentation: llvm.org/docs/LangRef.html
Example: llvm/hello.ll adapted from: llvm.org/docs/LangRef.html#module-structure but without double newline.
To execute it as mentioned at github.com/dfellis/llvm-hello-world we can either use their crazy assembly interpreter, tested on Ubuntu 22.10:This seems to use
sudo apt install llvm-runtime
lli hello.ll
puts
from the C standard library.Or we can Lower it to assembly of the local machine:which produces:and then we can assemble link and run with gcc:or with clang:
sudo apt install llvm
llc hello.ll
hello.s
gcc -o hello.out hello.s -no-pie
./hello.out
clang -o hello.out hello.s -no-pie
./hello.out
hello.s
uses the GNU GAS format, which clang is highly compatible with, so both should work in general.Reproducible builds allow anyone to verify that a binary large object contains what it claims to contain!
Bibliography:
Articles by others on the same topic
There are currently no matching articles.