jserv / amacc

Small C Compiler generating ELF executable Arm architecture, supporting JIT execution
Other
1.01k stars 160 forks source link

Can't create ELF executable from bootstrap amacc compiler #84

Closed HPCguy closed 2 years ago

HPCguy commented 2 years ago

A recent problem has appeared:

$ gcc -o amacc-gcc amacc.c -ldl $ ./amacc-gcc -o fib tests/fib.c $ ./fib 20 10946 $ ./amacc-gcc -o amacc amacc.c # amacc bootstrap compile $ ./amacc tests/fib.c 20 10946 $ ./amacc -o fib-amacc tests/fib.c Segmentation fault $

At first, I thought this was because of changes I made to the compiler, but I rolled back to Dec 16, 2020 before I had made any changes to the compiler, and tried again, with the same result:

$ cd /tmp $ git clone https://github.com/jserv/amacc.git $ cd amacc $ git checkout -b old_state 684c54ba4ba854e5332f8ea01608e4b45af307c6 # Dec 16 2020 $ gcc -o amacc-gcc amacc.c -ldl $ ./amacc-gcc -o fib tests/fib.c $ ./fib 20 10946 $ ./amacc-gcc -o amacc amacc.c $ ./amacc tests/fib.c 20 10946 $ ./amacc -o fib-amacc tests/fib.c Segmentation fault $

I am thinking that this may be due to an ABI change in the linux kernel that I pulled with a recent 'sudo apt update ; sudo apt full-upgrade' .

I am not an ELF expert, so I'm not sure I can fix this, especially since I don't have a debugger that will work on the bootstrapped amacc executable produced by the compile commands above. If anyone can point me to a debugger that will work on amacc ELF files, I can try to make some progress

PS Just getting back to amacc work after a forced hiatus.