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 ;)
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel