Accepting request 631387 from home:Guillaume_G:branches:devel:languages:D
- Update to 1.11.0: * Big news: - Frontend, druntime and Phobos are at version 2.081.2. (#2752, #2772, #2776, #2791, #2815) (new) - Add some support for classes without TypeInfos, for -betterC and/or a minimal (d)runtime. (#2765) - LLVM for prebuilt packages upgraded to v6.0.1. The x86_64 packages feature some more LLVM targets for cross-compilation (experiments): MIPS, MSP430, RISC-V and WebAssembly. (#2760) - Rudimentary support for compiling & linking directly to WebAssembly. See the dedicated Wiki page for how to get started. (#2766, #2779, #2785) - AArch64 (64-bit ARM) now mostly working on Linux/glibc and Android. Current ltsmaster is able to bootstrap v1.11, which can also bootstrap itself; most tests pass. (Preliminary) CI has been set up. (#2802, #2817, #2813) (new) - LDC on Windows now uses 80-bit compile-time reals. This allows for seamless cross-compilation to other x86(_64) targets, e.g., without real.min underflowing to 0 and real.max overflowing to infinity. (#2752) - New @naked UDA in ldc.attributes & enhanced functionality for @llvmAttr("<name>"). (#2773) * Platform support: - Supports LLVM 3.7 - 6.0. - Windows: Supports Visual Studio/C++ Build Tools 2015 and 2017. - Alpine linux/x64: built against Musl libc to support Docker images based on the Alpine distro, requires the llvm5-libs, musl-dev, and gcc packages to build and link D apps and the tzdata and libcurl packages for certain stdlib modules. * Bug fixes: - extern(C++) on Posix: Pass non-PODs indirectly by value. (#2728) - extern(C++) on Windows/MSVC: Methods return all structs via hidden sret pointer. (#2720, #1935) - Make GC2Stack IR optimization pass work as intended. (#2750) - Work around inline assembly regression with LLVM 6 on Win32. The prebuilt Win32 package is now using LLVM 6.0.1 too. (#2629, #2770) - Fix overzealous check for multiple main() functions. (#2778) (new) - Fix corrupt prefix in integrated LLD's console output. (#2781) (new) - No context ptr for nested non-extern(D) functions. (#2808, #2809) (new) * Known issues: - LDC does not zero the padding area of a real variable. This may lead to wrong results if the padding area is also considered. See #770. Does not apply to real members inside structs etc. - Update bootstrap version to 0.17.6: * Added support for LLVM 6.0 and 7.0. (#2600, #2825) * Backported AArch64 fixes from master; most tests passing on Linux/glibc and Android * Fix generation of debug info. (#2594) * Added support for bootstrapping on DragonFly BSD * Fixed missing definition in std.datetime on Solaris * Fixed std.datetime unittest failure. (ldc-developers/phobos#59) * Fixed tests for PowerPC. (#2634, #2635) * Improvements for MIPS. * Make core.stdc.stdarg.va_* functions nothrow to enable compiling the 2.082 frontend. (#2821) * CI updates. - Remove upstreamed patches: * ldc-0.17.5-add_missing_include.patch * ldc-0.17.5-add_support_to_LLVM6.patch * ldc-0.17.5-backport_pr_2315.patch * ldc-0.17.5-default-to-pic.patch - Enable aarch64 since it can be boostrapped with ldc 0.17.6 - Fix x86_64 build by adding '-fPIC' to C_FLAGS of bootstrap OBS-URL: https://build.opensuse.org/request/show/631387 OBS-URL: https://build.opensuse.org/package/show/devel:languages:D/ldc?expand=0&rev=20
This commit is contained in:
parent
38870816c0
commit
7f4b27057f
@ -1,10 +0,0 @@
|
||||
--- 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 */
|
File diff suppressed because it is too large
Load Diff
@ -1,433 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
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
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7aa540a135f9fa1ee9722cad73100a8f3600a07f9a11d199d8be68887cc90008
|
||||
size 5006161
|
3
ldc-0.17.6-src.tar.gz
Normal file
3
ldc-0.17.6-src.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:868b8c07ab697306ea65f0006fc2b6b96db4df226e82f8f11cafbed6fa9ac561
|
||||
size 4986528
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:99b6e2b8dcaf28a2947318fb25e43fa0b96dd3a6377995146f987c4d17dd8371
|
||||
size 6658773
|
3
ldc-1.11.0-src.tar.gz
Normal file
3
ldc-1.11.0-src.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:85464fae47bc605308910afd6cfc6ddeafe95a8ad5b61e2c0c23caff82119f70
|
||||
size 6724384
|
69
ldc.changes
69
ldc.changes
@ -1,3 +1,72 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 24 10:24:47 UTC 2018 - guillaume@opensuse.org
|
||||
|
||||
- Update to 1.11.0:
|
||||
* Big news:
|
||||
- Frontend, druntime and Phobos are at version 2.081.2.
|
||||
(#2752, #2772, #2776, #2791, #2815) (new)
|
||||
- Add some support for classes without TypeInfos, for
|
||||
-betterC and/or a minimal (d)runtime. (#2765)
|
||||
- LLVM for prebuilt packages upgraded to v6.0.1.
|
||||
The x86_64 packages feature some more LLVM targets for
|
||||
cross-compilation (experiments): MIPS, MSP430, RISC-V
|
||||
and WebAssembly. (#2760)
|
||||
- Rudimentary support for compiling & linking directly to
|
||||
WebAssembly. See the dedicated Wiki page for how to get
|
||||
started. (#2766, #2779, #2785)
|
||||
- AArch64 (64-bit ARM) now mostly working on Linux/glibc
|
||||
and Android. Current ltsmaster is able to bootstrap v1.11,
|
||||
which can also bootstrap itself; most tests pass.
|
||||
(Preliminary) CI has been set up. (#2802, #2817, #2813) (new)
|
||||
- LDC on Windows now uses 80-bit compile-time reals. This allows
|
||||
for seamless cross-compilation to other x86(_64) targets,
|
||||
e.g., without real.min underflowing to 0 and real.max
|
||||
overflowing to infinity. (#2752)
|
||||
- New @naked UDA in ldc.attributes & enhanced functionality
|
||||
for @llvmAttr("<name>"). (#2773)
|
||||
* Platform support:
|
||||
- Supports LLVM 3.7 - 6.0.
|
||||
- Windows: Supports Visual Studio/C++ Build Tools 2015 and 2017.
|
||||
- Alpine linux/x64: built against Musl libc to support Docker
|
||||
images based on the Alpine distro, requires the llvm5-libs,
|
||||
musl-dev, and gcc packages to build and link D apps and the
|
||||
tzdata and libcurl packages for certain stdlib modules.
|
||||
* Bug fixes:
|
||||
- extern(C++) on Posix: Pass non-PODs indirectly by value.
|
||||
(#2728)
|
||||
- extern(C++) on Windows/MSVC: Methods return all structs via
|
||||
hidden sret pointer. (#2720, #1935)
|
||||
- Make GC2Stack IR optimization pass work as intended. (#2750)
|
||||
- Work around inline assembly regression with LLVM 6 on Win32.
|
||||
The prebuilt Win32 package is now using LLVM 6.0.1 too. (#2629, #2770)
|
||||
- Fix overzealous check for multiple main() functions. (#2778) (new)
|
||||
- Fix corrupt prefix in integrated LLD's console output. (#2781) (new)
|
||||
- No context ptr for nested non-extern(D) functions. (#2808, #2809) (new)
|
||||
* Known issues:
|
||||
- LDC does not zero the padding area of a real variable. This may
|
||||
lead to wrong results if the padding area is also considered.
|
||||
See #770. Does not apply to real members inside structs etc.
|
||||
- Update bootstrap version to 0.17.6:
|
||||
* Added support for LLVM 6.0 and 7.0. (#2600, #2825)
|
||||
* Backported AArch64 fixes from master; most tests passing on
|
||||
Linux/glibc and Android
|
||||
* Fix generation of debug info. (#2594)
|
||||
* Added support for bootstrapping on DragonFly BSD
|
||||
* Fixed missing definition in std.datetime on Solaris
|
||||
* Fixed std.datetime unittest failure. (ldc-developers/phobos#59)
|
||||
* Fixed tests for PowerPC. (#2634, #2635)
|
||||
* Improvements for MIPS.
|
||||
* Make core.stdc.stdarg.va_* functions nothrow to enable
|
||||
compiling the 2.082 frontend. (#2821)
|
||||
* CI updates.
|
||||
- Remove upstreamed patches:
|
||||
* ldc-0.17.5-add_missing_include.patch
|
||||
* ldc-0.17.5-add_support_to_LLVM6.patch
|
||||
* ldc-0.17.5-backport_pr_2315.patch
|
||||
* ldc-0.17.5-default-to-pic.patch
|
||||
- Enable aarch64 since it can be boostrapped with ldc 0.17.6
|
||||
- Fix x86_64 build by adding '-fPIC' to C_FLAGS of bootstrap
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 30 09:55:27 UTC 2018 - matthias.eliasson@gmail.com
|
||||
|
||||
|
27
ldc.spec
27
ldc.spec
@ -22,12 +22,12 @@
|
||||
%bcond_without ldc_bootstrap
|
||||
%bcond_with ldc_tests
|
||||
Name: ldc
|
||||
Version: 1.10.0
|
||||
Version: 1.11.0
|
||||
Release: 0
|
||||
Summary: The LLVM D Compiler
|
||||
License: BSD-3-Clause AND Artistic-1.0
|
||||
Group: Development/Languages/Other
|
||||
URL: https://wiki.dlang.org/LDC
|
||||
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
|
||||
@ -45,12 +45,8 @@ BuildRequires: zlib-devel
|
||||
Recommends: ldc-phobos-devel = %{version}
|
||||
Recommends: ldc-runtime-devel = %{version}
|
||||
%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
|
||||
# v0.17.6 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.6/ldc-0.17.6-src.tar.gz
|
||||
%endif
|
||||
%if %{with ldc_tests}
|
||||
BuildRequires: gcc-c++
|
||||
@ -68,10 +64,6 @@ BuildRequires: python
|
||||
BuildRequires: timezone
|
||||
BuildRequires: unzip
|
||||
%endif
|
||||
%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
|
||||
@ -118,17 +110,13 @@ with LDC.
|
||||
%patch0 -p1
|
||||
%if %{with ldc_bootstrap}
|
||||
tar xf %{SOURCE10}
|
||||
pushd ldc-0.17.5-src
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
pushd ldc-0.17.6-src
|
||||
popd
|
||||
%endif
|
||||
|
||||
%build
|
||||
%if %{with ldc_bootstrap}
|
||||
pushd ldc-0.17.5-src
|
||||
pushd ldc-0.17.6-src
|
||||
#Needs to be compiled with clang, but opensuse_rules.cmake forces gcc so disable rule
|
||||
touch ./no-suse-rules
|
||||
mkdir build && pushd build
|
||||
@ -139,6 +127,7 @@ cmake \
|
||||
-DCMAKE_CXX_COMPILER="%{_bindir}/clang++" \
|
||||
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/d \
|
||||
-DCMAKE_CXX_FLAGS="-std=c++11" \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
..
|
||||
make %{?_smp_mflags}
|
||||
popd
|
||||
@ -152,7 +141,7 @@ touch no-suse-rules
|
||||
-DCMAKE_CXX_COMPILER="%{_bindir}/clang++" \
|
||||
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/d \
|
||||
%if %{with ldc_bootstrap}
|
||||
-DD_COMPILER:PATH=`pwd`/../ldc-0.17.5-src/build/bin/ldmd2 \
|
||||
-DD_COMPILER:PATH=`pwd`/../ldc-0.17.6-src/build/bin/ldmd2 \
|
||||
%endif
|
||||
-DCMAKE_CXX_FLAGS="-std=c++11"
|
||||
make %{?_smp_mflags}
|
||||
|
Loading…
Reference in New Issue
Block a user