Browse Source

add support for bfin toolchain creation

Waldemar Brodkorb 10 years ago
parent
commit
96e02f728f

+ 3 - 0
rules.mk

@@ -65,6 +65,9 @@ ADK_TARGET_KARCH:=$(ADK_TARGET_ARCH)
 ifeq ($(ADK_TARGET_ARCH),aarch64)
 ADK_TARGET_KARCH:=arm64
 endif
+ifeq ($(ADK_TARGET_ARCH),bfin)
+ADK_TARGET_KARCH:=blackfin
+endif
 ifeq ($(ADK_TARGET_ARCH),ppc)
 ADK_TARGET_KARCH:=powerpc
 endif

+ 1 - 0
target/arch.lst

@@ -1,6 +1,7 @@
 aarch64
 alpha
 arm
+bfin
 m68k
 microblaze
 mips

+ 11 - 0
target/bfin/Makefile

@@ -0,0 +1,11 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+include $(ADK_TOPDIR)/mk/kernel.mk
+include $(ADK_TOPDIR)/mk/modules.mk
+include $(ADK_TOPDIR)/mk/kernel-build.mk
+include $(ADK_TOPDIR)/mk/image.mk
+
+KERNEL:=$(LINUX_DIR)/arch/bfin/boot/uImage
+

+ 10 - 0
target/bfin/systems/toolchain-bfin

@@ -0,0 +1,10 @@
+config ADK_TARGET_SYSTEM_TOOLCHAIN_BFIN
+	bool "Toolchain only"
+	select ADK_bfin
+	select ADK_toolchain_bfin
+	select ADK_CPU_BFIN
+	select ADK_TARGET_TOOLCHAIN
+	select ADK_TARGET_PACKAGE_TXZ
+	help
+	  BFIN toolchain.
+

+ 251 - 0
target/bfin/uclibc.config

@@ -0,0 +1,251 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# uClibc 0.9.34-git C Library Configuration
+#
+# TARGET_alpha is not set
+# TARGET_arc is not set
+# TARGET_arm is not set
+# TARGET_avr32 is not set
+TARGET_bfin=y
+# TARGET_c6x is not set
+# TARGET_cris is not set
+# TARGET_e1 is not set
+# TARGET_frv is not set
+# TARGET_h8300 is not set
+# TARGET_hppa is not set
+# TARGET_i386 is not set
+# TARGET_i960 is not set
+# TARGET_ia64 is not set
+# TARGET_m68k is not set
+# TARGET_metag is not set
+# TARGET_microblaze is not set
+# TARGET_mips is not set
+# TARGET_nios is not set
+# TARGET_nios2 is not set
+# TARGET_powerpc is not set
+# TARGET_sh is not set
+# TARGET_sh64 is not set
+# TARGET_sparc is not set
+# TARGET_v850 is not set
+# TARGET_vax is not set
+# TARGET_x86_64 is not set
+# TARGET_xtensa is not set
+
+#
+# Target Architecture Features and Options
+#
+TARGET_ARCH="bfin"
+FORCE_OPTIONS_FOR_ARCH=y
+TARGET_SUBARCH=""
+UCLIBC_FORMAT_FDPIC_ELF=y
+# UCLIBC_FORMAT_FLAT is not set
+# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
+# UCLIBC_FORMAT_SHARED_FLAT is not set
+ARCH_HAS_DEPRECATED_SYSCALLS=y
+ARCH_LITTLE_ENDIAN=y
+
+#
+# Using Little Endian
+#
+ARCH_HAS_NO_MMU=y
+
+#
+# Target CPU lacks a memory management unit (MMU)
+#
+UCLIBC_HAS_FLOATS=y
+# UCLIBC_HAS_FPU is not set
+UCLIBC_HAS_SOFT_FLOAT=y
+DO_C99_MATH=y
+# DO_XSI_MATH is not set
+UCLIBC_HAS_FENV=y
+KERNEL_HEADERS=""
+UCLIBC_UCLINUX_BROKEN_MUNMAP=y
+HAVE_DOT_CONFIG=y
+
+#
+# General Library Settings
+#
+DOPIC=y
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+# LDSO_PRELOAD_ENV_SUPPORT is not set
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+# LDSO_STANDALONE_SUPPORT is not set
+# LDSO_PRELINK_SUPPORT is not set
+# UCLIBC_STATIC_LDCONFIG is not set
+LDSO_RUNPATH=y
+LDSO_SAFE_RUNPATH=y
+LDSO_SEARCH_INTERP_PATH=y
+LDSO_LD_LIBRARY_PATH=y
+# LDSO_NO_CLEANUP is not set
+UCLIBC_CTOR_DTOR=y
+# LDSO_GNU_HASH_SUPPORT is not set
+# HAS_NO_THREADS is not set
+LINUXTHREADS_OLD=y
+# LINUXTHREADS_NEW is not set
+# UCLIBC_HAS_THREADS_NATIVE is not set
+UCLIBC_HAS_THREADS=y
+# PTHREADS_DEBUG_SUPPORT is not set
+UCLIBC_HAS_SYSLOG=y
+UCLIBC_HAS_LFS=y
+MALLOC=y
+# MALLOC_SIMPLE is not set
+MALLOC_GLIBC_COMPAT=y
+UCLIBC_HAS_OBSTACK=y
+UCLIBC_DYNAMIC_ATEXIT=y
+COMPAT_ATEXIT=y
+UCLIBC_SUSV2_LEGACY=y
+UCLIBC_SUSV3_LEGACY=y
+# UCLIBC_SUSV3_LEGACY_MACROS is not set
+UCLIBC_SUSV4_LEGACY=y
+# UCLIBC_STRICT_HEADERS is not set
+# UCLIBC_HAS_STUBS is not set
+UCLIBC_HAS_SHADOW=y
+UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
+UCLIBC_HAS___PROGNAME=y
+UCLIBC_HAS_PTY=y
+ASSUME_DEVPTS=y
+UNIX98PTY_ONLY=y
+UCLIBC_HAS_GETPT=y
+UCLIBC_HAS_LIBUTIL=y
+UCLIBC_HAS_TM_EXTENSIONS=y
+UCLIBC_HAS_TZ_CACHING=y
+UCLIBC_HAS_TZ_FILE=y
+UCLIBC_HAS_TZ_FILE_READ_MANY=y
+UCLIBC_TZ_FILE_PATH="/etc/TZ"
+UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
+
+#
+# Advanced Library Settings
+#
+UCLIBC_PWD_BUFFER_SIZE=256
+UCLIBC_GRP_BUFFER_SIZE=256
+
+#
+# Support various families of functions
+#
+UCLIBC_LINUX_MODULE_26=y
+UCLIBC_LINUX_SPECIFIC=y
+UCLIBC_HAS_GNU_ERROR=y
+UCLIBC_BSD_SPECIFIC=y
+UCLIBC_HAS_BSD_ERR=y
+UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
+# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
+# UCLIBC_NTP_LEGACY is not set
+UCLIBC_SV4_DEPRECATED=y
+UCLIBC_HAS_REALTIME=y
+UCLIBC_HAS_ADVANCED_REALTIME=y
+UCLIBC_HAS_EPOLL=y
+UCLIBC_HAS_XATTR=y
+# UCLIBC_HAS_PROFILING is not set
+UCLIBC_HAS_CRYPT_IMPL=y
+# UCLIBC_HAS_SHA256_CRYPT_IMPL is not set
+# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set
+UCLIBC_HAS_CRYPT=y
+UCLIBC_HAS_NETWORK_SUPPORT=y
+UCLIBC_HAS_SOCKET=y
+UCLIBC_HAS_IPV4=y
+UCLIBC_HAS_IPV6=y
+# UCLIBC_HAS_RPC is not set
+UCLIBC_USE_NETLINK=y
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
+UCLIBC_HAS_BSD_RES_CLOSE=y
+UCLIBC_HAS_COMPAT_RES_STATE=y
+# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
+UCLIBC_HAS_RESOLVER_SUPPORT=y
+UCLIBC_HAS_LIBRESOLV_STUB=y
+UCLIBC_HAS_LIBNSL_STUB=y
+
+#
+# String and Stdio Support
+#
+UCLIBC_HAS_STRING_GENERIC_OPT=y
+UCLIBC_HAS_STRING_ARCH_OPT=y
+UCLIBC_HAS_CTYPE_TABLES=y
+UCLIBC_HAS_CTYPE_SIGNED=y
+# UCLIBC_HAS_CTYPE_UNSAFE is not set
+UCLIBC_HAS_CTYPE_CHECKED=y
+# UCLIBC_HAS_CTYPE_ENFORCED is not set
+UCLIBC_HAS_WCHAR=y
+# UCLIBC_HAS_LOCALE is not set
+UCLIBC_HAS_HEXADECIMAL_FLOATS=y
+UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
+UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
+# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
+UCLIBC_HAS_STDIO_BUFSIZ_4096=y
+# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
+UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
+# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
+UCLIBC_HAS_STDIO_GETC_MACRO=y
+UCLIBC_HAS_STDIO_PUTC_MACRO=y
+UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
+# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
+UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
+# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
+UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
+UCLIBC_HAS_PRINTF_M_SPEC=y
+UCLIBC_HAS_ERRNO_MESSAGES=y
+# UCLIBC_HAS_SYS_ERRLIST is not set
+UCLIBC_HAS_SIGNUM_MESSAGES=y
+# UCLIBC_HAS_SYS_SIGLIST is not set
+UCLIBC_HAS_GNU_GETOPT=y
+UCLIBC_HAS_GNU_GETSUBOPT=y
+
+#
+# Big and Tall
+#
+UCLIBC_HAS_REGEX=y
+# UCLIBC_HAS_REGEX_OLD is not set
+UCLIBC_HAS_FNMATCH=y
+# UCLIBC_HAS_FNMATCH_OLD is not set
+UCLIBC_HAS_WORDEXP=y
+UCLIBC_HAS_NFTW=y
+UCLIBC_HAS_FTW=y
+UCLIBC_HAS_FTS=y
+UCLIBC_HAS_GLOB=y
+UCLIBC_HAS_GNU_GLOB=y
+UCLIBC_HAS_UTMPX=y
+
+#
+# Library Installation Options
+#
+RUNTIME_PREFIX="/"
+DEVEL_PREFIX="/usr/"
+MULTILIB_DIR="lib"
+HARDWIRED_ABSPATH=y
+
+#
+# Security options
+#
+UCLIBC_HAS_ARC4RANDOM=y
+# ARC4RANDOM_USES_NODEV is not set
+# UCLIBC_HAS_SSP is not set
+UCLIBC_BUILD_RELRO=y
+UCLIBC_BUILD_NOW=y
+UCLIBC_BUILD_NOEXECSTACK=y
+
+#
+# Development/debugging options
+#
+CROSS_COMPILER_PREFIX=""
+UCLIBC_EXTRA_CFLAGS=""
+# DODEBUG is not set
+# DODEBUG_PT is not set
+# DOSTRIP is not set
+# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
+# UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_HAS_BACKTRACE is not set
+WARNINGS="-Wall"
+# EXTRA_WARNINGS is not set
+# DOMULTI is not set
+# UCLIBC_MJN3_ONLY is not set

+ 4 - 0
target/config/Config.in.cpu

@@ -110,6 +110,9 @@ config ADK_CPU_ARMV8
 config ADK_CPU_CF_5208
 	boolean
 
+config ADK_CPU_BFIN
+	boolean
+
 config ADK_TARGET_CPU_ARCH
 	string
 	default "aarch64" if ADK_LINUX_AARCH64 && ADK_little
@@ -118,6 +121,7 @@ config ADK_TARGET_CPU_ARCH
 	default "armv6" if ADK_LINUX_ARM && ADK_little && ADK_armv6
 	default "armv7a" if ADK_LINUX_ARM && ADK_little && ADK_armv7a
 	default "arm" if ADK_LINUX_ARM && ADK_little
+	default "bfin" if ADK_CPU_BFIN
 	default "i486" if ADK_CPU_I486
 	default "i586" if ADK_CPU_I586
 	default "i686" if ADK_CPU_I686

+ 49 - 0
target/config/Config.in.toolchain

@@ -145,4 +145,53 @@ config ADK_UCLIBC_TEST
 	depends on ADK_TARGET_LIB_UCLIBC_NG || ADK_TARGET_LIB_UCLIBC
 	default y
 
+choice
+prompt "GCC version"
+depends on !ADK_CHOOSE_TARGET_SYSTEM && !ADK_CHOOSE_TARGET_ARCH
+
+config ADK_TOOLCHAIN_GCC_4_5_4
+	prompt "4.5.4"
+	boolean
+	depends on ADK_LINUX_BFIN
+
+config ADK_TOOLCHAIN_GCC_4_8_3
+	prompt "4.8.3"
+	boolean
+	depends on !ADK_LINUX_BFIN
+
+config ADK_TOOLCHAIN_GCC_4_9_1
+	prompt "4.9.1"
+	boolean
+	depends on !ADK_LINUX_BFIN
+
+config ADK_TOOLCHAIN_GCC_GIT
+	prompt "git"
+	boolean
+	select ADK_DISABLE_CHECKSUM
+	depends on !ADK_LINUX_BFIN
+
+endchoice
+
+choice
+prompt "Binutils version"
+depends on !ADK_CHOOSE_TARGET_SYSTEM && !ADK_CHOOSE_TARGET_ARCH
+
+config ADK_TOOLCHAIN_BINUTILS_2_22
+	prompt "2.22"
+	boolean
+	depends on ADK_LINUX_BFIN
+
+config ADK_TOOLCHAIN_BINUTILS_2_24
+	prompt "2.24"
+	boolean
+	depends on !ADK_LINUX_BFIN
+
+config ADK_TOOLCHAIN_BINUTILS_GIT
+	prompt "git"
+	boolean
+	select ADK_DISABLE_CHECKSUM
+	depends on !ADK_LINUX_BFIN
+
+endchoice
+
 endmenu

+ 9 - 0
toolchain/binutils/Makefile.inc

@@ -2,8 +2,17 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		binutils
+ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_24),y)
 PKG_VERSION:=		2.24
 PKG_MD5SUM:=		a5dd5dd2d212a282cc1d4a84633e0d88
 PKG_RELEASE:=		1
 PKG_SITES:=		${MASTER_SITE_GNU:=binutils/}
+DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
+endif
+ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_22),y)
+PKG_VERSION:=		2.22
+PKG_MD5SUM:=		a5dd5dd2d212a282cc1d4a84633e0d88
+PKG_RELEASE:=		1
+PKG_SITES:=		${MASTER_SITE_GNU:=binutils/}
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.gz
+endif

+ 1 - 1
toolchain/gcc/Makefile

@@ -44,7 +44,7 @@ else
 GCC_CONFOPTS+=         --disable-tls --disable-threads --disable-libatomic
 endif
 
-ifneq ($(ADK_LINUX_AARCH64)$(ADK_LINUX_ALPHA)$(ADK_LINUX_XTENSA)$(ADK_LINUX_M68K),y)
+ifneq ($(ADK_LINUX_AARCH64)$(ADK_LINUX_ALPHA)$(ADK_LINUX_BFIN)$(ADK_LINUX_XTENSA)$(ADK_LINUX_M68K),y)
 GCC_FINAL_CONFOPTS+=	--enable-cxx-flags='$(TARGET_CXXFLAGS)'
 endif
 

+ 14 - 3
toolchain/gcc/Makefile.inc

@@ -2,13 +2,24 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		gcc
-ifeq ($(ADK_LINUX_AARCH64),y)
+ifeq ($(ADK_TOOLCHAIN_GCC_4_9_1),y)
 PKG_VERSION:=		4.9.1
 PKG_MD5SUM:=		b188a3c9be25ddbf36b4fa6f04aaafaa
-else
+PKG_SITES:=		${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/}
+PKG_RELEASE:=		1
+DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
+endif
+ifeq ($(ADK_TOOLCHAIN_GCC_4_8_3),y)
 PKG_VERSION:=		4.8.3
 PKG_MD5SUM:=		e2c60f5ef918be2db08df96c7d97d0c4
-endif
+PKG_SITES:=		${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/}
 PKG_RELEASE:=		1
+DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
+endif
+ifeq ($(ADK_TOOLCHAIN_GCC_4_5_4),y)
+PKG_VERSION:=		4.5.4
+PKG_MD5SUM:=		e2c60f5ef918be2db08df96c7d97d0c4
 PKG_SITES:=		${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/}
+PKG_RELEASE:=		1
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.gz
+endif

+ 232 - 0
toolchain/gcc/patches/4.5.4/cflags-honour.patch

@@ -0,0 +1,232 @@
+diff -Nur gcc-4.5.4.orig/gcc/common.opt gcc-4.5.4/gcc/common.opt
+--- gcc-4.5.4.orig/gcc/common.opt	2010-03-18 04:01:09.000000000 +0100
++++ gcc-4.5.4/gcc/common.opt	2014-08-29 11:25:51.000000000 +0200
+@@ -105,6 +105,10 @@
+ Common Joined
+ Treat specified warning as error
+ 
++Werror-maybe-reset
++Common
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
++
+ Wextra
+ Common Var(extra_warnings) Warning
+ Print extra (possibly unwanted) warnings
+@@ -613,6 +617,9 @@
+ Common Report Var(flag_guess_branch_prob) Optimization
+ Enable guessing of branch probabilities
+ 
++fhonour-copts
++Common RejectNegative
++
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
+ ; Generate position-independent code for executables if possible
+ ; On SVR4 targets, it also controls whether or not to emit a
+diff -Nur gcc-4.5.4.orig/gcc/c.opt gcc-4.5.4/gcc/c.opt
+--- gcc-4.5.4.orig/gcc/c.opt	2010-04-02 21:54:46.000000000 +0200
++++ gcc-4.5.4/gcc/c.opt	2014-08-29 11:25:51.000000000 +0200
+@@ -219,6 +219,10 @@
+ C ObjC RejectNegative Warning
+ This switch is deprecated; use -Werror=implicit-function-declaration instead
+ 
++Werror-maybe-reset
++C ObjC C++ ObjC++
++; Documented in common.opt
++
+ Wfloat-equal
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
+ Warn if testing floating point numbers for equality
+@@ -633,6 +637,9 @@
+ fhonor-std
+ C++ ObjC++
+ 
++fhonour-copts
++C ObjC C++ ObjC++ RejectNegative
++
+ fhosted
+ C ObjC
+ Assume normal C execution environment
+diff -Nur gcc-4.5.4.orig/gcc/c-opts.c gcc-4.5.4/gcc/c-opts.c
+--- gcc-4.5.4.orig/gcc/c-opts.c	2010-04-02 21:54:46.000000000 +0200
++++ gcc-4.5.4/gcc/c-opts.c	2014-08-29 11:25:51.000000000 +0200
+@@ -106,6 +106,9 @@
+ /* Number of deferred options scanned for -include.  */
+ static size_t include_cursor;
+ 
++/* Check if a port honours COPTS.  */
++static int honour_copts = 0;
++
+ static void set_Wimplicit (int);
+ static void handle_OPT_d (const char *);
+ static void set_std_cxx98 (int);
+@@ -472,6 +475,9 @@
+       enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC);
+       break;
+ 
++    case OPT_Werror_maybe_reset:
++      break;
++
+     case OPT_Wformat:
+       set_Wformat (value);
+       break;
+@@ -704,6 +710,12 @@
+       flag_exceptions = value;
+       break;
+ 
++    case OPT_fhonour_copts:
++      if (c_language == clk_c) {
++	honour_copts++;
++      }
++      break;
++
+     case OPT_fimplement_inlines:
+       flag_implement_inlines = value;
+       break;
+@@ -1240,6 +1252,47 @@
+       return false;
+     }
+ 
++  if (c_language == clk_c) {
++    char *ev = getenv ("GCC_HONOUR_COPTS");
++    int evv;
++    if (ev == NULL)
++      evv = -1;
++    else if ((*ev == '0') || (*ev == '\0'))
++      evv = 0;
++    else if (*ev == '1')
++      evv = 1;
++    else if (*ev == '2')
++      evv = 2;
++    else if (*ev == 's')
++      evv = -1;
++    else {
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
++    }
++    if (evv == 1) {
++      if (honour_copts == 0) {
++	error ("someone does not honour COPTS at all in lenient mode");
++	return false;
++      } else if (honour_copts != 1) {
++	warning (0, "someone does not honour COPTS correctly, passed %d times",
++	 honour_copts);
++      }
++    } else if (evv == 2) {
++      if (honour_copts == 0) {
++	error ("someone does not honour COPTS at all in strict mode");
++	return false;
++      } else if (honour_copts != 1) {
++	error ("someone does not honour COPTS correctly, passed %d times",
++	 honour_copts);
++	return false;
++      }
++    } else if (evv == 0) {
++      if (honour_copts != 1)
++	inform (0, "someone does not honour COPTS correctly, passed %d times",
++	 honour_copts);
++    }
++  }
++
+   return true;
+ }
+ 
+diff -Nur gcc-4.5.4.orig/gcc/doc/cppopts.texi gcc-4.5.4/gcc/doc/cppopts.texi
+--- gcc-4.5.4.orig/gcc/doc/cppopts.texi	2010-04-02 21:54:46.000000000 +0200
++++ gcc-4.5.4/gcc/doc/cppopts.texi	2014-08-29 11:25:51.000000000 +0200
+@@ -164,6 +164,11 @@
+ Make all warnings into hard errors.  Source code which triggers warnings
+ will be rejected.
+ 
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
+ @item -Wsystem-headers
+ @opindex Wsystem-headers
+ Issue warnings for code in system headers.  These are normally unhelpful
+diff -Nur gcc-4.5.4.orig/gcc/doc/invoke.texi gcc-4.5.4/gcc/doc/invoke.texi
+--- gcc-4.5.4.orig/gcc/doc/invoke.texi	2011-03-23 23:03:29.000000000 +0100
++++ gcc-4.5.4/gcc/doc/invoke.texi	2014-08-29 11:25:51.000000000 +0200
+@@ -4324,6 +4324,22 @@
+ @option{-Wall} and by @option{-pedantic}, which can be disabled with
+ @option{-Wno-pointer-sign}.
+ 
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
++ at item -fhonour-copts
++ at opindex fhonour-copts
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
++given at least once, and warn if it is given more than once.
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
++given exactly once.
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
++is not given exactly once.
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
++This flag and environment variable only affect the C language.
++
+ @item -Wstack-protector
+ @opindex Wstack-protector
+ @opindex Wno-stack-protector
+@@ -6076,7 +6092,7 @@
+ second branch or a point immediately following it, depending on whether
+ the condition is known to be true or false.
+ 
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
++Enabled at levels @option{-O3}.
+ 
+ @item -fsplit-wide-types
+ @opindex fsplit-wide-types
+diff -Nur gcc-4.5.4.orig/gcc/java/jvspec.c gcc-4.5.4/gcc/java/jvspec.c
+--- gcc-4.5.4.orig/gcc/java/jvspec.c	2010-01-20 11:35:38.000000000 +0100
++++ gcc-4.5.4/gcc/java/jvspec.c	2014-08-29 11:25:51.000000000 +0200
+@@ -667,6 +667,7 @@
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
+      is correct.  */ 
+   set_input (concat (main_class_name, "main.c", NULL));
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
+   err = do_spec (jvgenmain_spec);
+   if (err == 0)
+     {
+diff -Nur gcc-4.5.4.orig/gcc/opts.c gcc-4.5.4/gcc/opts.c
+--- gcc-4.5.4.orig/gcc/opts.c	2010-05-17 12:13:28.000000000 +0200
++++ gcc-4.5.4/gcc/opts.c	2014-08-29 11:25:51.000000000 +0200
+@@ -897,8 +897,6 @@
+   flag_schedule_insns_after_reload = opt2;
+ #endif
+   flag_regmove = opt2;
+-  flag_strict_aliasing = opt2;
+-  flag_strict_overflow = opt2;
+   flag_reorder_blocks = opt2;
+   flag_reorder_functions = opt2;
+   flag_tree_vrp = opt2;
+@@ -918,6 +916,8 @@
+ 
+   /* -O3 optimizations.  */
+   opt3 = (optimize >= 3);
++  flag_strict_aliasing = opt3;
++  flag_strict_overflow = opt3;
+   flag_predictive_commoning = opt3;
+   flag_inline_functions = opt3;
+   flag_unswitch_loops = opt3;
+@@ -1646,6 +1646,17 @@
+       enable_warning_as_error (arg, value, lang_mask);
+       break;
+ 
++    case OPT_Werror_maybe_reset:
++      {
++	char *ev = getenv ("GCC_NO_WERROR");
++	if ((ev != NULL) && (*ev != '0'))
++	  warnings_are_errors = 0;
++      }
++      break;
++
++    case OPT_fhonour_copts:
++      break;
++
+     case OPT_Wlarger_than_:
+       /* This form corresponds to -Wlarger-than-.
+ 	 Kept for backward compatibility.