public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: mutazilah@gmail.com (Paul Edwards)
Cc: Ulrich.Weigand@de.ibm.com (Ulrich Weigand), gcc@gcc.gnu.org
Subject: Re: i370 port - constructing compile script
Date: Thu, 22 Oct 2009 19:26:00 -0000	[thread overview]
Message-ID: <200910221803.n9MI33he012461@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <97E4D5A416C642019A7BA7A7DAA48820@Paullaptop> from "Paul Edwards" at Oct 22, 2009 05:57:13 PM

Paul Edwards wrote:

> Hi Ulrich.  I've had considerable success in this process.  I've
> now reached the point where I seem to have a correctly
> generated config.h in libiberty and correct auto-host.h in gcc,
> which is one of the aims in order to get an eventual link on
> MVS.

OK, good to hear you're making progress!

> Any suggestion on how to make this less intrusive?  Or
> perhaps is it logical to have a generic "trap at compile
> time instead of link time" configure option for other
> environments also?  Maybe we could have two variables,
> a BEFORE_AC_FUNC and AFTER_AC_FUNC which
> are defined in all those tests, and can be set to open
> comment and close comment + includes to achieve
> the above effect.

Well, this is generated from the AC_CHECK_FUNCS macro
in gcc/configure.ac.  This macro is implemented by the
autoconf infrastructure and appears to always use link
tests (most GCC-specific tests seem to be compile-only
tests, fortunately).

I guess it might be interesting to see whether this can
be replaced by compile-time tests, either by using a
different mechanism in gcc/configure.ac, or else by
overriding the AC_CHECK_FUNCS implementation in GCC's
aclocal.m4 macro set ...

Unfortunately, I'm not really an autoconf expert either.
Maybe someone else on the list is able to help with this.

> I was thinking that maybe what I should do is in the fake
> linker, see what the output executable is.  If the output
> executable is a conftest, then do a scan of the VCONs
> (external references) in the assembler making sure they
> are all C90.  But that seems to be the wrong approach to
> me.  If there's going to be a list of C90 functions and
> variables it should probably be in configure.ac I think.

This might also be an option.  I guess in principle your
"fake linker" might even be able to look at the target
libraries (either directly, or via a list of exported
symbols that is provided by some other tool) ...

> Speaking of which.  When I was putting in the intrusive
> code, I saw things like newlib and Vxworks which had
> explicit mention and explicit settings for various things.
> Perhaps I should be doing something like that too rather
> than faking things to get them through?  That would lower
> the barrier for an arbitrary and possibly complicated target
> with no extensions.

I don't see this is the main gcc/configure.  However, some
of the target libraries, in particular libiberty, do have
hard-coded results for certain platforms.  This might not
really be a bad idea ...

> A stack of C files in libiberty failed to compile, because they
> have extensions in them.  E.g. make-temp-file.c calls
> access().  I've never noticed them before because I've never
> included them in my links, because they are not required
> on MVS.  Even totally unrelated things like pex-unix.c are
> being compiled.  So what is the best way of switching the
> source code to compile?

Hmmm, the access() use probably needs to be guarded by a configure
check.  Or else you might provide a MVS-specific implementation of
"access" (if that is possible), and compile it into libiberty by
providing an EXTRA_OFILES setting in a host makefile fragment;
in 3.4 these are set in config.table:
case "${host}" in
  rs6000-ibm-aix3.1 | rs6000-ibm-aix)
                        frag=mh-aix ;;
  *-*-cxux7*)           frag=mh-cxux7 ;;
  *-*-freebsd2.1.*)     frag=mh-fbsd21 ;;
  *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
  i370-*-opened*)       frag=mh-openedition ;;
  i[34567]86-*-windows*)        frag=mh-windows ;;
esac

As to the pex-unix.c, you certainly should provide a MVS-specific
version of the PEX callbacks.  They are selected in configure.ac:

# Figure out which version of pexecute to use.
case "${host}" in
     *-*-mingw* | *-*-winnt*)   pexecute=pex-win32.o  ;;
     *-*-msdosdjgpp*)           pexecute=pex-djgpp.o  ;;
     *-*-msdos*)                pexecute=pex-msdos.o  ;;
     *-*-os2-emx*)              pexecute=pex-os2.o    ;;
     *)                         pexecute=pex-unix.o   ;;
esac

Your MVS version might be just a dummy that always fails.
Even better would be a version that actually works; in this
case all the "single-exectuable" hacks would become superfluous.

Note that e.g. pex-msdos.c implements the required callbacks
solely in terms of the C99 "system" routine.  If you at least
have this facility available on MVS, you might be able to just
use the msdos version?

> Finally, even with this in place, the build process stopped at
> the next roadblock.  The file "genmodes.c" couldn't be
> compiled.  I was surprised to see that it was being compiled
> with i370-mvspdp-gcc.  The genmodes "needs" to be run on
> Unix still.  It's only the source code that IT generates that
> needs to be cross-compiled.

If this happens, then something went very wrong during configure.
Did you make sure to use the proper build / host / target flags?
In particular, the --build= configure argument must be present
and refer to the build architecture.  This is used to determine
which architecture to build the generator programs for.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2009-10-22 18:03 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF0A51B575.29A29744-ON42257656.0067E35B-42257656.00682411@de.ibm.com>
2009-10-22  9:06 ` Paul Edwards
2009-10-22 19:26   ` Ulrich Weigand [this message]
2009-10-22 22:04     ` Paul Edwards
2009-10-23 14:36     ` Paul Edwards
2009-10-23 14:58       ` Ian Lance Taylor
2009-10-23 15:16       ` Ulrich Weigand
2009-10-24  0:20         ` Paul Edwards
2009-10-24  4:11           ` Ulrich Weigand
2009-10-27 12:18             ` Paul Edwards
2009-11-02 14:45 Paul Edwards
  -- strict thread matches above, loose matches on Subject: below --
2009-09-25 15:20 i370 port Ulrich Weigand
2009-09-30 17:24 ` i370 port - constructing compile script Paul Edwards
2009-09-30 17:36   ` Richard Henderson
2009-09-30 21:40     ` Paul Edwards
     [not found]       ` <mcrpr98x9w8.fsf@dhcp-172-17-9-151.mtv.corp.google.com>
2009-10-01  0:16         ` Joseph S. Myers
2009-10-01 14:00           ` Paul Edwards
2009-10-02 12:41           ` Paul Edwards
2009-10-02 16:00             ` Ian Lance Taylor
2009-10-02 22:53               ` Paul Edwards
2009-10-04  4:11                 ` Ian Lance Taylor
2009-10-04  5:14                   ` Paul Edwards
2009-10-04  6:04                     ` Ian Lance Taylor
2009-10-04  6:50                       ` Paul Edwards
2009-10-04 15:38                         ` Ulrich Weigand
2009-10-04 22:51                           ` Paul Edwards
2009-10-05 13:15                             ` Ulrich Weigand
2009-10-06  9:32                               ` Paul Edwards
2009-10-06 13:15                                 ` Ulrich Weigand
2009-10-06 13:38                                   ` Paul Edwards
2009-10-06 14:01                                     ` Ulrich Weigand
2009-10-14 14:33                                       ` Paul Edwards
2009-10-19 14:19                               ` Paul Edwards
2009-10-19 17:37                                 ` Ulrich Weigand
2009-10-20 14:18                                   ` Paul Edwards
2009-10-20 15:30                                     ` Ulrich Weigand
2009-11-12 14:03                                   ` Paul Edwards
2009-11-12 20:06                                     ` Ralf Wildenhues
2009-11-12 20:56                                       ` Paul Edwards
2009-11-13 11:43                                       ` Paul Edwards
2009-11-13 12:01                                         ` Ulrich Weigand
2009-11-13 12:18                                           ` Paul Edwards
2009-11-13 12:57                                             ` Ulrich Weigand
2009-11-14  8:52                                               ` Paul Edwards
2009-11-14 10:49                                                 ` Ralf Wildenhues
2009-11-14 11:28                                                   ` Paul Edwards
2009-11-22  0:51                                                     ` Paolo Bonzini
2009-11-18 10:51                                                   ` Paul Edwards
2009-11-19 14:27                                                     ` Ulrich Weigand
2009-11-21 13:40                                                       ` Paul Edwards
2009-11-22  0:46                                         ` Paolo Bonzini
2009-11-13 12:08                                     ` Ulrich Weigand
2009-10-05 13:17                         ` Michael Matz
2009-10-05 13:38                           ` Paul Edwards
2009-10-05 13:46                             ` Michael Matz
2009-10-01 14:28   ` Paul Brook
2009-10-01 16:00     ` Paul Edwards
2009-10-01 18:36       ` Ian Lance Taylor
2009-10-01 23:43         ` Paul Edwards
2009-10-01 21:10       ` David Edelsohn
2009-10-01 22:22         ` Toon Moene
2009-10-02  0:19           ` Paul Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200910221803.n9MI33he012461@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mutazilah@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).