Ticket #5543: 0001-FIX-BUILD-on-OS-X-10.5-Check-whether-ld-understands-.patch

File 0001-FIX-BUILD-on-OS-X-10.5-Check-whether-ld-understands-.patch, 4.1 KB (added by thorkilnaur, 3 years ago)

FIX BUILD on OS X 10.5: Check whether ld understands -no_compact_unwind

  • aclocal.m4

    From ee530105908be22c530fe44ddce5b4d733a26b8b Mon Sep 17 00:00:00 2001
    From: Thorkil Naur <[email protected]>
    Date: Wed, 19 Oct 2011 00:20:53 +0200
    Subject: [PATCH] FIX BUILD on OS X 10.5: Check whether ld understands
     -no_compact_unwind
    
    ---
     aclocal.m4                      |   25 +++++++++++++++++++++++++
     compiler/ghc.mk                 |    2 ++
     compiler/main/DriverPipeline.hs |    3 ++-
     configure.ac                    |    1 +
     mk/config.mk.in                 |    4 ++++
     5 files changed, 34 insertions(+), 1 deletions(-)
    
    diff --git a/aclocal.m4 b/aclocal.m4
    index c8c125a..3841ed7 100644
    a b AC_SUBST([LdIsGNULd], [`echo $fp_cv_gnu_ld | sed 'y/yesno/YESNO/'`]) 
    681681])# FP_PROG_LD_IS_GNU 
    682682 
    683683 
     684# FP_PROG_LD_NO_COMPACT_UNWIND 
     685# ---------------------------- 
     686 
     687# Sets the output variable LdHasNoCompactUnwind to YES if ld supports 
     688# -no_compact_unwind, or NO otherwise. 
     689AC_DEFUN([FP_PROG_LD_NO_COMPACT_UNWIND], 
     690[ 
     691AC_CACHE_CHECK([whether ld understands -no_compact_unwind], [fp_cv_ld_no_compact_unwind], 
     692[echo 'foo() {}' > conftest.c 
     693${CC-cc} -c conftest.c 
     694if ${LdCmd} -r -no_compact_unwind -o conftest2.o conftest.o > /dev/null 2>&1; then 
     695   fp_cv_ld_no_compact_unwind=yes 
     696else 
     697   fp_cv_ld_no_compact_unwind=no 
     698fi 
     699rm -rf conftest*]) 
     700if test "$fp_cv_ld_no_compact_unwind" = yes; then 
     701  LdHasNoCompactUnwind=YES 
     702else 
     703  LdHasNoCompactUnwind=NO 
     704fi 
     705AC_SUBST([LdHasNoCompactUnwind]) 
     706])# FP_PROG_LD_NO_COMPACT_UNWIND 
     707 
     708 
    684709# FP_PROG_AR 
    685710# ---------- 
    686711# Sets fp_prog_ar_raw to the full path of ar and fp_prog_ar to a non-Cygwin 
  • compiler/ghc.mk

    diff --git a/compiler/ghc.mk b/compiler/ghc.mk
    index 54dfa3e..4449a14 100644
    a b endif 
    105105        @echo 'cLeadingUnderscore    = "$(LeadingUnderscore)"'              >> $@ 
    106106        @echo 'cRAWCPP_FLAGS         :: String'                             >> $@ 
    107107        @echo 'cRAWCPP_FLAGS         = "$(RAWCPP_FLAGS)"'                   >> $@ 
     108        @echo 'cLdHasNoCompactUnwind :: String'                             >> $@ 
     109        @echo 'cLdHasNoCompactUnwind = "$(LdHasNoCompactUnwind)"'           >> $@ 
    108110        @echo 'cLdIsGNULd            :: String'                             >> $@ 
    109111        @echo 'cLdIsGNULd            = "$(LdIsGNULd)"'                      >> $@ 
    110112        @echo 'cLdHasBuildId         :: String'                             >> $@ 
  • compiler/main/DriverPipeline.hs

    diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
    index 99d3ce7..fd021cc 100644
    a b linkBinary dflags o_files dep_packages = do 
    16831683                      -- like 
    16841684                      --     ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog 
    16851685                      -- on x86. 
    1686                       ++ (if platformOS   (targetPlatform dflags) == OSDarwin   && 
     1686                      ++ (if cLdHasNoCompactUnwind == "YES" && 
     1687                             platformOS   (targetPlatform dflags) == OSDarwin   && 
    16871688                             platformArch (targetPlatform dflags) `elem` [ArchX86, ArchX86_64] 
    16881689                          then ["-Wl,-no_compact_unwind"] 
    16891690                          else []) 
  • configure.ac

    diff --git a/configure.ac b/configure.ac
    index 1207f08..6f36d4f 100644
    a b dnl ** check for ld, whether it has an -x option, and if it is GNU ld 
    697697FP_PROG_LD_X 
    698698FP_PROG_LD_IS_GNU 
    699699FP_PROG_LD_BUILD_ID 
     700FP_PROG_LD_NO_COMPACT_UNWIND 
    700701 
    701702dnl ** check for Apple-style dead-stripping support 
    702703dnl    (.subsections-via-symbols assembler directive) 
  • mk/config.mk.in

    diff --git a/mk/config.mk.in b/mk/config.mk.in
    index aef0937..03ea2d1 100644
    a b LdIsGNULd = @LdIsGNULd@ 
    693693# disable it with --build-id=none. 
    694694LdHasBuildId            = @LdHasBuildId@ 
    695695 
     696# Set to YES if ld has the --no_compact_unwind flag. See #5019 
     697# and compiler/main/DriverPipeline.hs. 
     698LdHasNoCompactUnwind    = @LdHasNoCompactUnwind@ 
     699 
    696700# On MSYS, building with SplitObjs=YES fails with  
    697701#   ar: Bad file number 
    698702# see #3201.  We need to specify a smaller max command-line size