From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25517 invoked by alias); 22 Oct 2009 06:57:59 -0000 Received: (qmail 25500 invoked by uid 22791); 22 Oct 2009 06:57:56 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f181.google.com (HELO mail-pz0-f181.google.com) (209.85.222.181) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Oct 2009 06:57:48 +0000 Received: by pzk11 with SMTP id 11so5310802pzk.14 for ; Wed, 21 Oct 2009 23:57:46 -0700 (PDT) Received: by 10.114.165.36 with SMTP id n36mr10434494wae.116.1256194666121; Wed, 21 Oct 2009 23:57:46 -0700 (PDT) Received: from Paullaptop (203-214-142-52.perm.iinet.net.au [203.214.142.52]) by mx.google.com with ESMTPS id 23sm310857pxi.9.2009.10.21.23.57.41 (version=SSLv3 cipher=RC4-MD5); Wed, 21 Oct 2009 23:57:44 -0700 (PDT) Message-ID: <97E4D5A416C642019A7BA7A7DAA48820@Paullaptop> From: "Paul Edwards" To: "Ulrich Weigand" Cc: References: In-Reply-To: Subject: Re: i370 port - constructing compile script Date: Thu, 22 Oct 2009 09:06:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg00445.txt.bz2 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. >> However, it meant that I could look at the auto-host.h and >> see what it had come up with. It correctly figured out that >> I didn't have a raft of header files, but still thought I had >> lots of functions like fork() and getrusage(). >> >> I suspect that is because my fake compiler is compiling >> with the "-S' option and returning success when it's after >> a link failure. > OK. I thought with the fake as and ld scripts, you should > no longer need a "fake compiler" script? I haven't got to the stage of playing around with that yet. > But even so, you're right that the "fake linker" will not > actually check whether symbols are present in your > library ... >> I had an idea - maybe I can have warnings switched on >> for functions without prototypes, and then my dummy >> compiler trap the output and do a "wc" and if there's >> an unexpectedly high number of lines, then it can exit >> with failure. > Or simply use -Werror when doing test compiles in > configure. Turns out that -Werror-implicit-function-declaration wasn't sufficient. Because "configure" dutifully goes and inserts its own declaration for the non-existant functions! However, more intrusive code: + #if !defined(__MVS__) char $ac_func (); + #else + #include + #include + #include + #include + #include + #include + #endif got past that problem, such that I could get the config file I needed. I needed to put in the standard includes, otherwise it thought that I didn't even have memcmp! 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. Or maybe I should simply pass over the configure script doing that substitution, since the string to search for is unique and consistent, ie grep "^char \$ac_func" configure char $ac_func (); /* The GNU C library define to always fail with ENO something starting with #if defined (__stub_$ac_fun choke me #else char (*f) () = $ac_func; 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. 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. However, let's stay on the current track, so that e.g. this could be used to target mvsdignus, which probably does have various extensions, and they may wish to make use of them in their MVS build. Thus, it needs to go through the detection process. Assuming that detection process has worked, and the config.h file is correctly set, then I run into the next problem. 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? It is at this stage that I wish to create a single executable, so would want the fake linker to do a tar or zip. (or simply an echo, I'm flexible on that). So those failing files would presumably be omitted from that anyway? Or are they normally unconditionally compiled and linked? 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. Regardless, genmodes.c didn't compile because auto-build.h correctly detected that my Unix system has etc, but my own header files don't have that, so a cross compile doesn't work. How does that normally work when cross-compiling a host? BTW, I really like the idea of the fake linker zipping up all the generated assembler as it goes through, which is ultimately what I need to send up to MVS. The JCL can be generated from "unzip -v" as an entirely separate, and unobtrusive, process. Thanks for all your assistance in getting this set up. It seems there is light at the end of the tunnel for getting this properly integrated into the normal build process. :-) BFN. Paul. Index: gcc/configure =================================================================== RCS file: /cvsroot/gccnew/gcc/configure,v retrieving revision 1.1.1.1 retrieving revision 1.10 diff -c -r1.1.1.1 -r1.10 *** gcc/configure 9 Jul 2009 00:25:05 -0000 1.1.1.1 --- gcc/configure 21 Oct 2009 21:41:11 -0000 1.10 *************** *** 2463,2470 **** /* end confdefs.h. */ #include #include ! #include ! #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); --- 2463,2470 ---- /* end confdefs.h. */ #include #include ! /*#include ! #include */ /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); *************** *** 3377,3383 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3377,3383 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 3448,3454 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3448,3454 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 3519,3525 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3519,3525 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 3590,3596 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3590,3596 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 3662,3668 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3662,3668 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 3735,3741 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! #include int --- 3735,3741 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "confdefs.h" ! /*#include */ int *************** *** 5656,5662 **** if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF ! #define TIME_WITH_SYS_TIME 1 _ACEOF fi --- 5656,5662 ---- if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF ! /*#define TIME_WITH_SYS_TIME 1*/ _ACEOF fi *************** *** 6150,6157 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include ! #include int main () { --- 6150,6160 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include ! #include */ ! #define BIG_ENDIAN 1 ! #define LITTLE_ENDIAN 2 ! #define BYTE_ORDER 1 int main () { *************** *** 6192,6199 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include ! #include int main () { --- 6195,6205 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include ! #include */ ! #define BIG_ENDIAN 1 ! #define LITTLE_ENDIAN 2 ! #define BYTE_ORDER 1 int main () { *************** *** 6731,6738 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include ! #include int main () { --- 6737,6744 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include ! #include */ int main () { *************** *** 6851,6857 **** #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ! char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ --- 6857,6863 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ! /*char $ac_func ();*/ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 7051,7057 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | --- 7057,7063 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include */ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | *************** *** 7093,7099 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ ! #include #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) --- 7099,7105 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ ! /*#include */ #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) *************** *** 7303,7311 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include #include ! #include #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON --- 7309,7317 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include #include ! #include */ #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON *************** *** 7570,7576 **** #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ! char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ --- 7576,7582 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ! /*char $ac_func ();*/ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 7644,7650 **** else cat >conftest.$ac_ext <<_ACEOF /* By Ruediger Kuhlmann. */ ! #include #if HAVE_UNISTD_H # include #endif --- 7650,7656 ---- else cat >conftest.$ac_ext <<_ACEOF /* By Ruediger Kuhlmann. */ ! /*#include */ #if HAVE_UNISTD_H # include #endif *************** *** 7717,7725 **** /* Thanks to Paul Eggert for this test. */ #include #include ! #include #include ! #include #if HAVE_UNISTD_H # include #endif --- 7723,7731 ---- /* Thanks to Paul Eggert for this test. */ #include #include ! /*#include #include ! #include */ #if HAVE_UNISTD_H # include #endif *************** *** 8998,9004 **** cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include #ifdef HAVE_SYS_STAT_H # include #endif --- 9004,9010 ---- cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include */ #ifdef HAVE_SYS_STAT_H # include #endif Index: libiberty/argv.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/argv.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -c -r1.1.1.2 -r1.2 *** libiberty/argv.c 9 Jul 2009 00:27:13 -0000 1.1.1.2 --- libiberty/argv.c 21 Oct 2009 22:40:29 -0000 1.2 *************** *** 48,55 **** #endif /* ANSI_PROTOTYPES */ ! #if defined PUREISO ! extern char *strdup (); /* Duplicate a string */ #endif #ifndef NULL --- 48,55 ---- #endif /* ANSI_PROTOTYPES */ ! #if !defined(HAVE_STRDUP) ! extern char *strdup (); /* Duplicate a string */ #endif #ifndef NULL Index: libiberty/choose-temp.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/choose-temp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** libiberty/choose-temp.c 9 Jul 2009 00:25:05 -0000 1.1.1.1 --- libiberty/choose-temp.c 21 Oct 2009 23:32:54 -0000 1.2 *************** *** 53,58 **** --- 53,59 ---- */ + #if !defined(PUREISO) char * choose_temp_base () { *************** *** 70,72 **** --- 71,74 ---- abort (); return temp_filename; } + #endif Index: libiberty/configure =================================================================== RCS file: /cvsroot/gccnew/libiberty/configure,v retrieving revision 1.1.1.1 retrieving revision 1.14 diff -c -r1.1.1.1 -r1.14 *** libiberty/configure 9 Jul 2009 00:25:05 -0000 1.1.1.1 --- libiberty/configure 22 Oct 2009 03:02:06 -0000 1.14 *************** *** 274,279 **** --- 274,284 ---- # Factoring default headers for most tests. ac_includes_default="\ #include + #include + #include + #include + #include + #include #if HAVE_SYS_TYPES_H # include #endif *************** *** 3110,3117 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include ! #include int main () { --- 3115,3125 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include ! #include */ ! #define BIG_ENDIAN 1 ! #define LITTLE_ENDIAN 2 ! #define BYTE_ORDER 1 int main () { *************** *** 3143,3150 **** cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! #include ! #include int main () { --- 3151,3161 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ ! /*#include ! #include */ ! #define BIG_ENDIAN 1 ! #define LITTLE_ENDIAN 2 ! #define BYTE_ORDER 1 int main () { *************** *** 4163,4169 **** --- 4174,4189 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ + #if !defined(__MVS__) char $ac_func (); + #else + #include + #include + #include + #include + #include + #include + #endif /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 4424,4429 **** --- 4444,4457 ---- libiberty_cv_var_sys_errlist=yes ;; + *-*-mvs*) + # MVS has no extensions + ac_cv_func_vfork_works=no + libiberty_cv_var_sys_nerr=no + libiberty_cv_var_sys_errlist=no + libiberty_cv_var_sys_siglist=no + ;; + *-*-*vms*) # Under VMS, vfork works very different than on Unix. The standard test # won't work, and it isn't easily adaptable. It makes more sense to *************** *** 4590,4596 **** --- 4618,4633 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ + #if !defined(__MVS__) char $ac_func (); + #else + #include + #include + #include + #include + #include + #include + #endif /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 4926,4932 **** --- 4963,4971 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ + #if !defined(__MVS__) char $ac_func (); + #endif /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 5256,5262 **** --- 5295,5303 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ + #if !defined(__MVS__) char $ac_func (); + #endif /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ *************** *** 5555,5561 **** --- 5596,5611 ---- #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ + #if !defined(__MVS__) char $ac_func (); + #else + #include + #include + #include + #include + #include + #include + #endif /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ Index: libiberty/fdmatch.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/fdmatch.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -c -r1.1.1.2 -r1.2 *** libiberty/fdmatch.c 9 Jul 2009 00:27:10 -0000 1.1.1.2 --- libiberty/fdmatch.c 21 Oct 2009 23:32:54 -0000 1.2 *************** *** 53,58 **** --- 53,59 ---- #include #endif + #if !defined(PUREISO) int fdmatch (fd1, fd2) int fd1; int fd2; *************** *** 72,74 **** --- 73,76 ---- return (0); } } + #endif Index: libiberty/getpwd.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/getpwd.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -c -r1.1.1.2 -r1.2 *** libiberty/getpwd.c 9 Jul 2009 00:27:12 -0000 1.1.1.2 --- libiberty/getpwd.c 21 Oct 2009 23:32:54 -0000 1.2 *************** *** 65,70 **** --- 65,71 ---- to the user. Yield the working directory if successful; otherwise, yield 0 and set errno. */ + #if !defined(PUREISO) char * getpwd () { *************** *** 105,110 **** --- 106,112 ---- } return p; } + #endif #else /* VMS || _WIN32 && !__CYGWIN__ */ Index: libiberty/make-relative-prefix.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/make-relative-prefix.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** libiberty/make-relative-prefix.c 9 Jul 2009 00:25:05 -0000 1.1.1.1 --- libiberty/make-relative-prefix.c 22 Oct 2009 03:20:40 -0000 1.2 *************** *** 222,227 **** --- 222,228 ---- If no relative prefix can be found, return NULL. */ + #if !defined(__MVS__) char * make_relative_prefix (progname, bin_prefix, prefix) const char *progname; *************** *** 394,396 **** --- 395,398 ---- return ret; } + #endif Index: libiberty/make-temp-file.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/make-temp-file.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -c -r1.1.1.2 -r1.2 *** libiberty/make-temp-file.c 9 Jul 2009 00:27:12 -0000 1.1.1.2 --- libiberty/make-temp-file.c 22 Oct 2009 03:20:40 -0000 1.2 *************** *** 57,62 **** --- 57,63 ---- #define TEMP_FILE "ccXXXXXX" #define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1) + #if !defined(__MVS__) /* Subroutine of choose_tmpdir. If BASE is non-NULL, return it. Otherwise it checks if DIR is a usable directory. *************** *** 179,181 **** --- 180,183 ---- abort (); return temp_filename; } + #endif Index: libiberty/pex-unix.c =================================================================== RCS file: /cvsroot/gccnew/libiberty/pex-unix.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** libiberty/pex-unix.c 9 Jul 2009 00:25:05 -0000 1.1.1.1 --- libiberty/pex-unix.c 22 Oct 2009 03:20:40 -0000 1.2 *************** *** 47,52 **** --- 47,53 ---- extern int execv (); extern int execvp (); + #if !defined(__MVS__) int pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) const char *program; *************** *** 164,166 **** --- 165,168 ---- pid = waitpid (pid, status, 0); return pid; } + #endif