changeset 5179:68f0c4f4c893

gcc: do not look in /usr. Allows removal of /usr/lib/gcc, /usr/libexec/gcc from LIBRESTRICT_ALLOW in strict mode.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Wed, 18 Feb 2009 14:40:51 +0100
parents ac0243e3a200
children 3322bb727ce5
files gub/specs/cross/gcc.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/cross/gcc.py	Wed Feb 18 09:23:12 2009 +0100
+++ b/gub/specs/cross/gcc.py	Wed Feb 18 14:40:51 2009 +0100
@@ -14,6 +14,20 @@
         return ['cross/binutils']
     def patch (self):
         cross.AutoBuild.patch (self)
+        # GUB cross compilers must NOT look in /usr.
+        # Fixes librestrict=stat:open and resulting ugliness.
+        for i in ['%(srcdir)s/configure', '%(srcdir)s/gcc/configure']:
+            self.file_sub ([('( *gcc_cv_tool_dirs=.*PATH_SEPARATOR/usr)', r'#\1'), # gcc-4.1.1 gcc/configure
+                            ('( *gcc_cv_tool_dirs=.*gcc_cv_tool_dirs/usr)', r'#\1')], # gcc-4.3.2 ./configure
+                           i)
+        # This seems to have been fixed in gcc-4.3.2, but only if
+        # *not* cross-compiling---a hardcoded lookup in /usr, without
+        # asking configure, still makes no sense to me.  Redirecting
+        # lookups survives gcc-4.1.1--4.3.2, which is more robust than
+        # patching them out.
+        self.file_sub ([('( standard_exec_prefix_.*= ")/usr', r'\1%(system_prefix)s')],
+                       '%(srcdir)s/gcc/gcc.c')
+
         if False and self.settings.build_architecture == self.settings.target_architecture:
             # This makes the target build *not* use /lib* at all, but
             # it produces executables that will only run within the