I took away the patch about the -Bxxx not being passed to target libraries
through libtool.
I found a make variable holding flags that will not be trimmed by libtool:
FLAGS_FOR_TARGET.
···11-diff --git a/libgomp/configure b/libgomp/configure
22-index deef673..9e4a790 100755
33---- a/libgomp/configure
44-+++ b/libgomp/configure
55-@@ -23848,6 +23848,11 @@ old_archive_cmds=$lt_old_archive_cmds
66- # A language specific compiler.
77- CC=$lt_compiler
88-99-+# Ugly hack to get libmudflap (and other libraries) to build.
1010-+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
1111-+# to Glibc gets lost. Here we forcibly add it to any invocation.
1212-+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
1313-+
1414- # Is the compiler the GNU compiler?
1515- with_gcc=$GCC
1616-1717-diff --git a/libmudflap/configure b/libmudflap/configure
1818-index ae1be92..4ee1e18 100755
1919---- a/libmudflap/configure
2020-+++ b/libmudflap/configure
2121-@@ -15044,6 +15044,11 @@ old_archive_cmds=$lt_old_archive_cmds
2222- # A language specific compiler.
2323- CC=$lt_compiler
2424-2525-+# Ugly hack to get libmudflap (and other libraries) to build.
2626-+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
2727-+# to Glibc gets lost. Here we forcibly add it to any invocation.
2828-+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
2929-+
3030- # Is the compiler the GNU compiler?
3131- with_gcc=$GCC
3232-3333-diff --git a/libssp/configure b/libssp/configure
3434-index ee2a41f..7f3e1fd 100755
3535---- a/libssp/configure
3636-+++ b/libssp/configure
3737-@@ -12926,6 +12926,11 @@ old_archive_cmds=$lt_old_archive_cmds
3838- # A language specific compiler.
3939- CC=$lt_compiler
4040-4141-+# Ugly hack to get libmudflap (and other libraries) to build.
4242-+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
4343-+# to Glibc gets lost. Here we forcibly add it to any invocation.
4444-+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
4545-+
4646- # Is the compiler the GNU compiler?
4747- with_gcc=$GCC
4848-