update newlib patch

add gcc 4.2.1 patch
This commit is contained in:
Dave Murphy 2007-07-30 18:38:41 +00:00
parent bafdd64032
commit c38601a5bc
2 changed files with 245 additions and 4 deletions

View File

@ -0,0 +1,197 @@
diff -Nbaur gcc-4.2.1/gcc/c-incpath.c gcc-4.2.1-arm/gcc/c-incpath.c
--- gcc-4.2.1/gcc/c-incpath.c Thu May 18 23:16:23 2006
+++ gcc-4.2.1-arm/gcc/c-incpath.c Sun Jul 29 15:35:14 2007
@@ -340,13 +340,18 @@
cpp_dir *p;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Convert all backslashes to slashes. The native CRT stat()
- function does not recognize a directory that ends in a backslash
- (unless it is a drive root dir, such "c:\"). Forward slashes,
- trailing or otherwise, cause no problems for stat(). */
- char* c;
- for (c = path; *c; c++)
- if (*c == '\\') *c = '/';
+ /* Remove unnecessary trailing slashes. On some versions of MS
+ Windows, trailing _forward_ slashes cause no problems for stat().
+ On newer versions, stat() does not recognise a directory that ends
+ in a '\\' or '/', unless it is a drive root dir, such as "c:/",
+ where it is obligatory. */
+ int pathlen = strlen (path);
+ char* end = path + pathlen - 1;
+ /* Preserve the lead '/' or lead "c:/". */
+ char* start = path + (pathlen > 2 && path[1] == ':' ? 3 : 1);
+
+ for (; end > start && IS_DIR_SEPARATOR (*end); end--)
+ *end = 0;
#endif
p = XNEW (cpp_dir);
diff -Nbaur gcc-4.2.1/gcc/config/arm/t-arm-elf gcc-4.2.1-arm/gcc/config/arm/t-arm-elf
--- gcc-4.2.1/gcc/config/arm/t-arm-elf Mon Nov 6 12:13:53 2006
+++ gcc-4.2.1-arm/gcc/config/arm/t-arm-elf Sun Jul 29 15:35:14 2007
@@ -15,9 +15,9 @@
# MULTILIB_DIRNAMES += ep9312
# MULTILIB_EXCEPTIONS += *mthumb/*mcpu=ep9312*
#
-# MULTILIB_OPTIONS += mlittle-endian/mbig-endian
-# MULTILIB_DIRNAMES += le be
-# MULTILIB_MATCHES += mbig-endian=mbe mlittle-endian=mle
+MULTILIB_OPTIONS += mlittle-endian/mbig-endian
+MULTILIB_DIRNAMES += le be
+MULTILIB_MATCHES += mbig-endian=mbe mlittle-endian=mle
#
# MULTILIB_OPTIONS += mhard-float/msoft-float
# MULTILIB_DIRNAMES += fpu soft
diff -Nbaur gcc-4.2.1/gcc/gcc.c gcc-4.2.1-arm/gcc/gcc.c
--- gcc-4.2.1/gcc/gcc.c Mon Mar 5 20:37:05 2007
+++ gcc-4.2.1-arm/gcc/gcc.c Sun Jul 29 15:35:14 2007
@@ -3370,8 +3370,6 @@
gcc_libexec_prefix = make_relative_prefix (argv[0],
standard_bindir_prefix,
standard_libexec_prefix);
- if (gcc_exec_prefix)
- putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
}
else
{
@@ -6214,10 +6212,21 @@
/* We need to check standard_exec_prefix/just_machine_suffix/specs
for any override of as, ld and libraries. */
+ if ( gcc_exec_prefix )
+ {
+ specs_file = alloca (strlen (gcc_exec_prefix)
+ + strlen (just_machine_suffix) + sizeof ("specs"));
+
+ strcpy (specs_file, gcc_exec_prefix);
+ } else {
+
specs_file = alloca (strlen (standard_exec_prefix)
+ strlen (just_machine_suffix) + sizeof ("specs"));
strcpy (specs_file, standard_exec_prefix);
+
+ }
+
strcat (specs_file, just_machine_suffix);
strcat (specs_file, "specs");
if (access (specs_file, R_OK) == 0)
diff -Nbaur gcc-4.2.1/gcc/prefix.c gcc-4.2.1-arm/gcc/prefix.c
--- gcc-4.2.1/gcc/prefix.c Sat Dec 17 20:45:46 2005
+++ gcc-4.2.1-arm/gcc/prefix.c Sun Jul 29 15:35:14 2007
@@ -246,13 +246,16 @@
The returned string is always malloc-ed, and the caller is
responsible for freeing it. */
+
+static const char *old_prefix = PREFIX;
+
char *
update_path (const char *path, const char *key)
{
char *result, *p;
- const int len = strlen (std_prefix);
+ const int len = strlen (old_prefix);
- if (! strncmp (path, std_prefix, len)
+ if (! strncmp (path, old_prefix, len)
&& (IS_DIR_SEPARATOR(path[len])
|| path[len] == '\0')
&& key != 0)
@@ -354,4 +357,6 @@
set_std_prefix (const char *prefix, int len)
{
std_prefix = save_string (prefix, len);
+
+ putenv (concat ("GCC_EXEC_PREFIX=", std_prefix, NULL));
}
diff -Nbaur gcc-4.2.1/gcc/stor-layout.c gcc-4.2.1-arm/gcc/stor-layout.c
--- gcc-4.2.1/gcc/stor-layout.c Sun Nov 19 00:44:04 2006
+++ gcc-4.2.1-arm/gcc/stor-layout.c Sun Jul 29 15:35:14 2007
@@ -531,7 +531,15 @@
#ifdef STRUCTURE_SIZE_BOUNDARY
/* Packed structures don't need to have minimum size. */
if (! TYPE_PACKED (t))
- rli->record_align = MAX (rli->record_align, (unsigned) STRUCTURE_SIZE_BOUNDARY);
+ {
+ unsigned tmp;
+
+ /* #pragma pack overrides STRUCTURE_SIZE_BOUNDARY. */
+ tmp = (unsigned) STRUCTURE_SIZE_BOUNDARY;
+ if (maximum_field_alignment != 0)
+ tmp = MIN (tmp, maximum_field_alignment);
+ rli->record_align = MAX (rli->record_align, tmp);
+ }
#endif
rli->offset = size_zero_node;
diff -Nbaur gcc-4.2.1/gcc/toplev.c gcc-4.2.1-arm/gcc/toplev.c
--- gcc-4.2.1/gcc/toplev.c Mon Oct 9 17:27:14 2006
+++ gcc-4.2.1-arm/gcc/toplev.c Sun Jul 29 15:35:14 2007
@@ -82,6 +82,7 @@
#include "value-prof.h"
#include "alloc-pool.h"
#include "tree-mudflap.h"
+#include "prefix.h"
#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
#include "dwarf2out.h"
@@ -1479,6 +1480,10 @@
progname = p;
xmalloc_set_program_name (progname);
+
+ p = getenv("GCC_EXEC_PREFIX");
+ if (p && strlen(p)) set_std_prefix (p, strlen(p));
+
hex_init ();
diff -Nbaur gcc-4.2.1/gcc/version.c gcc-4.2.1-arm/gcc/version.c
--- gcc-4.2.1/gcc/version.c Wed Mar 16 06:04:10 2005
+++ gcc-4.2.1-arm/gcc/version.c Sun Jul 29 15:35:14 2007
@@ -8,7 +8,7 @@
in parentheses. You may also wish to include a number indicating
the revision of your modified compiler. */
-#define VERSUFFIX ""
+#define VERSUFFIX " (devkitARM release 21)"
/* This is the location of the online document giving instructions for
reporting bugs. If you distribute a modified version of GCC,
@@ -17,7 +17,7 @@
forward us bugs reported to you, if you determine that they are
not bugs in your modifications.) */
-const char bug_report_url[] = "<URL:http://gcc.gnu.org/bugs.html>";
+const char bug_report_url[] = "<URL:http://devkitpro.sourceforge.net/bugs.shtml>";
/* The complete version string, assembled from several pieces.
BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile. */
diff -Nbaur gcc-4.2.1/libcpp/files.c gcc-4.2.1-arm/libcpp/files.c
--- gcc-4.2.1/libcpp/files.c Sat Feb 18 09:25:31 2006
+++ gcc-4.2.1-arm/libcpp/files.c Sun Jul 29 15:42:39 2007
@@ -226,6 +226,22 @@
close (file->fd);
file->fd = -1;
}
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ else if (errno == EACCES)
+ {
+ /* On most UNIX systems, open succeeds on a directory. Above,
+ we check if we have opened a directory and if so, set errno
+ to ENOENT. However, on Windows, opening a directory
+ fails with EACCESS. We want to return ENOENT in that
+ case too. */
+ if (stat (file->path, &file->st) == 0
+ && S_ISDIR (file->st.st_mode))
+ errno = ENOENT;
+ else
+ /* The call to stat may have reset errno. */
+ errno = EACCESS;
+ }
+#endif
else if (errno == ENOTDIR)
errno = ENOENT;

View File

@ -52,7 +52,7 @@ diff -Nbaur newlib-1.15.0/libgloss/configure.in newlib-1.15.0-new/libgloss/confi
i[[3456]]86-*-elf* | i[[3456]]86-*-coff*)
diff -Nbaur newlib-1.15.0/libgloss/libsysbase/Makefile.in newlib-1.15.0-new/libgloss/libsysbase/Makefile.in
--- newlib-1.15.0/libgloss/libsysbase/Makefile.in Thu Jan 1 00:00:00 1970
+++ newlib-1.15.0-new/libgloss/libsysbase/Makefile.in Fri Feb 16 09:13:45 2007
+++ newlib-1.15.0-new/libgloss/libsysbase/Makefile.in Sat Jul 14 02:44:34 2007
@@ -0,0 +1,146 @@
+# Copyright (c) 1998 Cygnus Support
+#
@ -124,7 +124,7 @@ diff -Nbaur newlib-1.15.0/libgloss/libsysbase/Makefile.in newlib-1.15.0-new/libg
+OBJS = abort.o iosupport.o close.o environ.o execve.o fork.o fstat.o getpid.o gettod.o \
+ isatty.o kill.o link.o lseek.o open.o read.o sbrk.o stat.o \
+ times.o unlink.o wait.o write.o _exit.o malloc_vars.o \
+ chdir.o mkdir.o dir.o rename.o
+ chdir.o mkdir.o dir.o rename.o build_argv.o
+
+# Object files specific to particular targets.
+EVALOBJS = ${OBJS}
@ -608,6 +608,41 @@ diff -Nbaur newlib-1.15.0/libgloss/libsysbase/aclocal.m4 newlib-1.15.0-new/libgl
+])
+
+m4_include([../acinclude.m4])
diff -Nbaur newlib-1.15.0/libgloss/libsysbase/build_argv.c newlib-1.15.0-new/libgloss/libsysbase/build_argv.c
--- newlib-1.15.0/libgloss/libsysbase/build_argv.c Thu Jan 1 00:00:00 1970
+++ newlib-1.15.0-new/libgloss/libsysbase/build_argv.c Fri Jul 13 07:57:46 2007
@@ -0,0 +1,31 @@
+struct __argv {
+ int argvMagic;
+ char *commandLine;
+ int length;
+ int argc;
+ char **argv;
+ char **endARGV;
+};
+
+
+void build_argv (struct __argv* argstruct ) {
+
+ char *data = argstruct->commandLine;
+ int len = argstruct->length;
+
+ char** argv = (char**)(((int)data + len + sizeof(char **)) & ~sizeof(char **));
+ char* end = data + len - 1;
+ int argCount = 0;
+
+ do {
+ argv[argCount++] = data; // Add next arg to argv list
+ while (*(data) && data < end) data++; // Move to next NULL delimiter
+ data++; // Move to one after the NULL delimiter
+ } while (data < end);
+
+ *end = '\0'; // Force NULL terminator for last arg
+
+ argstruct->argv = argv;
+ argstruct->argc = argCount;
+ argstruct->endARGV = &argv[argCount];
+}
diff -Nbaur newlib-1.15.0/libgloss/libsysbase/chdir.c newlib-1.15.0-new/libgloss/libsysbase/chdir.c
--- newlib-1.15.0/libgloss/libsysbase/chdir.c Thu Jan 1 00:00:00 1970
+++ newlib-1.15.0-new/libgloss/libsysbase/chdir.c Fri Feb 16 09:13:45 2007
@ -5379,8 +5414,8 @@ diff -Nbaur newlib-1.15.0/libgloss/libsysbase/stat.c newlib-1.15.0-new/libgloss/
+
diff -Nbaur newlib-1.15.0/libgloss/libsysbase/times.c newlib-1.15.0-new/libgloss/libsysbase/times.c
--- newlib-1.15.0/libgloss/libsysbase/times.c Thu Jan 1 00:00:00 1970
+++ newlib-1.15.0-new/libgloss/libsysbase/times.c Fri Jun 15 00:08:04 2007
@@ -0,0 +1,39 @@
+++ newlib-1.15.0-new/libgloss/libsysbase/times.c Sun Jul 15 00:46:18 2007
@@ -0,0 +1,48 @@
+#include <_ansi.h>
+#include <_syslist.h>
+#include <sys/times.h>
@ -5402,6 +5437,15 @@ diff -Nbaur newlib-1.15.0/libgloss/libsysbase/times.c newlib-1.15.0-new/libgloss
+
+time_t *punixTime;
+
+clock_t
+_DEFUN (_times_r, (ptr, ptms),
+ struct _reent *ptr _AND
+ struct tms *ptms)
+{
+ return (clock_t)-1;
+}
+
+
+int
+_DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone),
+ struct _reent *ptr _AND