Accepting request 614484 from home:Guillaume_G:branches:devel:languages:D
- Add patch to fix ARM builds: * ldc-1.9.0-fix_arm_build.patch - Update to 1.9.0 and use 0.17.5 to bootstrap - Add patch to fix rpmlint error: * ldc-0.17.5-add_missing_include.patch - Add patches to add LLVM6 support: * ldc-0.17.5-add_support_to_LLVM6.patch * ldc-0.17.5-backport_pr_2315.patch - Add patch to be able to use ldc: * ldc-0.17.5-default-to-pic.patch - update to version 0.17.5: * Added LLVM 5.0 support. * druntime: fixes for Android and addition of core.math.yl2x[p1]() for x86(_64) targets. * dmd-testsuite: backported runnable/cppa.d fix for GCC > 5. * CI updates. OBS-URL: https://build.opensuse.org/request/show/614484 OBS-URL: https://build.opensuse.org/package/show/devel:languages:D/ldc?expand=0&rev=14
This commit is contained in:
parent
46a792d409
commit
9878662e8a
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:48428afde380415640f3db4e38529345f3c8485b1913717995547f907534c1c3
|
||||
size 4935570
|
10
ldc-0.17.5-add_missing_include.patch
Normal file
10
ldc-0.17.5-add_missing_include.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- ldc-0.17.5-src.orig/runtime/phobos/etc/c/zlib/gzread.c 2018-05-14 14:41:28.022309026 +0200
|
||||
+++ ldc-0.17.5-src/runtime/phobos/etc/c/zlib/gzread.c 2018-06-01 14:09:53.063607286 +0200
|
||||
@@ -3,6 +3,7 @@
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
+#include <unistd.h>
|
||||
#include "gzguts.h"
|
||||
|
||||
/* Local functions */
|
1630
ldc-0.17.5-add_support_to_LLVM6.patch
Normal file
1630
ldc-0.17.5-add_support_to_LLVM6.patch
Normal file
File diff suppressed because it is too large
Load Diff
433
ldc-0.17.5-backport_pr_2315.patch
Normal file
433
ldc-0.17.5-backport_pr_2315.patch
Normal file
@ -0,0 +1,433 @@
|
||||
From 6ed3ce435845e72ce8c88d39c0f7d3fb950ef54e Mon Sep 17 00:00:00 2001
|
||||
From: Johan Engelen <jbc.engelen@gmail.com>
|
||||
Date: Mon, 18 Sep 2017 23:11:32 +0200
|
||||
Subject: [PATCH] Backport PR #2315.
|
||||
|
||||
The change is to fix debuginfo build errors with Phobos and LLVM5.0. This PR is mostly copy-pasting from master and fixing compile errors, so not much checking whether things make sense or not for LTS.
|
||||
---
|
||||
gen/dibuilder.cpp | 104 ++++++++++++++++++++++++++++++++++++++++++++----------
|
||||
gen/dibuilder.h | 13 +++++--
|
||||
gen/functions.cpp | 11 +++---
|
||||
gen/nested.cpp | 103 ++++++++++++++++++++++++++++-------------------------
|
||||
4 files changed, 159 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp
|
||||
index f322811ea..1bc9c47c2 100644
|
||||
--- a/gen/dibuilder.cpp
|
||||
+++ b/gen/dibuilder.cpp
|
||||
@@ -62,7 +62,9 @@ Module *ldc::DIBuilder::getDefinedModule(Dsymbol *s) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ldc::DIBuilder::DIBuilder(IRState *const IR)
|
||||
- : IR(IR), DBuilder(IR->module), CUNode(nullptr) {}
|
||||
+ : IR(IR), DBuilder(IR->module), CUNode(nullptr),
|
||||
+ isTargetMSVCx64(global.params.targetTriple.isWindowsMSVCEnvironment() &&
|
||||
+ global.params.targetTriple.isArch64Bit()) {}
|
||||
|
||||
llvm::LLVMContext &ldc::DIBuilder::getContext() { return IR->context(); }
|
||||
|
||||
@@ -75,7 +77,7 @@ ldc::DIScope ldc::DIBuilder::GetCurrentScope() {
|
||||
return fn->diLexicalBlocks.top();
|
||||
}
|
||||
|
||||
-void ldc::DIBuilder::Declare(const Loc &loc, llvm::Value *var,
|
||||
+void ldc::DIBuilder::Declare(const Loc &loc, llvm::Value *storage,
|
||||
ldc::DILocalVariable divar
|
||||
#if LDC_LLVM_VER >= 306
|
||||
,
|
||||
@@ -83,19 +85,42 @@ void ldc::DIBuilder::Declare(const Loc &loc, llvm::Value *var,
|
||||
#endif
|
||||
) {
|
||||
unsigned charnum = (loc.linnum ? loc.charnum : 0);
|
||||
+ auto debugLoc = llvm::DebugLoc::get(loc.linnum, charnum, GetCurrentScope());
|
||||
#if LDC_LLVM_VER < 307
|
||||
- llvm::Instruction *instr = DBuilder.insertDeclare(var, divar,
|
||||
+ llvm::Instruction *instr = DBuilder.insertDeclare(storage, divar,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
diexpr,
|
||||
#endif
|
||||
IR->scopebb());
|
||||
- instr->setDebugLoc(
|
||||
- llvm::DebugLoc::get(loc.linnum, charnum, GetCurrentScope()));
|
||||
+ instr->setDebugLoc(debugLoc);
|
||||
+#else // if LLVM >= 3.7
|
||||
+ DBuilder.insertDeclare(storage, divar, diexpr, debugLoc, IR->scopebb());
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+// Sets the (current) value for a debuginfo variable.
|
||||
+void ldc::DIBuilder::SetValue(const Loc &loc, llvm::Value *value,
|
||||
+ ldc::DILocalVariable divar
|
||||
+#if LDC_LLVM_VER >= 306
|
||||
+ ,
|
||||
+ ldc::DIExpression diexpr
|
||||
+#endif
|
||||
+ ) {
|
||||
+ unsigned charnum = (loc.linnum ? loc.charnum : 0);
|
||||
+ auto debugLoc = llvm::DebugLoc::get(loc.linnum, charnum, GetCurrentScope());
|
||||
+#if LDC_LLVM_VER < 307
|
||||
+ llvm::Instruction *instr = DBuilder.insertDbgValueIntrinsic(value, divar,
|
||||
+#if LDC_LLVM_VER >= 306
|
||||
+ diexpr,
|
||||
+#endif
|
||||
+ IR->scopebb());
|
||||
+ instr->setDebugLoc(debugLoc);
|
||||
#else // if LLVM >= 3.7
|
||||
- DBuilder.insertDeclare(
|
||||
- var, divar, diexpr,
|
||||
- llvm::DebugLoc::get(loc.linnum, charnum, GetCurrentScope()),
|
||||
- IR->scopebb());
|
||||
+ DBuilder.insertDbgValueIntrinsic(value,
|
||||
+#if LDC_LLVM_VER < 600
|
||||
+ 0,
|
||||
+#endif
|
||||
+ divar, diexpr, debugLoc, IR->scopebb());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -852,6 +877,7 @@ void ldc::DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd) {
|
||||
|
||||
void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
Type *type, bool isThisPtr,
|
||||
+ bool forceAsLocal, bool isRefRVal,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
llvm::ArrayRef<int64_t> addr
|
||||
#else
|
||||
@@ -872,13 +898,46 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
}
|
||||
|
||||
// get type description
|
||||
- ldc::DIType TD = CreateTypeDescription(type ? type : vd->type, true);
|
||||
+ if (!type)
|
||||
+ type = vd->type;
|
||||
+ ldc::DIType TD = CreateTypeDescription(type, true);
|
||||
if (static_cast<llvm::MDNode *>(TD) == nullptr) {
|
||||
return; // unsupported
|
||||
}
|
||||
|
||||
- if (vd->storage_class & (STCref | STCout)) {
|
||||
+ const bool isRefOrOut = vd->isRef() || vd->isOut(); // incl. special-ref vars
|
||||
+
|
||||
+ // For MSVC x64 targets, declare params rewritten by ExplicitByvalRewrite as
|
||||
+ // DI references, as if they were ref parameters.
|
||||
+ const bool isPassedExplicitlyByval =
|
||||
+ isTargetMSVCx64 && !isRefOrOut && isaArgument(ll) && addr.empty();
|
||||
+
|
||||
+ bool useDbgValueIntrinsic = false;
|
||||
+ if (isRefOrOut || isPassedExplicitlyByval) {
|
||||
+ // With the exception of special-ref loop variables, the reference/pointer
|
||||
+ // itself is constant. So we don't have to attach the debug information to a
|
||||
+ // memory location and can use llvm.dbg.value to set the constant pointer
|
||||
+ // for the DI reference.
|
||||
+ useDbgValueIntrinsic =
|
||||
+ isPassedExplicitlyByval || (!isSpecialRefVar(vd) && isRefRVal);
|
||||
+#if LDC_LLVM_VER >= 308
|
||||
+ // Note: createReferenceType expects the size to be the size of a pointer,
|
||||
+ // not the size of the type the reference refers to.
|
||||
+ TD = DBuilder.createReferenceType(
|
||||
+ llvm::dwarf::DW_TAG_reference_type, TD,
|
||||
+ gDataLayout->getPointerSizeInBits(), // size (bits)
|
||||
+ DtoAlignment(type) * 8); // align (bits)
|
||||
+#else
|
||||
TD = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type, TD);
|
||||
+#endif
|
||||
+ } else {
|
||||
+ // FIXME: For MSVC x64 targets, declare dynamic array and vector parameters
|
||||
+ // as DI locals to work around garbage for both cdb and VS debuggers.
|
||||
+ if (isTargetMSVCx64) {
|
||||
+ TY ty = type->toBasetype()->ty;
|
||||
+ if (ty == Tarray || ty == Tvector)
|
||||
+ forceAsLocal = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
// get variable description
|
||||
@@ -886,7 +945,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
|
||||
#if LDC_LLVM_VER < 308
|
||||
unsigned tag;
|
||||
- if (vd->isParameter()) {
|
||||
+ if (!forceAsLocal && vd->isParameter()) {
|
||||
tag = llvm::dwarf::DW_TAG_arg_variable;
|
||||
} else {
|
||||
tag = llvm::dwarf::DW_TAG_auto_variable;
|
||||
@@ -930,7 +989,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
Flags // flags
|
||||
);
|
||||
#else
|
||||
- if (vd->isParameter()) {
|
||||
+ if (!forceAsLocal && vd->isParameter()) {
|
||||
FuncDeclaration *fd = vd->parent->isFuncDeclaration();
|
||||
assert(fd);
|
||||
size_t argNo = 0;
|
||||
@@ -970,14 +1029,23 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
#endif
|
||||
variableMap[vd] = debugVariable;
|
||||
|
||||
-// declare
|
||||
+ if (useDbgValueIntrinsic) {
|
||||
#if LDC_LLVM_VER >= 306
|
||||
- Declare(vd->loc, ll, debugVariable, addr.empty()
|
||||
- ? DBuilder.createExpression()
|
||||
- : DBuilder.createExpression(addr));
|
||||
+ SetValue(vd->loc, ll, debugVariable,
|
||||
+ addr.empty() ? DBuilder.createExpression()
|
||||
+ : DBuilder.createExpression(addr));
|
||||
#else
|
||||
- Declare(vd->loc, ll, debugVariable);
|
||||
+ SetValue(vd->loc, ll, debugVariable);
|
||||
#endif
|
||||
+ } else {
|
||||
+#if LDC_LLVM_VER >= 306
|
||||
+ Declare(vd->loc, ll, debugVariable,
|
||||
+ addr.empty() ? DBuilder.createExpression()
|
||||
+ : DBuilder.createExpression(addr));
|
||||
+#else
|
||||
+ Declare(vd->loc, ll, debugVariable);
|
||||
+#endif
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/gen/dibuilder.h b/gen/dibuilder.h
|
||||
index fbfa830da..8fc5dea6c 100644
|
||||
--- a/gen/dibuilder.h
|
||||
+++ b/gen/dibuilder.h
|
||||
@@ -79,6 +79,8 @@ class DIBuilder {
|
||||
const llvm::MDNode *CUNode;
|
||||
#endif
|
||||
|
||||
+ const bool isTargetMSVCx64;
|
||||
+
|
||||
DICompileUnit GetCU() {
|
||||
#if LDC_LLVM_VER >= 307
|
||||
return CUNode;
|
||||
@@ -133,7 +135,8 @@ class DIBuilder {
|
||||
/// \param addr An array of complex address operations.
|
||||
void
|
||||
EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd, Type *type = nullptr,
|
||||
- bool isThisPtr = false,
|
||||
+ bool isThisPtr = false, bool forceAsLocal = false,
|
||||
+ bool isRefRVal = false,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
llvm::ArrayRef<int64_t> addr = llvm::ArrayRef<int64_t>()
|
||||
#else
|
||||
@@ -155,12 +158,18 @@ class DIBuilder {
|
||||
llvm::LLVMContext &getContext();
|
||||
Module *getDefinedModule(Dsymbol *s);
|
||||
DIScope GetCurrentScope();
|
||||
- void Declare(const Loc &loc, llvm::Value *var, ldc::DILocalVariable divar
|
||||
+ void Declare(const Loc &loc, llvm::Value *storage, ldc::DILocalVariable divar
|
||||
#if LDC_LLVM_VER >= 306
|
||||
,
|
||||
ldc::DIExpression diexpr
|
||||
#endif
|
||||
);
|
||||
+ void SetValue(const Loc &loc, llvm::Value *value, ldc::DILocalVariable divar
|
||||
+#if LDC_LLVM_VER >= 306
|
||||
+ ,
|
||||
+ ldc::DIExpression diexpr
|
||||
+#endif
|
||||
+ );
|
||||
void AddBaseFields(ClassDeclaration *sd, ldc::DIFile file,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
std::vector<llvm::Metadata *> &elems
|
||||
diff --git a/gen/functions.cpp b/gen/functions.cpp
|
||||
index 796124db4..107779ecd 100644
|
||||
--- a/gen/functions.cpp
|
||||
+++ b/gen/functions.cpp
|
||||
@@ -861,10 +861,13 @@ void DtoDefineFunction(FuncDeclaration *fd) {
|
||||
++llArgIdx;
|
||||
}
|
||||
|
||||
- if (global.params.symdebug &&
|
||||
- !(isaArgument(irparam->value) &&
|
||||
- isaArgument(irparam->value)->hasByValAttr())) {
|
||||
- gIR->DBuilder.EmitLocalVariable(irparam->value, vd, debugInfoType);
|
||||
+ // The debuginfos for captured params are handled later by
|
||||
+ // DtoCreateNestedContext().
|
||||
+ if (global.params.symdebug && vd->nestedrefs.dim == 0) {
|
||||
+ // Reference (ref/out) parameters have no storage themselves as they are
|
||||
+ // constant pointers, so pass the reference rvalue to EmitLocalVariable().
|
||||
+ gIR->DBuilder.EmitLocalVariable(irparam->value, vd, debugInfoType,
|
||||
+ false, false, /*isRefRVal=*/true);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/gen/nested.cpp b/gen/nested.cpp
|
||||
index 2a13a1aa6..2b72f9873 100644
|
||||
--- a/gen/nested.cpp
|
||||
+++ b/gen/nested.cpp
|
||||
@@ -58,14 +58,13 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||
|
||||
// Check whether we can access the needed frame
|
||||
FuncDeclaration *fd = irfunc->decl;
|
||||
- while (fd != vdparent) {
|
||||
- if (fd->isStatic()) {
|
||||
- error(loc, "function %s cannot access frame of function %s",
|
||||
- irfunc->decl->toPrettyChars(), vdparent->toPrettyChars());
|
||||
- return new DVarValue(astype, llvm::UndefValue::get(DtoPtrToType(astype)));
|
||||
- }
|
||||
+ while (fd && fd != vdparent) {
|
||||
fd = getParentFunc(fd, false);
|
||||
- assert(fd);
|
||||
+ }
|
||||
+ if (!fd) {
|
||||
+ error(loc, "function %s cannot access frame of function %s",
|
||||
+ irfunc->decl->toPrettyChars(), vdparent->toPrettyChars());
|
||||
+ return new DVarValue(astype, llvm::UndefValue::get(DtoPtrToType(astype)));
|
||||
}
|
||||
|
||||
// is the nested variable in this scope?
|
||||
@@ -73,38 +72,32 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||
return makeVarDValue(astype, vd);
|
||||
}
|
||||
|
||||
- LLValue *dwarfValue = nullptr;
|
||||
-#if LDC_LLVM_VER >= 306
|
||||
- std::vector<int64_t> dwarfAddr;
|
||||
-#else
|
||||
- std::vector<LLValue *> dwarfAddr;
|
||||
-#endif
|
||||
-
|
||||
// get the nested context
|
||||
LLValue *ctx = nullptr;
|
||||
- if (irfunc->nestedVar) {
|
||||
- // If this function has its own nested context struct, always load it.
|
||||
- ctx = irfunc->nestedVar;
|
||||
- dwarfValue = ctx;
|
||||
+ bool skipDIDeclaration = false;
|
||||
+ auto currentCtx = irfunc->nestedVar;
|
||||
+ if (currentCtx) {
|
||||
+ Logger::println("Using own nested context of current function");
|
||||
+ ctx = currentCtx;
|
||||
} else if (irfunc->decl->isMember2()) {
|
||||
- // If this is a member function of a nested class without its own
|
||||
- // context, load the vthis member.
|
||||
+ Logger::println(
|
||||
+ "Current function is member of nested class, loading vthis");
|
||||
+
|
||||
AggregateDeclaration *cd = irfunc->decl->isMember2();
|
||||
LLValue *val = irfunc->thisArg;
|
||||
if (cd->isClassDeclaration()) {
|
||||
val = DtoLoad(val);
|
||||
}
|
||||
ctx = DtoLoad(DtoGEPi(val, 0, getVthisIdx(cd), ".vthis"));
|
||||
+ skipDIDeclaration = true;
|
||||
} else {
|
||||
- // Otherwise, this is a simple nested function, load from the context
|
||||
- // argument.
|
||||
+ Logger::println("Regular nested function, loading context arg");
|
||||
+
|
||||
ctx = DtoLoad(irfunc->nestArg);
|
||||
- dwarfValue = irfunc->nestArg;
|
||||
- if (global.params.symdebug) {
|
||||
- gIR->DBuilder.OpDeref(dwarfAddr);
|
||||
- }
|
||||
}
|
||||
+
|
||||
assert(ctx);
|
||||
+ IF_LOG { Logger::cout() << "Context: " << *ctx << '\n'; }
|
||||
|
||||
DtoCreateNestedContextType(vdparent->isFuncDeclaration());
|
||||
assert(isIrLocalCreated(vd));
|
||||
@@ -112,11 +105,9 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||
////////////////////////////////////
|
||||
// Extract variable from nested context
|
||||
|
||||
- LLValue *val = DtoBitCast(ctx, LLPointerType::getUnqual(irfunc->frameType));
|
||||
- IF_LOG {
|
||||
- Logger::cout() << "Context: " << *val << '\n';
|
||||
- Logger::cout() << "of type: " << *irfunc->frameType << '\n';
|
||||
- }
|
||||
+ const auto frameType = LLPointerType::getUnqual(irfunc->frameType);
|
||||
+ IF_LOG { Logger::cout() << "casting to: " << *irfunc->frameType << '\n'; }
|
||||
+ LLValue *val = DtoBitCast(ctx, frameType);
|
||||
|
||||
IrLocal *const irLocal = getIrLocal(vd);
|
||||
const auto vardepth = irLocal->nestedDepth;
|
||||
@@ -135,10 +126,6 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||
IF_LOG Logger::println("Same depth");
|
||||
} else {
|
||||
// Load frame pointer and index that...
|
||||
- if (dwarfValue && global.params.symdebug) {
|
||||
- gIR->DBuilder.OpOffset(dwarfAddr, val, vardepth);
|
||||
- gIR->DBuilder.OpDeref(dwarfAddr);
|
||||
- }
|
||||
IF_LOG Logger::println("Lower depth");
|
||||
val = DtoGEPi(val, 0, vardepth);
|
||||
IF_LOG Logger::cout() << "Frame index: " << *val << '\n';
|
||||
@@ -150,27 +137,42 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||
const auto idx = irLocal->nestedIndex;
|
||||
assert(idx != -1 && "Nested context not yet resolved for variable.");
|
||||
|
||||
- if (dwarfValue && global.params.symdebug) {
|
||||
- gIR->DBuilder.OpOffset(dwarfAddr, val, idx);
|
||||
- }
|
||||
+#if LDC_LLVM_VER >= 306
|
||||
+ std::vector<int64_t> dwarfAddrOps;
|
||||
+#else
|
||||
+ std::vector<LLValue *> dwarfAddrOps;
|
||||
+#endif
|
||||
|
||||
- val = DtoGEPi(val, 0, idx, vd->toChars());
|
||||
+ LLValue *gep = DtoGEPi(val, 0, idx, vd->toChars());
|
||||
+ val = gep;
|
||||
IF_LOG {
|
||||
Logger::cout() << "Addr: " << *val << '\n';
|
||||
Logger::cout() << "of type: " << *val->getType() << '\n';
|
||||
}
|
||||
- if (byref || (vd->isParameter() && getIrParameter(vd)->arg &&
|
||||
- getIrParameter(vd)->arg->byref)) {
|
||||
+ const bool isRefOrOut = vd->isRef() || vd->isOut();
|
||||
+ if (isSpecialRefVar(vd)) {
|
||||
+ // Handled appropriately by makeVarDValue() and EmitLocalVariable(), pass
|
||||
+ // storage of pointer (reference lvalue).
|
||||
+ } else if (byref || isRefOrOut) {
|
||||
val = DtoAlignedLoad(val);
|
||||
- // dwarfOpDeref(dwarfAddr);
|
||||
+ // ref/out variables get a reference-debuginfo-type in EmitLocalVariable();
|
||||
+ // pass the GEP as reference lvalue in that case.
|
||||
+ if (!isRefOrOut)
|
||||
+ gIR->DBuilder.OpDeref(dwarfAddrOps);
|
||||
IF_LOG {
|
||||
Logger::cout() << "Was byref, now: " << *irLocal->value << '\n';
|
||||
Logger::cout() << "of type: " << *irLocal->value->getType() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
- if (dwarfValue && global.params.symdebug) {
|
||||
- gIR->DBuilder.EmitLocalVariable(dwarfValue, vd, nullptr, false, dwarfAddr);
|
||||
+ if (!skipDIDeclaration && global.params.symdebug) {
|
||||
+#if LDC_LLVM_VER < 500
|
||||
+ // Because we are passing a GEP instead of an alloca to
|
||||
+ // llvm.dbg.declare, we have to make the address dereference explicit.
|
||||
+ gIR->DBuilder.OpDeref(dwarfAddrOps);
|
||||
+#endif
|
||||
+ gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false,
|
||||
+ /*forceAsLocal=*/true, false, dwarfAddrOps);
|
||||
}
|
||||
|
||||
return makeVarDValue(astype, vd, val);
|
||||
@@ -532,12 +534,17 @@ void DtoCreateNestedContext(FuncDeclaration *fd) {
|
||||
|
||||
if (global.params.symdebug) {
|
||||
#if LDC_LLVM_VER >= 306
|
||||
- LLSmallVector<int64_t, 2> addr;
|
||||
+ LLSmallVector<int64_t, 2> dwarfAddrOps;
|
||||
#else
|
||||
- LLSmallVector<LLValue *, 2> addr;
|
||||
+ LLSmallVector<LLValue *, 2> dwarfAddrOps;
|
||||
+#endif
|
||||
+#if LDC_LLVM_VER < 500
|
||||
+ // Because we are passing a GEP instead of an alloca to
|
||||
+ // llvm.dbg.declare, we have to make the address dereference explicit.
|
||||
+ gIR->DBuilder.OpDeref(dwarfAddrOps);
|
||||
#endif
|
||||
- gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex);
|
||||
- gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false, addr);
|
||||
+ gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false, false, false,
|
||||
+ dwarfAddrOps);
|
||||
}
|
||||
}
|
||||
}
|
33
ldc-0.17.5-default-to-pic.patch
Normal file
33
ldc-0.17.5-default-to-pic.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From d9496882163e173ea718756a7fb0cbc627c5326f Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Klumpp <matthias@tenstral.net>
|
||||
Date: Tue, 2 Aug 2016 17:10:09 +0200
|
||||
Subject: [PATCH] Default to PIC code on Linux
|
||||
|
||||
Modern Linux distributions have their toolchain generate PIC code for
|
||||
additional security features (like ASLR).
|
||||
Since there is no (sane) way to detect whether the toolchain defaults to
|
||||
PIC code, we simply default to PIC code on all Linux
|
||||
distributions to avoid linking issues on these OSes.
|
||||
|
||||
The relocation model can be switched back to non-PIC code manually at
|
||||
any time.
|
||||
---
|
||||
driver/targetmachine.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp
|
||||
index 1a0fddf70..987be4263 100644
|
||||
--- a/driver/targetmachine.cpp
|
||||
+++ b/driver/targetmachine.cpp
|
||||
@@ -528,7 +528,10 @@ llvm::TargetMachine *createTargetMachine(
|
||||
// Darwin defaults to PIC (and as of 10.7.5/LLVM 3.1-3.3, TLS use leads
|
||||
// to crashes for non-PIC code). LLVM doesn't handle this.
|
||||
relocModel = llvm::Reloc::PIC_;
|
||||
- } else if (triple.getEnvironment() == llvm::Triple::Android) {
|
||||
+ } else if (triple.isOSLinux()) {
|
||||
+ // Modern Linux distributions have their toolchain generate PIC code for additional security
|
||||
+ // features (like ASLR). We default to PIC code to avoid linking issues on these OSes.
|
||||
+ // On Android, PIC is default as well.
|
||||
relocModel = llvm::Reloc::PIC_;
|
||||
} else {
|
||||
// ARM for other than Darwin or Android defaults to static
|
3
ldc-0.17.5-src.tar.gz
Normal file
3
ldc-0.17.5-src.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7aa540a135f9fa1ee9722cad73100a8f3600a07f9a11d199d8be68887cc90008
|
||||
size 5006161
|
12
ldc-1.9.0-fix_arm_build.patch
Normal file
12
ldc-1.9.0-fix_arm_build.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- ldc-1.9.0-src.orig/runtime/druntime/src/ldc/arm_unwind.c 2018-06-05 15:47:25.521618323 +0200
|
||||
+++ ldc-1.9.0-src/runtime/druntime/src/ldc/arm_unwind.c 2018-06-06 09:44:20.368786818 +0200
|
||||
@@ -26,7 +26,8 @@ _Unwind_Ptr _d_eh_GetIP(_Unwind_Context
|
||||
#ifdef __GLIBC__
|
||||
_Unwind_Ptr _d_eh_GetIPInfo(_Unwind_Context *context, int *ptr)
|
||||
{
|
||||
- return _Unwind_GetIPInfo(context, ptr);
|
||||
+ *ptr = 0;
|
||||
+ return _Unwind_GetIP(context);
|
||||
}
|
||||
#endif
|
||||
|
3
ldc-1.9.0-src.tar.gz
Normal file
3
ldc-1.9.0-src.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3f32a4dfcaae12f434e0e23638684faa83765827e7f2deb2df059dccc3169b9
|
||||
size 6560330
|
32
ldc.changes
32
ldc.changes
@ -1,3 +1,35 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 6 08:15:36 UTC 2018 - guillaume.gardet@opensuse.org
|
||||
|
||||
- Add patch to fix ARM builds:
|
||||
* ldc-1.9.0-fix_arm_build.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 5 16:08:35 UTC 2018 - guillaume.gardet@opensuse.org
|
||||
|
||||
- Update to 1.9.0 and use 0.17.5 to bootstrap
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 1 12:11:13 UTC 2018 - guillaume.gardet@opensuse.org
|
||||
|
||||
- Add patch to fix rpmlint error:
|
||||
* ldc-0.17.5-add_missing_include.patch
|
||||
- Add patches to add LLVM6 support:
|
||||
* ldc-0.17.5-add_support_to_LLVM6.patch
|
||||
* ldc-0.17.5-backport_pr_2315.patch
|
||||
- Add patch to be able to use ldc:
|
||||
* ldc-0.17.5-default-to-pic.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 22 10:05:09 UTC 2018 - guillaume.gardet@opensuse.org
|
||||
|
||||
- update to version 0.17.5:
|
||||
* Added LLVM 5.0 support.
|
||||
* druntime: fixes for Android and addition of core.math.yl2x[p1]() for x86(_64) targets.
|
||||
* dmd-testsuite: backported runnable/cppa.d fix for GCC > 5.
|
||||
* CI updates.
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 9 08:54:07 UTC 2017 - jengelh@inai.de
|
||||
|
||||
|
82
ldc.spec
82
ldc.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ldc
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -15,22 +15,40 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
%bcond_without ldc_bootstrap
|
||||
|
||||
Name: ldc
|
||||
Version: 0.17.4
|
||||
Version: 1.9.0
|
||||
Release: 0
|
||||
Summary: The LLVM D Compiler
|
||||
License: BSD-3-Clause and Artistic-1.0
|
||||
License: BSD-3-Clause AND Artistic-1.0
|
||||
Group: Development/Languages/Other
|
||||
Url: https://wiki.dlang.org/LDC
|
||||
Source0: https://github.com/ldc-developers/ldc/releases/download/v%{version}/ldc-%{version}-src.tar.gz
|
||||
Source1: %{name}-rpmlintrc
|
||||
Patch0: ldc-1.9.0-fix_arm_build.patch
|
||||
%if %{with ldc_bootstrap}
|
||||
# v0.17.5 is the last version buildable with a C++ compiler, so use it for bootstrapping
|
||||
Source10: https://github.com/ldc-developers/ldc/releases/download/v0.17.5/ldc-0.17.5-src.tar.gz
|
||||
Patch10: ldc-0.17.5-backport_pr_2315.patch
|
||||
Patch11: ldc-0.17.5-add_support_to_LLVM6.patch
|
||||
Patch12: ldc-0.17.5-add_missing_include.patch
|
||||
Patch13: ldc-0.17.5-default-to-pic.patch
|
||||
%endif
|
||||
BuildRequires: cmake
|
||||
BuildRequires: help2man
|
||||
BuildRequires: libconfig++-devel
|
||||
BuildRequires: libcurl-devel
|
||||
BuildRequires: libstdc++-devel
|
||||
%if %{without ldc_bootstrap}
|
||||
BuildRequires: ldc
|
||||
BuildRequires: ldc-phobos-devel
|
||||
BuildRequires: ldc-runtime-devel
|
||||
%endif
|
||||
BuildRequires: llvm-clang
|
||||
BuildRequires: llvm-devel >= 3.5
|
||||
BuildRequires: llvm-devel >= 3.7
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: sqlite3-devel
|
||||
BuildRequires: zlib-devel
|
||||
# Should be installed, at least runtime
|
||||
Recommends: ldc-phobos-devel = %{version}
|
||||
@ -39,6 +57,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%define so_ver 68
|
||||
%define lname_runtime libdruntime-%{name}
|
||||
%define lname_phobos libphobos2-%{name}
|
||||
%if %{with ldc_bootstrap}
|
||||
# We cannot build v0.17.5 for aarch64 due to no aarch64 support in phobos, so bootstrap is impossible
|
||||
ExcludeArch: aarch64
|
||||
%endif
|
||||
|
||||
%description
|
||||
LDC is an LLVM based compiler for the D programming language. It uses the
|
||||
@ -82,16 +104,45 @@ with LDC.
|
||||
|
||||
%prep
|
||||
%setup -q -n ldc-%{version}-src
|
||||
%patch0 -p1
|
||||
%if %{with ldc_bootstrap}
|
||||
tar xf %{SOURCE10}
|
||||
pushd ldc-0.17.5-src
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
popd
|
||||
%endif
|
||||
|
||||
%build
|
||||
%if %{with ldc_bootstrap}
|
||||
pushd ldc-0.17.5-src
|
||||
#Needs to be compiled with clang, but opensuse_rules.cmake forces gcc so disable rule
|
||||
touch ./no-suse-rules
|
||||
mkdir build && pushd build
|
||||
cmake \
|
||||
-DCMAKE_USER_MAKE_RULES_OVERRIDE=./no-suse-rules \
|
||||
-DCMAKE_C_COMPILER="%{_bindir}/clang" \
|
||||
-DCMAKE_CXX_COMPILER="%{_bindir}/clang++" \
|
||||
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/d \
|
||||
-DCMAKE_CXX_FLAGS="-std=c++11" \
|
||||
..
|
||||
make %{?_smp_mflags}
|
||||
popd
|
||||
popd
|
||||
%endif
|
||||
#Needs to be compiled with clang, but opensuse_rules.cmake forces gcc so disable rule
|
||||
touch no-suse-rules
|
||||
%cmake \
|
||||
-DCMAKE_USER_MAKE_RULES_OVERRIDE=./no-suse-rules \
|
||||
-DCMAKE_C_COMPILER="%{_bindir}/clang" \
|
||||
-DCMKAE_CXX_COMPILER="%{_bindir}/clang++" \
|
||||
-DCMAKE_CXX_COMPILER="%{_bindir}/clang++" \
|
||||
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/d \
|
||||
-DCMAKE_CXX_FLAGS="-std=c++11"
|
||||
%if %{with ldc_bootstrap}
|
||||
-DD_COMPILER:PATH=`pwd`/../ldc-0.17.5-src/build/bin/ldmd2 \
|
||||
%endif
|
||||
-DCMAKE_CXX_FLAGS="-std=c++11"
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
@ -101,6 +152,7 @@ help2man %{buildroot}%{_bindir}/ldc2 > ldc2.1 && gzip ldc2.1
|
||||
help2man %{buildroot}%{_bindir}/ldmd2 > ldmd2.1 && gzip ldmd2.1
|
||||
install -d %{buildroot}%{_mandir}/man1
|
||||
install -m 644 -t %{buildroot}%{_mandir}/man1/ ldmd2.1.gz ldc2.1.gz
|
||||
rm -rf %{buildroot}/usr/lib/debug
|
||||
|
||||
%post -n %{lname_runtime}%{so_ver} -p /sbin/ldconfig
|
||||
|
||||
@ -116,31 +168,31 @@ install -m 644 -t %{buildroot}%{_mandir}/man1/ ldmd2.1.gz ldc2.1.gz
|
||||
%doc %{_mandir}/man1/*.1.gz
|
||||
%config %{_sysconfdir}/bash_completion.d/ldc2
|
||||
%config %{_sysconfdir}/ldc2.conf
|
||||
%{_bindir}/ldc2
|
||||
%{_bindir}/ldc*
|
||||
%{_bindir}/ldmd2
|
||||
|
||||
%files -n %{lname_runtime}%{so_ver}
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/%{lname_runtime}.so.*
|
||||
%{_libdir}/%{lname_runtime}-debug.so.*
|
||||
%{_libdir}/%{lname_runtime}-shared.so.*
|
||||
%{_libdir}/%{lname_runtime}-debug-shared.so.*
|
||||
|
||||
%files runtime-devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/%{lname_runtime}.so
|
||||
%{_libdir}/%{lname_runtime}-debug.so
|
||||
%{_libdir}/%{lname_runtime}-shared.so
|
||||
%{_libdir}/%{lname_runtime}-debug-shared.so
|
||||
%dir %{_includedir}/d
|
||||
%{_includedir}/d/ldc
|
||||
%{_includedir}/d/core
|
||||
|
||||
%files -n %{lname_phobos}%{so_ver}
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/%{lname_phobos}.so.*
|
||||
%{_libdir}/%{lname_phobos}-debug.so.*
|
||||
%{_libdir}/%{lname_phobos}-shared.so.*
|
||||
%{_libdir}/%{lname_phobos}-debug-shared.so.*
|
||||
|
||||
%files phobos-devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/%{lname_phobos}.so
|
||||
%{_libdir}/%{lname_phobos}-debug.so
|
||||
%{_libdir}/%{lname_phobos}-shared.so
|
||||
%{_libdir}/%{lname_phobos}-debug-shared.so
|
||||
%{_includedir}/d/std
|
||||
%{_includedir}/d/etc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user