From f09f359764c355eeedc2a1d4fff8f3c57d0132d9 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Wed, 11 Apr 2018 06:04:14 +0200 Subject: [PATCH] Backport fixes for LLVM 6 support Backport a patch to use Dwarf debuginfo v3 and build with -DLDC_WITH_LLD=OFF, as suggested by upstream in https://github.com/ldc-developers/ldc/pull/2608 --- ...LVM-6-Default-to-Dwarf-debuginfos-v3.patch | 30 +++++++++++++++++++ ldc.spec | 6 +++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 0001-LLVM-6-Default-to-Dwarf-debuginfos-v3.patch diff --git a/0001-LLVM-6-Default-to-Dwarf-debuginfos-v3.patch b/0001-LLVM-6-Default-to-Dwarf-debuginfos-v3.patch new file mode 100644 index 0000000..ab30a10 --- /dev/null +++ b/0001-LLVM-6-Default-to-Dwarf-debuginfos-v3.patch @@ -0,0 +1,30 @@ +From 18cf4196f66c9e11ff744d85d2803af8d593dbe3 Mon Sep 17 00:00:00 2001 +From: Martin +Date: Sun, 25 Mar 2018 17:37:34 +0200 +Subject: [PATCH] LLVM 6+: Default to Dwarf debuginfos v3 + +At least on Linux it appears to default to v4 or newer, which druntime's +rt.backtrace.dwarf doesn't handle yet. + +This fixes tests/codegen/exception_stack_trace.d on Linux. +--- + driver/targetmachine.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp +index d75a31b2c..70a09127c 100644 +--- a/driver/targetmachine.cpp ++++ b/driver/targetmachine.cpp +@@ -458,6 +458,12 @@ createTargetMachine(const std::string targetTriple, const std::string arch, + if (targetOptions.MCOptions.ABIName.empty()) + targetOptions.MCOptions.ABIName = getABI(triple); + ++#if LDC_LLVM_VER >= 600 ++ // druntime isn't ready for Dwarf v4+ debuginfos (e.g., in rt.backtrace.dwarf). ++ if (targetOptions.MCOptions.DwarfVersion == 0) ++ targetOptions.MCOptions.DwarfVersion = 3; ++#endif ++ + auto ldcFloatABI = floatABI; + if (ldcFloatABI == FloatABI::Default) { + switch (triple.getArch()) { diff --git a/ldc.spec b/ldc.spec index 55b00ac..96a6e00 100644 --- a/ldc.spec +++ b/ldc.spec @@ -30,6 +30,9 @@ Source1: https://github.com/ldc-developers/ldc/releases/download/v%{boots %endif Source3: macros.%{name} +# https://github.com/ldc-developers/ldc/pull/2608 +Patch0: 0001-LLVM-6-Default-to-Dwarf-debuginfos-v3.patch + ExclusiveArch: %{ldc_arches} %if ! 0%{?bootstrap} @@ -166,7 +169,7 @@ Enable autocompletion for phobos library in geany (IDE) Active l'autocompletion pour pour la bibliothèque phobos dans geany (IDE) %prep -%setup -q -n %{name}-%{version}%{?pre:-%{pre}}-src +%autosetup -n %{name}-%{version}%{?pre:-%{pre}}-src -p1 # temp geany config directory for allow geany to generate tags mkdir geany_config @@ -190,6 +193,7 @@ pushd build -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \ -DLLVM_CONFIG:PATH=%{_bindir}/llvm-config-%{__isa_bits} \ + -DLDC_WITH_LLD:BOOL=OFF \ %if 0%{?bootstrap} -DD_COMPILER:PATH=`pwd`/../build-bootstrap/bin/ldmd2 \ %endif