[fpc-devel] Re. z370 Cross Compilation, Pass 2 of ....

Sven Barth pascaldragon at googlemail.com
Tue Aug 20 20:15:55 CEST 2013


On 20.08.2013 16:54, Mark Morgan Lloyd wrote:
> Apologies that I've broken the thread, but some messages don't get
> through our gateway- for some reason I'm seeing the message I'm quoting
> arriving as an encoded attachment.
>
> [Sven said]
>  > If you'd now only explain what a cross-reference tool is I might even
>  > understand what you're trying to tell me here...
>
> I think what he means is that he wants a tool that will annotate each
> procedure/function/method call in the source with the file and line
> number that it transfers control to. That's obviously going to be a
> problem in a language like Object Pascal which supports virtual methods,
> where the actual target isn't known until execution time.

Ah ok. In that case that indeed not a good idea to do especially with 
the compiler of which the code generator relies heavily on virtual 
methods (and exactly this part is what Paul is interested in). For the 
parser it might work however, but there you could also add a 
"Writeln({$I %file%}, ' ', {$I %line%});" at the beginning of each 
function :P

>  > Otherwise we also rely on external tools (mostly the GNU linker)
>  > here. So as a first step you'd choose the approach of using an
>  > external assembler and linker, because simply calling a third party
>  > utility is easier than completely implementing an internal assembler
>  > and linker.
>
> With the caveat here that as I understand it experienced IBM programmers
> avoid the GNU assembler like the plague, since it doesn't have anything
> like the sort of macro facilities they're used to. By implication, that
> would imply that they prefer to avoid the GNU linker and related tools
> as well.

A compiler is something different than a "experienced IBM programmer". 
If a programmer who writes assembly code directly tries to shortcut 
things through macros that is one thing, but for a compiler it doesn't 
matter that much whether it can make use of the macros or not. Let's 
assume there is a assembler macro for the System.Move functionality. A 
IBM programmer might prefer to use that, while the compiler has no 
problem with translating the Pascal implementation of System.Move to 
"low level" s370.

>  > Just to name a few: you'll need to get parameter passing for functions
>  > correctly
>
> Which leads to another issue: the 370 is a register-based system without
> a stack as understood today. Parameters are mostly passed in registers,
> but this is largely hidden since supervisor calls etc. are usually
> hidden in macros.
>
> My own feeling is that it would be best to start targeting a late-model
> 390, which does have a stack etc., and to use the standard GNU assembler
> and linker (as and ld) /initially/ targeting Linux. Any other
> combination (i.e. a proprietary assembler etc. with an antique MVS as
> target) is going to cause nothing but grief, since it makes it very
> difficult for developers skilled with FPC but not with IBM mainframes to
> give any practical help.
>




More information about the fpc-devel mailing list