+# Test if ld's alignment handling is correct. This is a known problem
+# with the linker that ships with Ubuntu 11.04.
+cat - > $TMPFILE1 <<EOF
+const char v1[] __attribute__((section(".text.v1"))) = "0123456789";
+const char v2[] __attribute__((section(".text.v2"))) = "0123456789";
+EOF
+cat - > $TMPFILE1_ld <<EOF
+SECTIONS
+{
+ .mysection 0x88f0 : {
+. = 0x10 ;
+*(.text.v1)
+. = 0x20 ;
+*(.text.v2)
+. = 0x30 ;
+ }
+}
+EOF
+$CC -O -g -c $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1
+$LD -T $TMPFILE1_ld $TMPFILE1o -o $TMPFILE2o > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "The version of LD on this system does not properly handle" > /dev/fd/2
+ echo "alignments. As a result, this project can not be built." > /dev/fd/2
+ echo "" > /dev/fd/2
+ echo "The problem may be the result of this LD bug report:" > /dev/fd/2
+ echo " http://sourceware.org/bugzilla/show_bug.cgi?id=12726" > /dev/fd/2
+ echo "" > /dev/fd/2
+ echo "Please update to a working version of binutils and retry." > /dev/fd/2
+ echo -1
+ exit 0
+fi
+