diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-02 11:52:47 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-05 05:42:38 -0400 |
commit | 7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch) | |
tree | 8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/check_ld_copy_bug.m4 | |
parent | 6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff) | |
download | haskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz |
Break up aclocal.m4
Diffstat (limited to 'm4/check_ld_copy_bug.m4')
-rw-r--r-- | m4/check_ld_copy_bug.m4 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/m4/check_ld_copy_bug.m4 b/m4/check_ld_copy_bug.m4 new file mode 100644 index 0000000000..a2d3c4ee93 --- /dev/null +++ b/m4/check_ld_copy_bug.m4 @@ -0,0 +1,61 @@ +# CHECK_LD_COPY_BUG() +# ------------------- +# Check for binutils bug #16177 present in some versions of the bfd ld +# implementation affecting ARM relocations. +# https://sourceware.org/bugzilla/show_bug.cgi?id=16177 +# +# $1 = the platform +# +AC_DEFUN([CHECK_LD_COPY_BUG],[ + case $1 in + arm*linux*) + AC_CHECK_TARGET_TOOL([READELF], [readelf]) + AC_CHECK_TARGET_TOOL([AS], [as]) + AC_MSG_CHECKING([for ld bug 16177]) + cat >actest.s <<-EOF + .globl _start + .p2align 4 + _start: + bkpt + + .data + .globl data_object + object_reference: + .long data_object + .size object_reference, 4 +EOF + + cat >aclib.s <<-EOF + .data + .globl data_object + .type data_object, %object + .size data_object, 4 + data_object: + .long 123 +EOF + + $AS -o aclib.o aclib.s + $LD -shared -o aclib.so aclib.o + + $AS -o actest.o actest.s + $LD -o actest actest.o aclib.so + + if $READELF -r actest | grep R_ARM_COPY > /dev/null; then + AC_MSG_RESULT([affected]) + AC_MSG_ERROR( + [Your linker is affected by binutils #16177, which + critically breaks linkage of GHC objects. Please either upgrade + binutils or supply a different linker with the LD environment + variable.]) + else + AC_MSG_RESULT([unaffected]) + fi + + rm -f aclib.s aclib.o aclib.so actest.s actest.o actest + ;; + *) + ;; + esac +]) + + |