Anonymous avatar Anonymous committed 33672c9

Patch for GCC

Committer: Ross Light <ross@zombiezen.com>;

Comments (0)

Files changed (3)

+#!/bin/bash
+
+# For now, run this as root so install works.  Not ideal, but it works...
+# If someone wants to, getting GCC to stage everything would be a lot better, but I'm lazy
+BINUTILS_VERSION=2.21
+GCC_VERSION=4.5.2
+MPFR_VERSION=3.0.1
+GMP_VERSION=5.0.2
+PREFIX=/usr/local/powerpc-wrs-vxworks
+
+export PATH=$PATH:$PREFIX/bin
+
+echo "Getting the vxworks header files."
+[ -e updated_vxworks63gccdist.zip ] || wget ftp://ftp.ni.com/pub/devzone/tut/updated_vxworks63gccdist.zip
+unzip updated_vxworks63gccdist.zip
+
+echo "Patching the header files"
+cd gccdist/WindRiver/vxworks-6.3/target/h/
+ln -s vxWorks.h VxWorks.h
+cat ../../../../../vxworks-headers.patch | sed "s/\/usr\/local\/powerpc-wrs-vxworks/`echo $PREFIX | sed 's/\\//\\\\\\//g'`/" | patch -p1
+
+cd ../../../../../
+
+mkdir -p $PREFIX/powerpc-wrs-vxworks/wind_base
+mkdir $PREFIX/powerpc-wrs-vxworks/wind_base/target
+ln -s ../../sys-include/ $PREFIX/powerpc-wrs-vxworks/wind_base/target/h
+cp -rp gccdist/WindRiver/vxworks-6.3/host $PREFIX/powerpc-wrs-vxworks/wind_base/host
+
+echo "Building binutils"
+[ -e http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2 ] || wget http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2
+echo "Extracting binutils-2.21.tar.bz2"
+tar xjf binutils-2.21.tar.bz2
+mkdir binutils-2.21-build-x64
+cd binutils-2.21-build-x64
+../binutils-2.21/configure --prefix=$PREFIX --target=powerpc-wrs-vxworks
+make -j32
+make install -j2
+cd ..
+
+echo "Building gcc"
+[ -e http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2 ] || wget http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2
+echo "Extracting gcc-$GCC_VERSION.tar.bz2"
+tar xjf gcc-$GCC_VERSION.tar.bz2
+[ -e wget http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VERSION.tar.bz2 ] || wget http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VERSION.tar.bz2 
+echo "Extracting mpfr-$MPFR_VERSION.tar.bz2"
+tar xjf mpfr-$MPFR_VERSION.tar.bz2
+[ -e wget ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/gmp-$GMP_VERSION.tar.bz2] || wget ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/gmp-$GMP_VERSION.tar.bz2
+echo "Extracting gmp-$GMP_VERSION.tar.bz2"
+tar xjf gmp-$GMP_VERSION.tar.bz2
+cd gcc-$GCC_VERSION
+ln -s ../mpfr-$MPFR_VERSION mpfr
+ln -s ../gmp-$GMP_VERSION gmp
+cd ..
+
+cat gcc-diff.patch | patch -p1
+
+mkdir gcc-$GCC_VERSION-build-x64
+cd gcc-$GCC_VERSION-build-x64
+
+../gcc-$GCC_VERSION/configure --prefix=$PREFIX --target=powerpc-wrs-vxworks --with-gnu-as --with-gnu-ld --with-headers=../gccdist/WindRiver/vxworks-6.3/target/h --disable-shared --disable-libssp CFLAGS='-D_WRS_KERNEL -g -O2' --disable-multilib --with-float=hard --enable-languages=c,c++ --enable-threads=vxworks --without-gconv --disable-libgomp --disable-nls --disable-libmudflap --with-cpu-PPC603
+export WIND_BASE=$PREFIX/powerpc-wrs-vxworks/wind_base/
+
+# Build gcc propper
+make all-gcc -j32
+make install-gcc -j2
+
+# Make the library
+make -j32
+make install -j2
+cd ..
+
+echo "Building the stdlib"
+mkdir libstdc++-v3-build-x64
+cd libstdc++-v3-build-x64
+
+../gcc-$GCC_VERSION/libstdc++-v3/configure --host=powerpc-wrs-vxworks --prefix=$PREFIX/ CFLAGS="-g -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/ -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/wrn/coreip/ -D_WRS_KERNEL -DCPU=PPC603 -DNOMINMAX" CXXFLAGS="-isystem $PREFIX/powerpc-wrs-vxworks/sys-include/ -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/wrn/coreip/ -D_WRS_KERNEL -DCPU=PPC603 -DNOMINMAX" CCFLAGS="-g -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/wrn/coreip/ -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/ -D_WRS_KERNEL -DCPU=PPC603 -DNOMINMAX" CPPFLAGS="-g -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/ -isystem $PREFIX/powerpc-wrs-vxworks/sys-include/wrn/coreip/ -D_WRS_KERNEL -DCPU=PPC603 -DNOMINMAX" --enable-libstdcxx-debug
+make -j32
+make install -j2
+diff -u -r a/gcc-4.5.2/gcc/config/rs6000/vxworks.h b/gcc-4.5.2/gcc/config/rs6000/vxworks.h
+--- a/gcc-4.5.2/gcc/config/rs6000/vxworks.h	2009-10-10 11:43:31.000000000 -0700
++++ b/gcc-4.5.2/gcc/config/rs6000/vxworks.h	2011-05-23 12:48:16.857388980 -0700
+@@ -34,6 +34,9 @@
+   do						\
+     {						\
+       builtin_define ("__ppc");			\
++      builtin_define ("__ppc__");		\
++      builtin_define ("__PPC__");		\
++      builtin_define ("__PPC");		\
+       builtin_define ("__EABI__");		\
+       builtin_define ("__ELF__");		\
+       builtin_define ("__vxworks");		\
+diff -u -r a/gcc-4.5.2/gcc/config/vxlib.c b/gcc-4.5.2/gcc/config/vxlib.c
+--- a/gcc-4.5.2/gcc/config/vxlib.c	2009-04-22 03:53:53.000000000 -0700
++++ b/gcc-4.5.2/gcc/config/vxlib.c	2011-05-23 14:39:33.688752289 -0700
+@@ -25,9 +25,11 @@
+ /* Threads compatibility routines for libgcc2 for VxWorks.
+    These are out-of-line routines called from gthr-vxworks.h.  */
+ 
++#include "config.h"
+ #include "tconfig.h"
+ #include "tsystem.h"
+ #include "gthr.h"
++#include <coretypes.h>
+ 
+ #if defined(__GTHREADS)
+ #include <vxWorks.h>
+diff -u -r a/gcc-4.5.2/gcc/config/vxlib-tls.c b/gcc-4.5.2/gcc/config/vxlib-tls.c
+--- a/gcc-4.5.2/gcc/config/vxlib-tls.c	2009-04-23 03:39:24.000000000 -0700
++++ b/gcc-4.5.2/gcc/config/vxlib-tls.c	2011-05-14 16:54:35.948615728 -0700
+@@ -36,6 +36,7 @@
+ #include "tconfig.h"
+ #include "tsystem.h"
+ #include "gthr.h"
++#include "config.h"
+ 
+ #if defined(__GTHREADS)
+ #include <vxWorks.h>
+diff -u -r a/gcc-4.5.2/gcc/config/vxworks.c b/gcc-4.5.2/gcc/config/vxworks.c
+--- a/gcc-4.5.2/gcc/config/vxworks.c	2009-02-20 07:20:38.000000000 -0800
++++ b/gcc-4.5.2/gcc/config/vxworks.c	2011-02-05 12:59:22.000000000 -0800
+@@ -69,18 +69,18 @@
+   
+   *name = get_identifier ("__tls_var");
+   
+-  field = build_decl (FIELD_DECL, get_identifier ("size"),
++  field = build_decl (DECL_SOURCE_LOCATION (TYPE_NAME (type)), FIELD_DECL, get_identifier ("size"),
+ 		      unsigned_type_node);
+   DECL_CONTEXT (field) = type;
+   next_field = field;
+ 
+-  field = build_decl (FIELD_DECL, get_identifier ("module_id"),
++  field = build_decl (DECL_SOURCE_LOCATION (TYPE_NAME (type)), FIELD_DECL, get_identifier ("module_id"),
+ 		      unsigned_type_node);
+   DECL_CONTEXT (field) = type;
+   TREE_CHAIN (field) = next_field;
+   next_field = field;
+ 
+-  field = build_decl (FIELD_DECL, get_identifier ("offset"),
++  field = build_decl (DECL_SOURCE_LOCATION (TYPE_NAME (type)), FIELD_DECL, get_identifier ("offset"),
+ 		      unsigned_type_node);
+   DECL_CONTEXT (field) = type;
+   TREE_CHAIN (field) = next_field;
+diff -u -r a/gcc-4.5.2/gcc/gcov-io.c b/gcc-4.5.2/gcc/gcov-io.c
+--- a/gcc-4.5.2/gcc/gcov-io.c	2009-11-25 02:55:54.000000000 -0800
++++ b/gcc-4.5.2/gcc/gcov-io.c	2011-02-05 13:42:04.000000000 -0800
+@@ -87,7 +87,7 @@
+     {
+       /* Read-only mode - acquire a read-lock.  */
+       s_flock.l_type = F_RDLCK;
+-      fd = open (name, O_RDONLY);
++      fd = open (name, O_RDONLY, 0666);
+     }
+   else
+     {
+diff -u -r a/gcc-4.5.2/gcc/libgcov.c b/gcc-4.5.2/gcc/libgcov.c
+--- a/gcc-4.5.2/gcc/libgcov.c	2009-11-28 08:21:00.000000000 -0800
++++ b/gcc-4.5.2/gcc/libgcov.c	2011-02-05 14:20:14.000000000 -0800
+@@ -105,7 +105,7 @@
+ 
+         /* Try to make directory if it doesn't already exist.  */
+         if (access (filename, F_OK) == -1
+-            && mkdir (filename, 0755) == -1
++            && mkdir (filename) == -1
+             /* The directory might have been made by another process.  */
+ 	    && errno != EEXIST)
+ 	  {
+diff -u -r a/gcc-4.5.2/gcc/system.h b/gcc-4.5.2/gcc/system.h
+--- a/gcc-4.5.2/gcc/system.h	2009-12-13 15:00:53.000000000 -0800
++++ b/gcc-4.5.2/gcc/system.h	2011-05-23 14:06:54.992947450 -0700
+@@ -399,8 +399,12 @@
+ #endif
+ 
+ #ifdef HAVE_MALLOC_H
++#ifdef __VXWORKS__
++#include <stdlib.h>
++#else
+ #include <malloc.h>
+ #endif
++#endif
+ 
+ #if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC
+ extern void *malloc (size_t);
+diff -u -r a/gcc-4.5.2/libstdc++-v3/config/io/basic_file_stdio.cc b/gcc-4.5.2/libstdc++-v3/config/io/basic_file_stdio.cc
+--- a/gcc-4.5.2/libstdc++-v3/config/io/basic_file_stdio.cc	2010-02-16 21:43:24.000000000 -0800
++++ b/gcc-4.5.2/libstdc++-v3/config/io/basic_file_stdio.cc	2011-05-23 14:13:27.328947482 -0700
+@@ -38,6 +38,9 @@
+ // Pick up ioctl on Solaris 2.8
+ #ifdef _GLIBCXX_HAVE_UNISTD_H
+ #include <unistd.h>
++#ifdef __VXWORKS__
++#include <ioLib.h>
++#endif
+ #endif
+ 
+ // Pick up FIONREAD on Solaris 2
+@@ -341,7 +344,13 @@
+ #else
+     int __num = 0;
+ #endif
+-    int __r = ioctl(this->fd(), FIONREAD, &__num);
++    int __r = ioctl(this->fd(), FIONREAD,
++#ifndef __VXWORKS__
++    		    &__num
++#else
++    		    (int)&__num
++#endif
++		    );
+     if (!__r && __num >= 0)
+       return __num; 
+ #endif    
+diff -u -r a/gcc-4.5.2/libstdc++-v3/include/precompiled/stdc++.h b/gcc-4.5.2/libstdc++-v3/include/precompiled/stdc++.h
+--- a/gcc-4.5.2/libstdc++-v3/include/precompiled/stdc++.h	2009-12-21 11:00:34.000000000 -0800
++++ b/gcc-4.5.2/libstdc++-v3/include/precompiled/stdc++.h	2011-05-14 21:13:11.704595030 -0700
+@@ -30,6 +30,7 @@
+ // 17.4.1.2 Headers
+ 
+ // C
++#include <VxWorks.h>
+ #ifndef _GLIBCXX_NO_ASSERT
+ #include <cassert>
+ #endif
+diff -u -r a/gcc-4.5.2/libstdc++-v3/libsupc++/pure.cc b/gcc-4.5.2/libstdc++-v3/libsupc++/pure.cc
+--- a/gcc-4.5.2/libstdc++-v3/libsupc++/pure.cc	2009-04-09 08:00:19.000000000 -0700
++++ b/gcc-4.5.2/libstdc++-v3/libsupc++/pure.cc	2011-05-23 14:15:10.737062775 -0700
+@@ -29,6 +29,9 @@
+ #if _GLIBCXX_HOSTED
+ #ifdef _GLIBCXX_HAVE_UNISTD_H
+ # include <unistd.h>
++#ifdef __VXWORKS__
++# include <ioLib.h>
++#endif
+ # define writestr(str)	write(2, str, sizeof(str) - 1)
+ # ifdef __GNU_LIBRARY__
+   /* Avoid forcing the library's meaning of `write' on the user program

vxworks-headers.patch

+diff -u -r a/ioLib.h b/ioLib.h
+--- a/ioLib.h	2007-07-24 18:15:34.000000000 -0700
++++ b/ioLib.h	2011-05-14 21:29:31.444995507 -0700
+@@ -392,7 +392,11 @@
+ extern int	open (const char *, int, int);
+ extern int	creat (const char *, int);
+ extern int	read (int, char *, size_t);
++#ifdef __cplusplus
++extern int	write (int, const char *, size_t);
++#else
+ extern int	write (int, char *, size_t);
++#endif
+ extern int 	ioctl (int fd, int function, int arg);
+ extern STATUS	close (int);
+ extern STATUS	remove (const char *);
+diff -u -r a/taskLib.h b/taskLib.h
+--- a/taskLib.h	2007-07-24 18:15:40.000000000 -0700
++++ b/taskLib.h	2011-05-14 18:57:34.032617556 -0700
+@@ -210,7 +210,7 @@
+ #include <vwModNum.h>
+ #include <classLib.h>
+ #include <qLib.h>
+-#include <regs.h>
++#include "/usr/local/powerpc-wrs-vxworks/powerpc-wrs-vxworks/sys-include/regs.h"
+ #include <excLib.h>
+ #include <private/eventP.h>
+ #include <private/semLibP.h>
+diff -u -r a/tool/gnu/ldscripts/link.OUT b/tool/gnu/ldscripts/link.OUT
+--- a/tool/gnu/ldscripts/link.OUT	2007-07-24 18:15:42.000000000 -0700
++++ b/tool/gnu/ldscripts/link.OUT	2011-05-14 19:10:10.396484862 -0700
+@@ -32,7 +32,7 @@
+ 01a,29oct01,jab  diab script written
+ */
+ 
+-ENTRY(_start)
++/*ENTRY(_start)*/
+ SECTIONS
+ {
+   .text     0 :
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.