In the GCC FAQ under "Dynamic linker is unable to find GCC libraries", one
suggestion is to add '-R' or '-rpath' linker option to the *link or *lib 
specs so that the GCC libraries can be found.

E.G. the following line is added to the DRIVER_DEFINES when building gcc
via pkgsrc ('$(LINKER_RPATH_FLAG)' comes from the environment):

  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(libdir) \""

This is needed as the prefix is normally something like '/usr/pkg/gcc47'.

The problem is that this does not allow for multilib os directory's and
there is currently no simple way of dong so.

My solution is to add the '%M' token that expands to multilib_os_dir.

The above line can then be easily change to handle multilib directory's:

  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(libdir)/%M \""


2012-04-27  Steven Drake <s...@netbsd.org>

        * gcc.c (do_spec_1): Add %M spec token to output multilib_os_dir.

--- gcc/gcc.c.orig      2012-02-28 17:31:38.000000000 +0000
+++ gcc/gcc.c
@@ -5115,6 +5115,13 @@ do_spec_1 (const char *spec, int inswitc
              return value;
            break;
 
+         case 'M':
+           if (multilib_os_dir == NULL)
+             obstack_1grow (&obstack, '.');
+           else
+             obstack_grow (&obstack, multilib_os_dir, strlen(multilib_os_dir));
+           break;
+
          case 'G':
            value = do_spec_1 (libgcc_spec, 0, NULL);
            if (value != 0)

-- 
Steven

Reply via email to