Nekochan Net

Official Chat Channel: #nekochan // irc.nekochan.net
It is currently Fri Aug 01, 2014 10:32 pm

All times are UTC - 8 hours


Forum rules


Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
Unread postPosted: Fri Jan 30, 2009 6:24 pm 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
Here is a test, it's standard hello world stuff but with different combinations of compilation and linking. Can you try running the results on an ANS box, if those fail try and link following my examples from the makefile.

The make.out shows important dump -H results...

Code:
        /opt/TWWfsw/gcc343/bin/gcc -c hello.c -o hello-aix.o
        /opt/TWWfsw/gcc343/bin/gcc hello-aix.o -o hello-aix
        dump -H hello-aix

hello-aix:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000011       0x00000073       0x00000097

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000002       0x0000071c       0x00000025       0x000007b3


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /opt/TWWfsw/gcc343/lib/gcc/powerpc-ibm-aix4.3.3.0/3.4.3:/opt/TWWfsw/gcc343/lib/gcc/powerpc-ibm-aix4.3.3.0/3.4.3/../../..:/usr/lib:/lib                   
1                                    libc.a              shr.o
        ld  /usr/ccs/lib/crt0.o hello-aix.o -lc -o hello-aix-ld
        dump -H hello-aix-ld

hello-aix-ld:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000006       0x0000000f       0x0000001e

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000002       0x00000164       0x0000000d       0x00000182


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /usr/lib:/lib
1                                    libc.a              shr.o
        /opt/TWWfsw/gcc343/bin/gcc -I/home/ans/powerpc-ibm-aix4.1.5.0/include -c hello.c -o hello-ans.o
        ld  /home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib/crt0.o hello-ans.o -L/home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib -lc -o hello-ans-ld
        dump -H hello-ans-ld

hello-ans-ld:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000004       0x0000000b       0x00000047

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000002       0x00000104       0x00000000       0x00000000


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib:/usr/lib:/lib                   
1                                    libc.a              shr.o
        /opt/TWWfsw/gcc343/bin/gcc -nostdlib /home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib/crt0.o hello-ans.o -o hello-ans -L/home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib -lc
        dump -H hello-ans

hello-ans:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000004       0x0000000b       0x000000c0

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000002       0x00000104       0x00000000       0x00000000


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /home/ans/powerpc-ibm-aix4.1.5.0/ccs/lib:/opt/TWWfsw/gcc343/lib/gcc/powerpc-ibm-aix4.3.3.0/3.4.3:/opt/TWWfsw/gcc343/lib/gcc/powerpc-ibm-aix4.3.3.0/3.4.3/../../..:/usr/lib:/lib
1                                    libc.a              shr.o
Target "all" is up to date.


Attachments:
ans.tar [280 KiB]
Downloaded 5 times

_________________
Land of the Long White Cloud and no Software Patents.
Top
 Profile  
 
Unread postPosted: Sat Jan 31, 2009 7:05 pm 
Offline
User avatar

Joined: Wed Jun 07, 2006 3:37 pm
Posts: 343
Code:
195$ ls hello*[!oc]     
hello-aix*     hello-aix-ld*  hello-ans*     hello-ans-ld*
196$ for prog in hello*[!oc]; do ./$prog; done
exec(): 0509-036 Cannot load program ./hello-aix because of the following errors:
        0509-023 Symbol __mod_init in ksh is not defined.
        0509-023 Symbol __crt0v in ksh is not defined.
        0509-026 System error: Cannot run a file that does not have a valid format.
exec(): 0509-036 Cannot load program ./hello-aix-ld because of the following errors:
        0509-023 Symbol __mod_init in ksh is not defined.
        0509-023 Symbol __crt0v in ksh is not defined.
        0509-026 System error: Cannot run a file that does not have a valid format.
Hello World
Hello World

_________________
Principle Over Politics : http://www.ConstitutionParty.org


Top
 Profile  
 
Unread postPosted: Sat Jan 31, 2009 10:36 pm 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
So only the two that were explicitly linked with the 4.1.5 objects and libraries worked. That's cool.

_________________
Land of the Long White Cloud and no Software Patents.


Top
 Profile  
 
Unread postPosted: Thu Feb 05, 2009 4:54 pm 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
After much fighting, I have managed to build xgcc, aka the bootstap compiler.

I used the headers and libraries from 4.1.5, and used a gcc 3.4.3 compiler on AIX 4.3.2 to compile gcc 3.4.6. I wrote a wrapper for "cc" that did alot of fudging to get the builds to work.

This would be a good time for somebody to then take what I have done and build the remainder on a real AIX 4.1.5 box.

Chris, are you game? How would you like to receive what I have done so far?

The cc wrapper wot I wrote:

Code:
#!/bin/sh

ARGS_IN=$@
CMD=$0
GCC="/opt/TWWfsw/gcc343/bin/gcc -g"

echo $CMD $ARGS_IN >>$HOME/cc.log

PLATFORM=powerpc-ibm-aix4.1.5.0
ANS_USR=/home/ans/powerpc-ibm-aix4.1.5.0
ANS_CRT0=$ANS_USR/ccs/lib/crt0.o
ANS_ALLOC=$ANS_USR/ccs/lib/bmalloc.o
ANS_LIBS="-L$ANS_USR/ccs/lib -L/home/porter/lib -lgcc -lgcc_eh -lpthreads"
ANS_INC="-I$ANS_USR/include"

HAS_C_OPT=false
SOURCE_FILES=
OUTPUT_FILE=
OBJECT_FILES=
LIBLIST=
DIRLIST=
DEFINES=
INCLIST=
GCCFLAGS=

LAST_FLAG=

first()
{
        echo $1
}

split()
{
        echo $@ | sed y/./\ /
}

objfile()
{
        for f in $@
        do
                k=`dirname $f`
                l=`basename $f`
                m=`split $l`
                n=`first $m`

                echo $n.o
        done
}

for e in $ARGS_IN
do
        if test "$LAST_FLAG" = ""
        then
                case "$e" in
                -c )
                        HAS_C_OPT=true
                        ;;
                -g )
                        ;;
                -E* )
                        exec $GCC $ARGS_IN $ANS_INC
                        ;;
                -print-prog-name=* | -print-multi-os-directory )
                        $GCC $ARGS_IN >>$HOME/cc.log
                        exec $GCC $ARGS_IN
                        ;;
                -L | -l | -D | -o )
                        LAST_FLAG=$e
                        ;;
                -D* )
                        DEFINES="$DEFINES $e"
                        ;;
                -L* )
                        DIRLIST="$DIRLIST $e"
                        ;;
                -I* )
                        INCLIST="$INCLIST $e"
                        ;;
                -l* )
                        LIBLIST="$LIBLIST $e"
                        ;;
                *.c )
                        SOURCE_FILES="$SOURCE_FILES $e"
                        ;;
                *.o | *.a )
                        OBJECT_FILES="$OBJECT_FILES $e"
                        ;;
                -W* )
                        GCCFLAGS="$GCCFLAGS $e"
                        ;;
                -pedantic )
                        ;;
                * )
                        echo 1>&2 $CMD: unknown flag $e
                        exit 1
                        ;;
                esac
        else
                case "$LAST_FLAG" in
                -o )
                        OUTPUT_FILE="$e"
                        ;;
                -L )
                        DIRLIST="$DIRLIST -L$e"
                        ;;
                -I )
                        INCLIST="$INCLIST -I$e"
                        ;;
                -D )
                        DEFINES="$DEFINES -I$e"
                        ;;
                -l )
                        LIBLIST="$LIBLIST -l$e"
                        ;;
                * )
                        echo 1>&2 $CMD: unknown flag $LAST_FLAG $e
                        exit 1
                        ;;
                esac
                LAST_FLAG=
        fi
done

if $HAS_C_OPT
then
        for d in SOURCE_FILES
        do
                if test "$OUTPUT_FILE" = ""
                then
                        OUTPUT_OBJ=`objfile $SOURCE_FILES`
                else
                        OUTPUT_OBJ="$OUTPUT_FILE"
                fi

                if test "$OUTPUT_OBJ" = ""
                then
                        echo $CMD: cant get objfile name $SOURCE_FILES
                        exit 1
                fi

                NEW_CMD="$GCC -c $SOURCE_FILES -o $OUTPUT_OBJ $GCCFLAGS $DEFINES $INCLIST $ANS_INC"

                echo $NEW_CMD >>$HOME/cc.log
                $NEW_CMD

                RC=$?
                if test "$RC" != 0
                then
                        exit $RC
                fi
        done
else
        RC=0
        TMPOBJS=

        for d in $SOURCE_FILES
        do
                OBJFILE=`objfile $d`
                NEW_CMD="$GCC -c $d -o $OBJFILE $GCCFLAGS $DEFINES $INCLIST $ANS_INC"
                echo $NEW_CMD >>$HOME/cc.log
                $NEW_CMD
                RC=$?
                if test "$RC" = "0"
                then
                        TMPOBJS="$TMPOBJS $OBJFILE"
                else
                        break
                fi
        done

        if test "$RC" = 0
        then
                if test "$OUTPUT_FILE" = ""
                then
                        OUTPUT_FILE=a.out
                fi

                NEW_CMD="ld -bbigtoc -o $OUTPUT_FILE $ANS_CRT0 $OBJECT_FILES $TMPOBJS $DIRLIST $ANS_LIBS $LIBLIST -lm -lc -blibpath:/usr/lib/threads:/usr/lib:/lib"
                echo $NEW_CMD >>$HOME/cc.log
                $NEW_CMD
                RC=$?
        fi

        exit $RC
fi

_________________
Land of the Long White Cloud and no Software Patents.


Top
 Profile  
 
Unread postPosted: Thu Feb 05, 2009 5:06 pm 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
Also, dumps of the bootstrap compiler...

Code:
bash-2.04$ dump -H cc1

cc1:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x0000006b       0x00005f23       0x00000057

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000004       0x00047fcc       0x000000c4       0x00048023


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /usr/lib/threads:/usr/lib:/lib
1                                    libc.a              shr.o
2                                    libpthreads.a       shr.o
3                                    libiconv.a          shr4.o

bash-2.04$ dump -H xgcc

xgcc:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000053       0x0000047d       0x00000057

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000004       0x00003dc4       0x00000083       0x00003e1b


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /usr/lib/threads:/usr/lib:/lib
1                                    libc.a              shr.o
2                                    libpthreads.a       shr.o
3                                    libiconv.a          shr4.o


and the config I used....

Code:
bash-2.04$ cat config.sh
#!/bin/sh

rm ~/cc.log

PLATFORM=powerpc-ibm-aix4.1.5.0
ANS_USR=/home/ans/powerpc-ibm-aix4.1.5.0

exec ./configure                                                \
        --oldincludedir=$ANS_USR/include        \
        --host=$PLATFORM                                        \
         --enable-languages=c,c++

_________________
Land of the Long White Cloud and no Software Patents.


Top
 Profile  
 
Unread postPosted: Fri Feb 06, 2009 11:57 am 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
Another detail, I used GNU's make.

This may cause an interesting situation where you need to build GNU's make with the bootstrapped compiler xgcc.

I will attempt to make a GNU make for 4.1.5 using the same build environment as I used for gcc.

_________________
Land of the Long White Cloud and no Software Patents.


Top
 Profile  
 
Unread postPosted: Sun Feb 08, 2009 1:36 pm 
Offline
User avatar

Joined: Wed Nov 01, 2006 10:37 pm
Posts: 2914
Location: NZ
Any news? Are we on the right track or barking up the wrong tree?

_________________
Land of the Long White Cloud and no Software Patents.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group