(the following is from an email bug report)
Details:
The compiler builds without error: “make bin/retro-compiler”
“objcopy” is in the PATH: “which objcopy”
/usr/bin/objcopy
When I compile the “hello.forth” example (from the Handbook), an
“a.out” file is generated (as expected):
“bin/retro-compiler hello.forth hello”
Final image is 14340 cells
Running the object file, however, produces a segmentation fault, with no
other messages or information produced:
“./a.out”
Segmentation fault
Source (“hello.forth”):
\~\~\~
:hello 'hello_world! s:put nl ;
\~\~\~
Diagnostics:
Basic boot data is:
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.19.71-imx-r1 (root@ebf-dev) (gcc version
7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)) #1stable SMP PREEMPT Thu May
7 09:46:01 CST 2020
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7),
cr=10c53c7d
[ 0.000000] CPU: div instructions available: patching division code
The a.out file header looks like this (“readelf -h a.out”):
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x1341
Start of program headers: 52 (bytes into file)
Start of section headers: 151136 (bytes into file)
Flags: 0x5000400, Version5 EABI,
hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 30
Section header string table index: 29
The initial part of “objdump -fs a.out” looks like:
a.out: file format elf32-littlearm
architecture: arm, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00001341
Contents of section .interp:
0154 2f6c6962 2f6c642d 6c696e75 782d6172 /lib/ld-linux-ar
0164 6d68662e 736f2e33 00 mhf.so.3.
Contents of section .note.ABI-tag:
0170 04000000 10000000 01000000 474e5500 ............GNU.
0180 00000000 03000000 02000000 00000000 ................
I haven't been able to setup a 32-bit system yet, but it does work on a 64-bit system I have. Tomorrow I will hopefully have things ready to try on a Raspberry Pi.
Thus far I haven't been able to replicate this, but I have now downloaded Ubuntu 18.04 which appears to be the version being used, so I'll try to replicate under that.
This has been deferred to 2021.4 as it only appears to affect Ubuntu 18.04 and has not been reported to occur on more recent releases.