[Info-vax] The future of Ada on VMS
hb
end.of at inter.net
Tue May 22 16:20:49 EDT 2018
On 05/22/2018 06:06 PM, Scott Dorsey wrote:
> Bob Koehler <koehler at eisner.nospam.decuserve.org> wrote:
>> In article <pdvvmp$ht0$2 at dont-email.me>, "John E. Malmberg" <wb8tyw at qsl.net_work> writes:
>>>
>>> How different will be Linux x86 elf from VMS x86 elf?
>
> The VMS executable format is very much unlike ELF, and I don't see that
> changing with the port to x86.
The VMS executable and linkable format on IA64 and x86_64 is ELF
(formerly known as Extensible Linking Format).
An VMS x86_64 ELF executable is very likely as different from Linux
x86_64 ELF as an VMS IA64 ELF executable is different from Linux IA64
ELF. In other words, there are VMS specific extensions as there are
probably Linux specific extensions. For ELF objects there are less
extension, less differences.
>>> What would it take to be able to compile/link on Linux and run on VMS/x86?
>>
>> That very much depends on how many OS dependencies they can hide in
>> the RTL.
Consider your favorite hello-world source. Compile it on Linux,
preferable with clang. Move it to VMS x86_64 and try to link it. This
very likely will not work. For example "printf" will be flagged as
UDFSYM, an undefined symbol. As we all know on VMS the "printf" is
automagically mapped to something like "DECC$TXPRINTF". There is
probably more, at least for "main" and how the user transfer address aka
"ELF$TFRADR" is determined. So you would need at least a few wrappers,
built on VMS, which do the mapping and add the missing pieces (for VMS
or from Linux).
However, if you have a Linux x86_64 ELF object, which for example does
some fast calculations without calling the RTL or the OS, it is more
likely that you can move that to VMS and link it to your VMS main object
module.
>> And whether the code has any explicit calls to VMS specific APIs.
In the above question the source code seems to be on Linux, so there may
be Linux specific APIs. If you have VMS specific APIs in your source on
Linux, you can compile it (that's what the IDE does for me before I move
the source to a VMS system), but you very likely can not link it: you
would need all the VMS object libraries and/or shareable images (at
least the global symbols table from the latter), which your linker on
Linux needs to understand and it needs to produce an x86_64 ELF image
with the VMS extensions.
> Once you have a compiler with a backend that will generate the VMS executable
> instead of an ELF executable, it should be no problem to build that compiler
> on Linux or VMS or whatever other OS you want to build it on.
This is probably known: The compiler usually generates objects, no
executables. And the backend, as I understand it, is the code generator,
not the linker. On Unix systems cc is often named a compiler driver. cc
can be used to run ld, the linker. So it may look like "cc -o hello
hello.c" invokes just a compiler, but it does more. At least the option
"-v" shows more.
That doesn't mean it would be impossible to build a cross compiler and a
cross linker for VMS on Linux. But it's more than just the compiler and
"no problem" may be too optimistic.
More information about the Info-vax
mailing list