retroprom / mvsgcc

[Patches] Build system for MVS GCC
GNU General Public License v2.0
3 stars 2 forks source link

Need help building #1

Open mgrossmann opened 3 years ago

mgrossmann commented 3 years ago

Hallo,

I fail in building the project:

root@7fa80e6a212e:~/mvsgcc# make
mkdir -p out/i370-mvs-cross
gcc -std=c99 -m32 -g -O2 -pedantic -I include -I gcc -I gcc/config/i370 -DMVSGCC_CROSS -DIN_GCC -DHAVE_CONFIG_H -DPUREISO -DTARGET_MVS -c -o out/i370-mvs-cross/alias.o gcc/alias.c
In file included from gcc/config/i370/pureiso.h:8,
                 from gcc/config/i370/mvspdp.h:51,
                 from gcc/config.h:624,
                 from gcc/alias.c:22:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
 #include <bits/libc-header-start.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:207: out/i370-mvs-cross/alias.o] Error 1

About help I would be very happy.

promovicz commented 3 years ago

Taking a look. Bare with me. :)

promovicz commented 3 years ago

It seems like either your libc is broken or the old mvsgcc depends on glibc.

What libc are you using?

promovicz commented 3 years ago

Also please check the updated README.

The makefile can currently only build cross-compilers.

mainframed commented 2 years ago

Hi, using this repo and https://github.com/robertapengelly92/pdos/tree/master/pdpclib i was able to get a version of gccmvs to build you can see here: https://github.com/mainframed/gccmvs

However, even though it builds I get a segfault at https://github.com/mainframed/gccmvs/blob/1c8fe6c9c6c78c69ee80860cc6cc70190fecc67c/gcc-3.2.3/gcc/tree-inline.c#L784 any ideas?

promovicz commented 2 years ago

@mainframed Not really. Random guess: try compiling with -m32.

It's been a while since I've hacked on this, but I had it at a point where I could generate assembly on a Linux host.

promovicz commented 2 years ago

I also investigated the possibility of adding a symbol mangler and mapper so that longer symbols can be used... it's definitely possible but I didn't actually do it. Further magic would be required to link, run and maybe debug the code on the mainframe side. But it should allow compiling things like... sqlite as a DB/2 replacement. Or even wilder things.

promovicz commented 2 years ago

@mainframed I have checked my working directory for this project. The state in this repo is the last thing I had, and the compiler it builds for me is at least able to compile the following factorial function to assembly.

I tried the following code ("factorial.c"):

int factorial(int n) {
  int c, f = 1;
  for (c = 1; c <= n; c++) {
    f = f * c;
  }
  return f;
}

This factorial code is just something I pasted from the interweb, but it does seem to work on the host:

$ cplr -i factorial.c 'printf("%d\n", factorial(5))'
120

Now running the mvs compiler:

$ out/i370-mvs-gcc -S factorial.c

Does at least yield some reasonable-looking asm:

         COPY  PDPTOP
         CSECT
* Program text area
         DS    0F
* X-func factorial prologue
FACTORIA PDPPRLG CINDEX=0,FRAME=104,BASER=12,ENTRY=YES
         B     FEN0
         LTORG
FEN0     EQU   *
         DROP  12
         BALR  12,0
         USING *,12
PG0      EQU   *
         LR    11,1
         L     10,=A(PGT0)
* Function factorial code
         MVC   92(4,13),=F'1'
         MVC   88(4,13),=F'1'
L2       EQU   *
         L     2,88(13)
         C     2,0(11)
         BNH   L5
         B     L3
L5       EQU   *
         MVC   100(4,13),88(13)
         L     2,96(13)
         L     3,4+96(13)
         M     2,92(13)
         ST    2,96(13)
         ST    3,4+96(13)
         MVC   92(4,13),100(13)
         L     3,88(13)
         A     3,=F'1'
         ST    3,88(13)
         B     L2
L3       EQU   *
         L     2,92(13)
         LR    15,2
* Function factorial epilogue
         PDPEPIL
* Function factorial literal pool
         DS    0F
         LTORG
* Function factorial page table
         DS    0F
PGT0     EQU   *
         DC    A(PG0)
         END
promovicz commented 2 years ago

@mainframed I see that there is a new patch. I can try rebasing that later. Don't expect a quick response though. 🙂

promovicz commented 2 years ago

@mainframed I've rebased my branch. Might give compiling pdpclib a try. Are you trying with pdpclib 3.10 or 4.00?

promovicz commented 2 years ago

@mainframed I've looked into this a little more, even though I didn't try compiling pdpclib yet. One possibility for where these problems might come from is that my build does not regenerate the generated source files of GCC. the BAT build does that. Implementing that might help.