[fpc-devel] Questions regarding m68k-atari target

Thorsten Otto admin at tho-otto.de
Mon Jan 24 11:03:38 CET 2022


(I'm new to this  list so please forgive me if i'm asking questions that have 
already been answered elsewhere, and just point me to the right direction)

Inspired by some thread on the atari-forum (https://www.atari-forum.com/
viewtopic.php?f=16&t=41476&sid=cd858e109f7cd4f1cae6c597ea35b66f )
i recently tried to cross-compile freepascal for atari (using linux as host), 
and encountered a few problems. First off, a guy pointed me to the nightly 
build page (which i could not find btw. on the freepascal home page). That one 
also includes atari binaries which don't seem to be available elsewhere, but 
they are somewhat broken. All of the executables (not only the compiler) have 
$0c set in the program flags. The $08 bit of that value is interpreted by MiNT 
to allocate only a minimum TPA (which is the memory needed by the 
text+data+bss sections), but the startup code of fpc tries to increase that in 
order to allocate the stack. That causes all of the binaries to immediately 
fail with an out-of-memory error.

The next problem is the way the assembler and linker are invoked. I realize 
that in the daily builds, vasm/vlink are used, but i would really prefer to 
use gas/ld instead (which are also the defaults if you don't use -Avasm). When 
generating the cross-compiler, they are invoked as m68k-atari-as and m68k-
atari-ld, however the standard binutils for atari are actually named different 
(m68k-atari-mint-as and m68k-atari-mint-ld). As a workaround, i now created 
symlinks for these, but this should actually be fixed.
Also, the commandline for the linker is wrong in that case, it is invoked as

m68k-atari-ld -d -n -o <exe> <scriptfile>

where scriptfile is a generated linker script. That is missing the -T switch, 
which causes ld to accept <scriptfile> as object-file to link (and causing it 
to core-dump).

Another thing: that linker expects the first object to start at text address 
0xe4, not 0. That is normally achieved by some statements in the script, but 
those are missing.

A thing that is definitely missing is support for the ARGV argument passing. 
Without this, commandlines are limited to 126 chars, and tools like fpc.ttp 
are not able to locate their own directory (needed for example to find the 
fpc.cfg file). If you want, i can try to implement that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220124/ad298d51/attachment.htm>

More information about the fpc-devel mailing list