From patchwork Thu Jan 13 05:42:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 78657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 866B3B6F1E for ; Thu, 13 Jan 2011 16:43:01 +1100 (EST) Received: (qmail 10546 invoked by alias); 13 Jan 2011 05:42:58 -0000 Received: (qmail 10538 invoked by uid 22791); 13 Jan 2011 05:42:57 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Jan 2011 05:42:52 +0000 Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id p0D5gnTN030573 for ; Wed, 12 Jan 2011 21:42:49 -0800 Received: from pzk35 (pzk35.prod.google.com [10.243.19.163]) by hpaq6.eem.corp.google.com with ESMTP id p0D5gljx001753 for ; Wed, 12 Jan 2011 21:42:48 -0800 Received: by pzk35 with SMTP id 35so168374pzk.5 for ; Wed, 12 Jan 2011 21:42:47 -0800 (PST) Received: by 10.142.82.3 with SMTP id f3mr529575wfb.89.1294897367423; Wed, 12 Jan 2011 21:42:47 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id q13sm1872923wfc.5.2011.01.12.21.42.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 12 Jan 2011 21:42:46 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Add Solaris support to mksysinfo.sh Date: Wed, 12 Jan 2011 21:42:44 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch, based on one from Rainer Orth, adds some Solaris support to mksysinfo.sh, the shell script which reads target header files to construct Go system struct and type definitions. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 84c020adc1bf libgo/mksysinfo.sh --- a/libgo/mksysinfo.sh Wed Jan 12 21:14:43 2011 -0800 +++ b/libgo/mksysinfo.sh Wed Jan 12 21:37:34 2011 -0800 @@ -8,8 +8,8 @@ # This shell script creates the sysinfo.go file which holds types and # constants extracted from the system header files. This relies on a -# hook in gcc: the -ggo option will generate debugging information in -# Go syntax. +# hook in gcc: the -fdump-go-spec option will generate debugging +# information in Go syntax. # We currently #include all the files at once, which works, but leads # to exposing some names which ideally should not be exposed, as they @@ -69,11 +69,13 @@ grep -v '^func' | \ grep -v '^type _timeval ' | \ grep -v '^type _timespec ' | \ + grep -v '^type _timestruc_t ' | \ grep -v '^type _epoll_' | \ grep -v 'in6_addr' | \ grep -v 'sockaddr_in6' | \ sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ + -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \ >> ${OUT} # The errno constants. @@ -83,6 +85,9 @@ # The O_xxx flags. grep '^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} +fi if ! grep '^const O_CLOEXEC' ${OUT} >/dev/null 2>&1; then echo "const O_CLOEXEC = 0" >> ${OUT} fi @@ -195,9 +200,13 @@ if ! grep '^const PTRACE_EVENT_EXIT' ${OUT} > /dev/null 2>&1; then echo "const PTRACE_EVENT_EXIT = 6" >> ${OUT} fi +if ! grep '^const _PTRACE_TRACEME' ${OUT} > /dev/null 2>&1; then + echo "const _PTRACE_TRACEME = 0" >> ${OUT} +fi # The registers returned by PTRACE_GETREGS. This is probably -# GNU/Linux specific. +# GNU/Linux specific; it should do no harm if there is no +# _user_regs_struct. regs=`grep '^type _user_regs_struct struct' gen-sysinfo.go` if test "$regs" != ""; then regs=`echo $regs | sed -e 's/type _user_regs_struct struct //' -e 's/[{}]//g'` @@ -263,6 +272,18 @@ -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \ -e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT} +timestruc=`grep '^type _timestruc_t ' gen-sysinfo.go || true` +if test "$timestruc" != ""; then + timestruc_sec=`echo $timestruc | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'` + timestruc_nsec=`echo $timestruc | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'` + echo "type Timestruc_sec_t $timestruc_sec" >> ${OUT} + echo "type Timestruc_nsec_t $timestruc_nsec" >> ${OUT} + echo $timestruc | \ + sed -e 's/^type _timestruc_t /type Timestruc /' \ + -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timestruc_sec_t/' \ + -e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timestruc_nsec_t/' >> ${OUT} +fi + # The stat type. grep 'type _stat ' gen-sysinfo.go | \ sed -e 's/type _stat/type Stat_t/' \ @@ -281,6 +302,7 @@ -e 's/st_ctim/Ctime/' \ -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ + -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \ >> ${OUT} # The directory searching types. @@ -309,9 +331,10 @@ f=`echo $field | sed -e 's/^\(.\).*$/\1/'` r=`echo $field | sed -e 's/^.\(.*\)$/\1/'` f=`echo $f | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` - # Fix _timeval and _timespec. + # Fix _timeval _timespec, and _timestruc_t. r=`echo $r | sed -e s'/ _timeval$/ Timeval/'` r=`echo $r | sed -e s'/ _timespec$/ Timespec/'` + r=`echo $r | sed -e s'/ _timestruc_t$/ Timestruc/'` field="$f$r" nrusage="$nrusage $field;" done