From: Ian Lance Taylor Date: Fri, 1 Apr 2011 05:11:23 +0000 (+0000) Subject: libgo: Support Solaris 8/9. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=90630d1932caf1b04df0fb082c36717fa25d2bf3;p=gcc.git libgo: Support Solaris 8/9. From Rainer Orth. From-SVN: r171818 --- diff --git a/libgo/Makefile.am b/libgo/Makefile.am index f87494cac01..9a848751f21 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -1511,6 +1511,8 @@ libgo_go_objs = \ libgo_la_SOURCES = $(runtime_files) +libgo_la_LDFLAGS = $(PTHREAD_CFLAGS) + libgo_la_LIBADD = \ $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) @@ -2615,7 +2617,7 @@ testing/script/check: $(CHECK_DEPS) sysinfo.go: s-sysinfo; @true s-sysinfo: $(srcdir)/mksysinfo.sh config.h - CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh + CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh $(SHELL) $(srcdir)/../move-if-change tmp-sysinfo.go sysinfo.go $(STAMP) $@ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index e01f4f7f95e..a7596af4c04 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -247,6 +247,9 @@ am__objects_3 = go-append.lo go-assert.lo go-assert-interface.lo \ string.lo am_libgo_la_OBJECTS = $(am__objects_3) libgo_la_OBJECTS = $(am_libgo_la_OBJECTS) +libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libgo_la_LDFLAGS) \ + $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/../depcomp am__depfiles_maybe = depfiles @@ -386,6 +389,7 @@ NMEDIT = @NMEDIT@ OBJCOPY = @OBJCOPY@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OSCFLAGS = @OSCFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -1844,6 +1848,7 @@ libgo_go_objs = \ testing/script.lo libgo_la_SOURCES = $(runtime_files) +libgo_la_LDFLAGS = $(PTHREAD_CFLAGS) libgo_la_LIBADD = \ $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) @@ -2183,7 +2188,7 @@ clean-toolexeclibLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done libgo.la: $(libgo_la_OBJECTS) $(libgo_la_DEPENDENCIES) - $(LINK) -rpath $(toolexeclibdir) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS) + $(libgo_la_LINK) -rpath $(toolexeclibdir) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -5021,7 +5026,7 @@ testing/script/check: $(CHECK_DEPS) sysinfo.go: s-sysinfo; @true s-sysinfo: $(srcdir)/mksysinfo.sh config.h - CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh + CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh $(SHELL) $(srcdir)/../move-if-change tmp-sysinfo.go sysinfo.go $(STAMP) $@ diff --git a/libgo/configure b/libgo/configure index 375406d9e95..1c70b860262 100644 --- a/libgo/configure +++ b/libgo/configure @@ -616,6 +616,7 @@ MATH_LIBS USING_SPLIT_STACK_FALSE USING_SPLIT_STACK_TRUE SPLIT_STACK +OSCFLAGS GO_DEBUG_PROC_REGS_OS_ARCH_FILE GO_SYSCALLS_SYSCALL_OS_ARCH_FILE GOARCH @@ -10910,7 +10911,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10913 "configure" +#line 10914 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11016,7 +11017,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11019 "configure" +#line 11020 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13544,6 +13545,21 @@ if test -f ${srcdir}/go/debug/proc/regs_${GOOS}_${GOARCH}.go; then fi +case "$target" in + *-*-solaris2.[89]) + # Solaris 8/9 need this so struct msghdr gets the msg_control + # etc. fields in (_XPG4_2). + OSCFLAGS='-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__' + ;; + *-*-solaris2.1[01]) + # Solaris 10+ needs this so struct msghdr gets the msg_control + # etc. fields in (_XPG4_2). _XOPEN_SOURCE=500 as + # above doesn't work with C99. + OSCFLAGS='-D_XOPEN_SOURCE=600 -D__EXTENSIONS__' + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is supported" >&5 $as_echo_n "checking whether -fsplit-stack is supported... " >&6; } if test "${libgo_cv_c_split_stack_supported+set}" = set; then : diff --git a/libgo/configure.ac b/libgo/configure.ac index 0a98a1e2e2b..f7fa3aad281 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -252,6 +252,22 @@ if test -f ${srcdir}/go/debug/proc/regs_${GOOS}_${GOARCH}.go; then fi AC_SUBST(GO_DEBUG_PROC_REGS_OS_ARCH_FILE) +dnl Some targets need special flags to build sysinfo.go. +case "$target" in + *-*-solaris2.[[89]]) + # Solaris 8/9 need this so struct msghdr gets the msg_control + # etc. fields in (_XPG4_2). + OSCFLAGS='-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__' + ;; + *-*-solaris2.1[[01]]) + # Solaris 10+ needs this so struct msghdr gets the msg_control + # etc. fields in (_XPG4_2). _XOPEN_SOURCE=500 as + # above doesn't work with C99. + OSCFLAGS='-D_XOPEN_SOURCE=600 -D__EXTENSIONS__' + ;; +esac +AC_SUBST(OSCFLAGS) + dnl Use -fsplit-stack when compiling C code if available. AC_CACHE_CHECK([whether -fsplit-stack is supported], [libgo_cv_c_split_stack_supported], diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index abc583132dc..ab0efe531db 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -29,12 +29,6 @@ cat > sysinfo.c <. */ @@ -108,7 +102,7 @@ grep '^const _E' gen-sysinfo.go | \ sed -e 's/^\(const \)_\(E[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} # The O_xxx flags. -grep '^const _\(O\|F\|FD\)_' gen-sysinfo.go | \ +egrep '^const _(O|F|FD)_' gen-sysinfo.go | \ sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} if ! grep '^const O_ASYNC' ${OUT} >/dev/null 2>&1; then echo "const O_ASYNC = 0" >> ${OUT} @@ -151,7 +145,7 @@ if grep '^const ___WALL = ' gen-sysinfo.go >/dev/null 2>&1 \ fi # Networking constants. -grep '^const _\(AF\|SOCK\|SOL\|SO\|IPPROTO\|TCP\|IP\|IPV6\)_' gen-sysinfo.go | +egrep '^const _(AF|SOCK|SOL|SO|IPPROTO|TCP|IP|IPV6)_' gen-sysinfo.go | sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} grep '^const _SOMAXCONN' gen-sysinfo.go | sed -e 's/^\(const \)_\(SOMAXCONN[^= ]*\)\(.*\)$/\1\2 = _\2/' \ @@ -334,7 +328,8 @@ if test "$stat" != ""; then grep '^type _stat64 ' gen-sysinfo.go else grep '^type _stat ' gen-sysinfo.go -fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \ +fi | sed -e 's/type _stat64/type Stat_t/' \ + -e 's/type _stat/type Stat_t/' \ -e 's/st_dev/Dev/' \ -e 's/st_ino/Ino/g' \ -e 's/st_nlink/Nlink/' \ @@ -360,7 +355,8 @@ if test "$dirent" != ""; then grep '^type _dirent64 ' gen-sysinfo.go else grep '^type _dirent ' gen-sysinfo.go -fi | sed -e 's/type _dirent\(64\)\?/type Dirent/' \ +fi | sed -e 's/type _dirent64/type Dirent/' \ + -e 's/type _dirent/type Dirent/' \ -e 's/d_name \[0+1\]/d_name [0+256]/' \ -e 's/d_name/Name/' \ -e 's/]int8/]byte/' \ diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in index 795a3dda3c9..2117960e26b 100644 --- a/libgo/testsuite/Makefile.in +++ b/libgo/testsuite/Makefile.in @@ -113,6 +113,7 @@ NMEDIT = @NMEDIT@ OBJCOPY = @OBJCOPY@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OSCFLAGS = @OSCFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@