[Git][ghc/ghc][wip/T17962b] hi
Ben Gamari
gitlab at gitlab.haskell.org
Mon Aug 3 13:05:15 UTC 2020
Ben Gamari pushed to branch wip/T17962b at Glasgow Haskell Compiler / GHC
Commits:
8f897318 by Ben Gamari at 2020-08-03T09:05:05-04:00
hi
- - - - -
1 changed file:
- aclocal.m4
Changes:
=====================================
aclocal.m4
=====================================
@@ -2531,102 +2531,102 @@ AC_DEFUN([FIND_LD],[
])
-# FIND_MERGE_OBJECTS
-# ------------------
-# Find which linker to use to merge object files.
+# CHECK_FOR_GOLD_T22266
+# ----------------------
#
-AC_DEFUN([FIND_MERGE_OBJECTS],[
- AC_REQUIRE([FIND_LD])
+# Test for binutils #22266. This bug manifested as GHC bug #14328 (see also:
+# #14675, #14291).
+# Uses test from
+# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bfb739b525703bfe23f151d09e9beee3a2afe
+#
+# $1 = linker to test
+# Sets $result to 0 if not affected, 1 otherwise
+AC_DEFUN([CHECK_FOR_GOLD_T22266],[
+ AC_MSG_CHECKING([for ld.gold object merging bug (binutils 22266)])
+ if ! $1 --version | grep -v -q "GNU gold"; then
+ # Not gold
+ result=0
+ elif test "$cross_compiling" = "yes"; then
+ AC_MSG_RESULT([cross-compiling, assuming LD can merge objects correctly.])
+ result=0
+ else
+ FPTOOLS_WRITE_FILE([conftest.a.c], [
+ __attribute__((section(".data.a")))
+ static int int_from_a_1 = 0x11223344;
- # check_for_T22266
- # ------------------
- #
- # Test for binutils #22266. This bug manifested as GHC bug #14328 (see also: #14675, #14291).
- # Uses test from
- # https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bfb739b525703bfe23f151d09e9beee3a2afe
- #
- # $1 = linker to test
- # Returns 0 if not affected, 1 otherwise
- check_for_T22266() {
- AC_MSG_CHECKING([for ld.gold object merging bug (binutils 22266)])
- if ! $1 --version | grep -v -q "GNU gold"; then
- # Not gold
- return 0
- elif test "$cross_compiling" = "yes"; then
- AC_MSG_RESULT([cross-compiling, assuming LD can merge objects correctly.])
- return 0
- else
- FPTOOLS_WRITE_FILE([conftest.a.c], [
- __attribute__((section(".data.a")))
- static int int_from_a_1 = 0x11223344;
+ __attribute__((section(".data.rel.ro.a")))
+ int *p_int_from_a_2 = &int_from_a_1;
- __attribute__((section(".data.rel.ro.a")))
- int *p_int_from_a_2 = &int_from_a_1;
+ const char *hello (void);
- const char *hello (void);
+ const char *
+ hello (void)
+ {
+ return "XXXHello, world!" + 3;
+ }
+ ])
- const char *
- hello (void)
- {
- return "XXXHello, world!" + 3;
- }
- ])
+ FPTOOLS_WRITE_FILE([conftest.main.c], [
+ #include <stdlib.h>
+ #include <string.h>
- FPTOOLS_WRITE_FILE([conftest.main.c], [
- #include <stdlib.h>
- #include <string.h>
+ extern int *p_int_from_a_2;
+ extern const char *hello (void);
- extern int *p_int_from_a_2;
- extern const char *hello (void);
+ int main (void) {
+ if (*p_int_from_a_2 != 0x11223344)
+ abort ();
+ if (strcmp(hello(), "Hello, world!") != 0)
+ abort ();
+ return 0;
+ }
+ ])
- int main (void) {
- if (*p_int_from_a_2 != 0x11223344)
- abort ();
- if (strcmp(hello(), "Hello, world!") != 0)
- abort ();
- return 0;
+ FPTOOLS_WRITE_FILE([conftest.t], [
+ SECTIONS
+ {
+ .text : {
+ *(.text*)
}
- ])
-
- FPTOOLS_WRITE_FILE([conftest.t], [
- SECTIONS
+ .rodata :
{
- .text : {
- *(.text*)
- }
- .rodata :
- {
- *(.rodata .rodata.* .gnu.linkonce.r.*)
- }
- .data.rel.ro : {
- *(.data.rel.ro*)
- }
- .data : {
- *(.data*)
- }
- .bss : {
- *(.bss*)
- }
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ }
+ .data.rel.ro : {
+ *(.data.rel.ro*)
+ }
+ .data : {
+ *(.data*)
}
- ])
+ .bss : {
+ *(.bss*)
+ }
+ }
+ ])
- $CC -c -o conftest.a.o conftest.a.c || AC_MSG_ERROR([Failed to compile test])
- $SettingsMergeObjectsCommand $SettingsMergeObjectsFlags -T conftest.t conftest.a.o -o conftest.ar.o || AC_MSG_ERROR([Failed to merge test object])
+ $CC -c -o conftest.a.o conftest.a.c || AC_MSG_ERROR([Failed to compile test])
+ $SettingsMergeObjectsCommand $SettingsMergeObjectsFlags -T conftest.t conftest.a.o -o conftest.ar.o || AC_MSG_ERROR([Failed to merge test object])
- $CC -c -o conftest.main.o conftest.main.c || AC_MSG_ERROR([Failed to compile test driver])
- $CC conftest.ar.o conftest.main.o -o conftest || AC_MSG_ERROR([Failed to link test driver])
+ $CC -c -o conftest.main.o conftest.main.c || AC_MSG_ERROR([Failed to compile test driver])
+ $CC conftest.ar.o conftest.main.o -o conftest || AC_MSG_ERROR([Failed to link test driver])
- if ./conftest; then
- AC_MSG_RESULT([not affected])
- res=0
- else
- AC_MSG_RESULT([affected])
- res=1
- fi
- rm -f conftest.a.o conftest.a.c conttest.ar.o conftest.main.c conftest.main.o conftest
- return $res
+ if ./conftest; then
+ AC_MSG_RESULT([not affected])
+ result=0
+ else
+ AC_MSG_RESULT([affected])
+ result=1
fi
- }
+ rm -f conftest.a.o conftest.a.c conttest.ar.o conftest.main.c conftest.main.o conftest
+ fi
+])
+
+# FIND_MERGE_OBJECTS
+# ------------------
+# Find which linker to use to merge object files.
+#
+AC_DEFUN([FIND_MERGE_OBJECTS],[
+ AC_REQUIRE([FIND_LD])
if test -z "$SettingsMergeObjectsCommand"; then
SettingsMergeObjectsCommand="$LD"
@@ -2635,16 +2635,17 @@ AC_DEFUN([FIND_MERGE_OBJECTS],[
SettingsMergeObjectsFlags="-r"
fi
- if ! check_for_T22266 "$SettingsMergeObjectsCommand"; then
+ CHECK_FOR_GOLD_T22266($SettingsMergeObjectsCommand)
+ if test "$result" = "1"; then
AC_MSG_NOTICE([$SettingsMergeObjectsCommand is broken due to binutils 22266, looking for another linker...])
SettingsMergeObjectsCommand=""
AC_CHECK_TARGET_TOOL([SettingsMergeObjectsCommand], [ld])
- if ! check_for_T22266 "$SettingsMergeObjectsCommand"; then
+ CHECK_FOR_GOLD_T22266($SettingsMergeObjectsCommand)
+ if test "$result" = "1"; then
AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the SettingsMergeObjectsCommand variable to a functional linker.])
fi
fi
-
if test "$windows" = YES -a "$EnableDistroToolchain" = "NO" -a "$WORD_SIZE" = 64; then
SettingsMergeObjectsFlags="$SettingsMergeObjectsFlags --oformat=pe-bigobj-x86-64"
fi
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f89731825347ad4efe366ccf652fce3f7090605
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f89731825347ad4efe366ccf652fce3f7090605
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200803/c741c327/attachment-0001.html>
More information about the ghc-commits
mailing list