GPC 20060325 + GCC 3.4.6 on AIX 6.1 (was: Re: GPC support for AIX 6?)

Gert Doering gd at medat.de
Tue Dec 8 17:00:41 CET 2009


Hi,

just to follow up on something from last year...  fully quoted to make
clear what I'm talking about - and for the sake of the archives.


On Wed, Oct 15, 2008 at 11:41:13PM +0200, Waldek Hebisch wrote:
> Gert Doering wrote:
> > Hi,
> > Well, if my understanding is correct, the GCC backend (code generation
> > and such) needs to support the platform in question.  Otherwise you can't
> > build GPC either.
> > 
> > Based on that understanding, I did not try to build a 3.4.x-based gpc on
> > APX 6 yet - as gcc-3.4.x itself isn't going to work.
> 
> AFAICS the "AIX 6 support" is the following patch:
> 
> http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01114.html
> 
> This patch fixes a bug in gcc build scripts: before patch build
> script would treat AIX 6 like some ancient AIX version which
> may have very bad results.  The patch effectively means that
> AXI 6 will be treated the same as AIX 5.  Given that, it is
> likely that building compiler on AIX 5 and transferring binary
> to AIX 6 will give you perfectly running compiler.  If you
> want to build on AIX 6 backporting the patch should be relatively
> easy.
> 
> Bottom line: trying to build unpatched earlier versions of gcc
> is likely to fail.  However, changes to gcc needed to work on AIX 6
> look trivial.


$Management has now decided to have me working on "GPC on AIX 6" again,
and I did some work with gcc-3.4.6 and gpc-20060325 today.

gcc-3.4.6 contains most of the patches contained in the mailing list
posting quited above already, so the patch does not apply.  It is not
needed, though - all that remains is one small bit in config.gcc:


------------------- snip --------------------
diff -wur gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc
--- gcc-3.4.6.orig/gcc/config.gcc	2005-07-19 23:08:48.000000000 +0200
+++ gcc-3.4.6/gcc/config.gcc	2009-12-08 14:51:51.000000000 +0100
@@ -1867,7 +1867,7 @@
 	thread_file='aix'
 	extra_headers=
 	;;
-rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
+rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].* | rs6000-ibm-aix )
 	tm_file="${tm_file} rs6000/aix.h rs6000/aix52.h rs6000/xcoff.h"
 	tmake_file=rs6000/t-aix52
 	use_collect2=yes
------------------- snip --------------------


(for some weird reason, AIX 6 is detected by configure as "rs6000-ibm-aix",
without any version number.  But hey, the resulting pascal and C compiler 
work, so who am I to complain...)


There's two further hickups in building GPC itself, one is that
"mk-t-inc" doesn't like AIX sed but works fine with GNU sed, the other
one is that gpidump.pas references a few symbols that I couldn't find 
anywhere.  So I commented them out...

------------------- snip --------------------
diff -u -w --recursive gpc-20060325.orig/p/utils/gpidump.pas gpc-20060325/p/utils/gpidump.pas
--- gpc-20060325.orig/p/utils/gpidump.pas	2006-03-24 03:47:16.000000000 +0100
+++ gpc-20060325/p/utils/gpidump.pas	2009-12-08 15:18:22.000000000 +0100
@@ -746,7 +746,9 @@
                            OutputFlag ('method');
                            IsMethod := True
                          end;
+{
           OPERATOR_DECL: OutputFlag ('also_built_in');
+}
           else           OutputFlag ('!lang_decl_flag_5')
         end;
       if f.decl_flag_6 then
@@ -875,7 +877,7 @@
         WriteLn
       end;
     First := True;
-    if not (TreeCode in [IDENTIFIER_NODE, INTERFACE_NAME_NODE, TREE_LIST]) then Flags;
+    if not (TreeCode in [IDENTIFIER_NODE, TREE_LIST]) then Flags;
     ClassDone := False;
     IsMethod := False;
     IsPackedAccess := False;
@@ -928,12 +930,14 @@
            end;
     end;
     case TreeCode of
+{
       INTERFACE_NAME_NODE:
                         begin
                           Str ('interface ');
                           Str ('module ');
                           Write (', checksum ', Number (GetNumber (Pos1), 0))
                         end;
+}
       IDENTIFIER_NODE:  begin
                           Str ('');
                           if OptStr ('spelling ') then
@@ -944,6 +948,7 @@
                               Write (':', GetNumber (Pos1))
                             end
                         end;
+{
       IMPORT_NODE:      begin
                           Ref ('interface');
                           OptRef ('qualifier');
@@ -955,6 +960,7 @@
                             else Error (', invalid `qualified'' value')
                           end
                         end;
+}
       TREE_LIST:        for i := 1 to GetNumber (Pos1) do
                           begin
                             if (i mod 10 = 1) and (i > 1) then
@@ -1163,7 +1169,9 @@
                           Ref ('initial');
                           Discard (OptStr ('linker_name '))
                         end;
+{
       OPERATOR_DECL:    ;
+}
       PLACEHOLDER_EXPR: Ref ('type');
       NON_LVALUE_EXPR:  if IsPackedAccess then Ref ('packed_info');
       else              if not ClassDone 
diff -u -w --recursive gpc-20060325.orig/p/utils/mk-t-inc gpc-20060325/p/utils/mk-t-inc
--- gpc-20060325.orig/p/utils/mk-t-inc	2006-03-25 01:28:56.000000000 +0100
+++ gpc-20060325/p/utils/mk-t-inc	2009-12-08 15:09:23.000000000 +0100
@@ -44,7 +44,7 @@
 
 GCCDIR="$1"
 
-version="`grep version_string "$GCCDIR/version.c" | sed -e 's/[^"]*"//;s/".*//'`"
+version="`grep version_string "$GCCDIR/version.c" | gsed -e 's/[^"]*"//;s/".*//'`"
 if [ x"$version" = x ]; then
   exit 1
 fi
@@ -62,15 +62,15 @@
 EOF
 
 # Use result of GPC's config-lang.in
-sed -ne 's,#define\(.*\),{$define\1},p' ../../gcc-version.h
+gsed -ne 's,#define\(.*\),{$define\1},p' ../../gcc-version.h
 
-sed -ne '/Start GPI info/,/End GPI info/{s,/\*.*\*/,,g;s/0x/$/g;s/#/{$/g;s/[^\]$/&}/;s/\\$//;p;}' "$GCCDIR/p/module.c"
+gsed -ne '/Start GPI info/,/End GPI info/{s,/\*.*\*/,,g;s/0x/$/g;s/#/{$/g;s/[^\]$/&}/;s/\\$//;p;}' "$GCCDIR/p/module.c"
 echo '{$endif}'
 echo ""
 
 {
   cat "$GCCDIR/tree.def"
   echo 'DEFTREECODE (LAST_AND_UNUSED_C_TREE_CODE, "unused", '"'x', 0)"
-  sed -e '/#ifdef EGCS/,${/#ifdef EGCS/d;/#else/,/#endif/d}'  "$GCCDIR/p/p-tree.def"
-} | sed -ne ':loop;/\\$/{N;b loop};/^DEFTREECODE/{s,/\*.*\*/,,;s/["'"'"']x["'"'"'].*/'"'x', 0)/;p;};/^#/p"
+  gsed -e '/#ifdef EGCS/,${/#ifdef EGCS/d;/#else/,/#endif/d}'  "$GCCDIR/p/p-tree.def"
+} | gsed -ne ':loop;/\\$/{N;b loop};/^DEFTREECODE/{s,/\*.*\*/,,;s/["'"'"']x["'"'"'].*/'"'x', 0)/;p;};/^#/p"
 } > "$2" || { rm -f "$2"; false; }
------------------- snip --------------------


The problem that remains now is the "collect2" bit that was discussed
on this list a long while ago, but yet-unresolved...

gd at hilb31:/tmp> gpc -o hello hello.pas
gd at hilb31:/tmp> gpc -fno-unit-path -o hello hello.pas
cc1: warning: command line option "-fno-unit-path" is valid for Pascal but not for C

(this is just a warning, but upsets "make check")


Waldek, in last year's "GPC on AIX 6" thread you mentioned a new GPC
version, gpc-20070904.  I think it might be worthwile to start hacking
on this (to get the option passing to collect2 fixed) before I work on
the older version.  Is gpc-20070904 the latest version?  If yes, where
can I find it?  http://www.gnu-pascal.de only lists the 20060325
version.

Who is rolling GPC "alpha releases" these days anyway?

thanks,

gert


-- 
MEDAT Computer-Systeme GmbH     +---------------------------------------------
Albrecht. 14                    | HRB Muenchen 56 206,  USt-IdNr. DE129411894
D-80636 Muenchen                | Geschaeftsfuehrer:
Tel: +49 89 126808-0            |        -  Dr. Peter-K. Escher-Vetter
Fax: +49 89 126808-50           |        -  Dipl.-Ing- Erwin Mayr
M: g.doering at medat.de           +





More information about the Gpc mailing list