2

In the IBM environment a hybrid C / Assembler compiler call Metal C exists and it permits C source programs to be intermixed with Assembler source programs and compiled as an executable.

My question is this, ignoring all the external linkage references that the resultant executable might have for a moment, could the combined C / Assembler executable run on a z/Linux platform, its just machine instructions, right?

jdftwrth
  • 45
  • 5
  • If you run Linux on Z/Architecture, I don't see why it shouldn't be possible. Of course, you would have to change all library and system calls appropriately. I believe some advanced features of the architecture (memory keys, channel programs) might not be available to user programs running on Linux. – fuz Mar 22 '21 at 16:11
  • Just to clarify, you don't mean a random ARM or x86 Linux platform, but Linux on Z? – MSalters Mar 22 '21 at 16:11
  • 1
    BTW, under Linux, you don't need special tools to link C and asm sources into one executable, like `gcc -O2 main.c foo.S -o bar` is totally normal. – Peter Cordes Mar 22 '21 at 16:13
  • 1
    You compile for a specific combination of hardware platform **and** operating system. If you change one, or both, you have to recompile, at least. You may also have to adjust the source code, because system interfaces may be different. System interfaces on z/OS *are* completely different to those on Linux, so binaries are not portable. – phunsoft Mar 22 '21 at 18:38

1 Answers1

3

The underlying Operating System and its associated call stack determines compatibility. z/OS uses a specific calling convention, system calls and libraries that are fundamentally different than Linux. Thus they are not binary compatible.

That said, if you are using languages that are available on both platforms then you may be able to simply recompile and "port" your application.

Hogstrom
  • 3,581
  • 2
  • 9
  • 25