From 483993c24194cb4c3254e85fc81ed14fa60bb7a2 Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pjm@nac.net>
Date: Tue, 04 Jun 2013 20:11:15 -0400
Subject: Also edit MULTILIB_OSDIRNAMES in target fragment.

The GCC Internals manual (gcc/doc/fragments.texi) says:

> For configurations that support both multilib and multiarch,
> MULTILIB_OSDIRNAMES also encodes the multiarch name, thus subsuming
> MULTIARCH_DIRNAME.
>
[...]
>
> MULTIARCH_DIRNAME is not used for configurations that support both multilib
> and multiarch.  In that case, multiarch names are encoded in
> MULTILIB_OSDIRNAMES instead.

This sounds like the makefile macro used depends on the build-time user
configuration; that is, the options --disable-multilib and --enable-multiarch
should cause MULTIARCH_DIRNAME to be used.

Instead, it seems MULTILIB_OSDIRNAMES is used, even if multilib is disabled.  So
apparently, "configurations that support both" means GCC target configurations
that support both features, not build-time user configurations that enable them.
---
diff --git a/build b/build
index 5cb597b..580773f 100755
--- a/build
+++ b/build
@@ -82,6 +82,10 @@ $(build_targets): configure
 	sed "s|^\($${define_pattern}\) \".*\"$$|\1 \"$(elf_interp)\"|" \
 		"src/gcc/config/$${gcc_config_file}~" \
 		>"src/gcc/config/$${gcc_config_file}"; \
+	sed "$${gcc_config_fragment_script}" \
+		>"src/gcc/config/$${gcc_config_fragment}~"; \
+	mv "src/gcc/config/$${gcc_config_fragment}~" \
+		"src/gcc/config/$${gcc_config_fragment}"; \
 	printf '\nMULTIARCH_DIRNAME = %s\n' "$(target)" \
 		>>"src/gcc/config/$${gcc_config_fragment}"
 	if [ "x$(target)" = 'x$(OPK_HOST_ARCH)' ]; then \
diff --git a/targets.d/core-linux-eglibc.sh b/targets.d/core-linux-eglibc.sh
index f93eddc..e4b0017 100644
--- a/targets.d/core-linux-eglibc.sh
+++ b/targets.d/core-linux-eglibc.sh
@@ -1,3 +1,4 @@
 gcc_config_file='i386/linux64.h'
 gcc_config_interp_macro='GLIBC_DYNAMIC_LINKER64'
 gcc_config_fragment='i386/t-linux64'
+gcc_config_fragment_script='s/\(m64=.*:\)x86_64-linux-gnu/\1core-linux-eglibc/'
--
cgit v0.9.1