[fpc-devel] Questions regarding m68k-atari target

Thorsten Otto admin at tho-otto.de
Tue Jan 25 18:28:11 CET 2022


On Dienstag, 25. Januar 2022 14:45:07 CET Thorsten Otto via fpc-devel wrote:
> And of course i have to find out what causes vlink to put that strange
> program flags in the header.

I think i found the reason for that. The offending lines in vlink/main.c are: 

            if (!strcmp(&argv[i][5],"flags")) {
              long fl;

              sscanf(get_arg(argc,argv,&i),"%li",&fl);
              gv->tosflags = fl;
            }

(at this point the option argument has already been checked to start with -
tos-).  fpc passes the arguments "-tos-flags fastload,fastram". So what 
happens is that sscanf does not find a valid number, does not write any value 
to "fl", and a (more or less) random value is used as gv->tosflags.

So the documentation in vlink is a bit misleading. It either supports "-tos-
flags <number>, or alternatively -tos-fastalloc, -tos-fastram etc., but not 
the syntax fpc uses. That should be changed to "-tos-flags 7" instead.

gnu-ld has a similar switch, but it already uses 7 as default, so there is 
need to change that too.

vlink should imho also be changed to check that a valid number was passed, but 
that's another issue ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220125/cf329e5d/attachment-0001.htm>


More information about the fpc-devel mailing list