diff options
author | Adam Sandberg Ericsson <adam@sandbergericsson.se> | 2021-05-07 22:11:50 +0100 |
---|---|---|
committer | Adam Sandberg Ericsson <adam@sandbergericsson.se> | 2021-05-16 14:09:59 +0100 |
commit | 32823b772804fb03456e35be42fd4afdc2c35d14 (patch) | |
tree | d93bec1f582ba3ba20148bad96eea0a4eca153bf | |
parent | 6859f9ee6a20c87ef13ab261499285f003b34335 (diff) | |
download | haskell-wip/adamse/dtrace-on-linux.tar.gz |
configure: check for ld.gold bug 27775 and disable DTrace probes for linux in CIwip/adamse/dtrace-on-linux
-rw-r--r-- | .gitlab-ci.yml | 8 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | m4/check_for_gold_t27775.m4 | 55 |
3 files changed, 68 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 098c313a12..4c9014f32a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -862,7 +862,7 @@ nightly-i386-linux-deb9: variables: TEST_ENV: "x86_64-linux-deb9" BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-deb9-linux.tar.xz" - CONFIGURE_ARGS: "" + CONFIGURE_ARGS: "--disable-dtrace" cache: key: linux-x86_64-deb9 @@ -960,7 +960,7 @@ validate-x86_64-linux-deb9-dwarf: variables: TEST_ENV: "x86_64-linux-deb10" BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-deb10-linux.tar.xz" - CONFIGURE_ARGS: "" + CONFIGURE_ARGS: "--disable-dtrace" cache: key: linux-x86_64-deb10 @@ -1088,7 +1088,7 @@ nightly-x86_64-linux-alpine: BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-centos7-linux.tar.xz" # CentOS seems to default to ascii LANG: "en_US.UTF-8" - CONFIGURE_ARGS: "" + CONFIGURE_ARGS: "--disable-dtrace" cache: key: linux-x86_64-centos7 @@ -1109,7 +1109,7 @@ release-x86_64-linux-centos7: LLC: /bin/false OPT: /bin/false TEST_ENV: "x86_64-linux-fedora27" - CONFIGURE_ARGS: "" + CONFIGURE_ARGS: "--disable-dtrace" cache: key: linux-x86_64-fedora27 artifacts: diff --git a/configure.ac b/configure.ac index 5ff8c5b782..0c2d247250 100644 --- a/configure.ac +++ b/configure.ac @@ -908,6 +908,15 @@ if test "x$EnableDtrace" = "xyes"; then fi fi +if test "x$EnableDtrace" = "xyes" \ + -a test "x$HaveDtrace" = "xYES" \ + -a "x$TargetOS_CPP-$TargetVendor_CPP" = "xlinux-unknown"; then + CHECK_FOR_GOLD_T27775([$LD]) + if test "$result" = "1"; then + AC_MSG_WARN([ld.gold is affected by binutils bug 27775. The RTS dtrace probes will not work with statically linked executables. Use a different linker if you need this.]) + fi +fi + AC_SUBST(HaveDtrace) dnl ** check for libsystemtap diff --git a/m4/check_for_gold_t27775.m4 b/m4/check_for_gold_t27775.m4 new file mode 100644 index 0000000000..0047472bf5 --- /dev/null +++ b/m4/check_for_gold_t27775.m4 @@ -0,0 +1,55 @@ +# CHECK_FOR_GOLD_T27775 +# ---------------------- +# +# Test for binutils #27775. +# +# Uses test from +# https://sourceware.org/bugzilla/show_bug.cgi?id=27775 +# +# $1 = linker to test +# Sets $result to 0 if not affected, 1 otherwise +AC_DEFUN([CHECK_FOR_GOLD_T27775],[ + AC_REQUIRE([FIND_LD]) + AC_MSG_CHECKING([for ld.gold gc-sections with note section bug (binutils 27775)]) + if ! $1 --version | grep -q "GNU gold"; then + # Not gold + result=0 + else + FPTOOLS_WRITE_FILE([conftest.a.s], [ + .section .note.stapsdt,"?","note" + .dc.a _.stapsdt.base + .section .stapsdt.base,"aG","progbits",.stapsdt.base,comdat + _.stapsdt.base: .space 1 + .size _.stapsdt.base,1 + ]) + + FPTOOLS_WRITE_FILE([conftest.b.s], [ + .text + .global start /* Used by SH targets. */ + start: + .global _start + _start: + .global __start + __start: + .global main /* Used by HPPA targets. */ + main: + .dc.a 0 + ]) + + $CC -c -o conftest.a.o conftest.a.s || AC_MSG_ERROR([Failed to compile test]) + $CC -c -o conftest.b.o conftest.b.s || AC_MSG_ERROR([Failed to compile test]) + if $1 --gc-sections -o conftest conftest.a.o conftest.b.o; then + AC_MSG_RESULT([not affected]) + result=0 + else + AC_MSG_RESULT([affected]) + result=1 + fi + + rm -f conftest.a.o conftest.a.s conttest.b.o conftest.b.c conftest + + if test "$result" = "1"; then + AC_MSG_ERROR([ld.gold suffers from bugs with dtrace probes, turn off dtrace or use another linker]) + fi + fi +]) |