Cannot bootstrap irix6.5 with --enable-threads=posix

Loren James Rittle rittle@latour.rsch.comm.mot.com
Tue May 29 14:28:00 GMT 2001


I guess I know as much as anyone on properly supporting POSIX threads
on a platform where it doesn't currently work, thus I will take a stab...

> Can't bootstrap irix6.5 trunk or branch with  --enable-threads=posix

> The stage1/xgcc cannot create executables since:
> * libgcc.a(unwind-dw2.o) references pthread_once
> * don't link with -lpthread

> We need to add -lpthreads at the appropriate place.  Just before -lc works
> fine.  I don't know how to do this.

You need to set TARGET_LIBGCC2_CFLAGS in the tm file constructed for
the --enable-threads=posix case.

Here is one example from another port:

S rittle@latour; more outside-cvs-src/gcc-mainline/gcc/config/t-freebsd-thread 
# This is currently needed to compile libgcc2 for threads support
TARGET_LIBGCC2_CFLAGS += -pthread

(Put something similar into gcc/config/mips/t-iris6-thread)

And then config.gcc will need to be updated for your port to construct
the proper tm file from that fragment:

I suggest something like this (instead of the fragment already in config.gcc):

mips-sgi-irix6*)                # SGI System V.4., IRIX 6
        if test "x$gnu_ld" = xyes
        then
                tm_file="mips/iris6.h mips/iris6gld.h"
        else
                tm_file=mips/iris6.h
        fi
        tmake_file=mips/t-iris6
        xm_file=mips/xm-iris6.h
        xmake_file=mips/x-iris6
        case x${enable_threads} in
        xno) ;;
        x | xyes | xpthreads | xposix)
                thread_file='posix'
                tmake_file="${tmake_file} mips/t-iris6-thread"
                ;;
        *) echo 'Unknown thread configuration for target'; exit 1;;
        esac
        ;;

If weak symbols are not supported on your platform, then I think you
will need to do more work (i.e. setup a proper multilib'd libgcc.a).
I have never done that work so I can offer no advice other than what
is in the manual.

You might also want to consider modifying the LIB_SPEC of your
platform (see mips/iris6.h) so that a -pthread switch is supported by
the compiler (see how config/linux.h and config/freebsd.h and many
other ports do it).  Some ports do; some ports do not; and some ports
spell it differently.  It will be nice when all gcc ports use the same
switch to mean "support POSIX threads".

Regards,
Loren



More information about the Gcc-bugs mailing list