buildgcc: work around bug in --print-librt-file-name

Running "clang -target i386-elf --print-librt-file-name" prints
[..]/bin/../lib/clang/3.6.1/lib/libclang_rt.builtins-i386.a

However, the correct path is [..]/lib/linux/libclang_rt.builtins-i386.a
on a Linux host. Hence, create symbolic links to make sure that our
build system finds the file where it expects it.

Change-Id: I21ef5c4a690d83c326717ca55c5ace558257a0ec
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/10815
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index e0b4ed4..367f4d1 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -480,6 +480,13 @@
 
 	cp -a ../$CFE_DIR/tools/scan-build/* $DESTDIR$TARGETDIR/bin
 	cp -a ../$CFE_DIR/tools/scan-view/* $DESTDIR$TARGETDIR/bin
+
+	# create symlinks to work around broken --print-librt-file-name
+	# when used with -target.
+	cd $DESTDIR$TARGETDIR/lib/clang/${CLANG_VERSION}/lib
+	for i in */libclang_rt.builtins*.a; do
+		ln -s $i .
+	done
 }
 
 printf "${blue}Welcome to the ${red}coreboot${blue} cross toolchain builder v$CROSSGCC_VERSION ($CROSSGCC_DATE)${NC}\n\n"