This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 12/14] Add GDC/GCC builtins and runtime support (part of D runtime)
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: richard dot sandiford at arm dot com
- Date: Mon, 22 Oct 2018 03:14:22 +0200
- Subject: Re: [PATCH 12/14] Add GDC/GCC builtins and runtime support (part of D runtime)
- References: <CABOHX+cVxOyKCiPS61xWiYsgvV8Zfzp6R3sxKvb5czMcfwtGGw@mail.gmail.com> <CABOHX+ckPaKU62JJX9c0ZSPscbm1k1gouL=VwrH8m-f1bvQYgQ@mail.gmail.com>
On Wed, 19 Sep 2018 at 22:45, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> On 18 September 2018 at 02:37, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> > This patch adds GCC builtins and runtime support for GDC compiled code.
> >
> > - module __entrypoint defines the C main function. Its contents are
> > parsed and compiled in during compilation, but only if needed.
> > - module gcc.attribute exposes GDC-specific attributes.
> > - module gcc.backtrace implements backtrace support for GDC.
> > - module gcc.builtins exposes GCC builtins to D code.
> > - module gcc.config exposes things determined at configure time to D code.
> > - module gcc.deh implements D unwind EH.
> > - module gcc.libbacktrace defines C bindings to libbacktrace.
> > - module gcc.unwind defines C bindings to libgcc unwind library.
> > - libgphobos.spec contains a list of libraries to link in that are
> > dependencies of D runtime and/or the Phobos standard library. It is
> > used by the GDC driver.
> >
>
> https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00735.html
>
> It looks like this patch was previously approved. All sources here
> are linked as part of druntime, but would be maintained in tree by
> myself and other D front end maintainers.
>
Updated copyright years as per request in 14/14, plus additional
changes that have been made since original patch.
Regards
--
Iain
---
diff --git a/libphobos/libdruntime/gcc/attribute.d b/libphobos/libdruntime/gcc/attribute.d
index 2498c27e7cc..8ca772122bb 100644
--- a/libphobos/libdruntime/gcc/attribute.d
+++ b/libphobos/libdruntime/gcc/attribute.d
@@ -1,5 +1,5 @@
// GNU D Compiler attribute support declarations.
-// Copyright (C) 2013-2017 Free Software Foundation, Inc.
+// Copyright (C) 2013-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/backtrace.d b/libphobos/libdruntime/gcc/backtrace.d
index 9c76e6117e8..37a7fa729b8 100644
--- a/libphobos/libdruntime/gcc/backtrace.d
+++ b/libphobos/libdruntime/gcc/backtrace.d
@@ -1,5 +1,5 @@
// GNU D Compiler routines for stack backtrace support.
-// Copyright (C) 2013-2017 Free Software Foundation, Inc.
+// Copyright (C) 2013-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -271,13 +271,23 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC)
int opApply(scope ApplyCallback dg) const
{
+ initLibBacktrace();
+
// If backtrace_simple produced an error report it and exit
if (!state || error != 0)
{
size_t pos = 0;
SymbolOrError symError;
- symError.errnum = error;
- symError.msg = errorBuf.ptr;
+ if (!state)
+ {
+ symError.msg = "libbacktrace failed to initialize\0";
+ symError.errnum = 1;
+ }
+ else
+ {
+ symError.errnum = error;
+ symError.msg = errorBuf.ptr;
+ }
return dg(pos, symError);
}
@@ -342,7 +352,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC)
int error = 0;
int _firstFrame = 0;
- char[128] errorBuf;
+ char[128] errorBuf = "\0";
}
}
else
diff --git a/libphobos/libdruntime/gcc/builtins.d b/libphobos/libdruntime/gcc/builtins.d
index e4e0bf3481f..a84d60bafa8 100644
--- a/libphobos/libdruntime/gcc/builtins.d
+++ b/libphobos/libdruntime/gcc/builtins.d
@@ -1,5 +1,5 @@
/* GNU D Compiler bindings for built-in functions and types.
- Copyright (C) 2006-2017 Free Software Foundation, Inc.
+ Copyright (C) 2006-2018 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/config.d.in b/libphobos/libdruntime/gcc/config.d.in
index ae61a7195df..89f807d3835 100644
--- a/libphobos/libdruntime/gcc/config.d.in
+++ b/libphobos/libdruntime/gcc/config.d.in
@@ -1,5 +1,5 @@
// GNU D Compiler configure constants.
-// Copyright (C) 2015-2017 Free Software Foundation, Inc.
+// Copyright (C) 2015-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/deh.d b/libphobos/libdruntime/gcc/deh.d
index 15746f6430c..8323f4aa076 100644
--- a/libphobos/libdruntime/gcc/deh.d
+++ b/libphobos/libdruntime/gcc/deh.d
@@ -1,5 +1,5 @@
// GNU D Compiler exception personality routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/libbacktrace.d.in b/libphobos/libdruntime/gcc/libbacktrace.d.in
index 61847da4747..7602387fcad 100644
--- a/libphobos/libdruntime/gcc/libbacktrace.d.in
+++ b/libphobos/libdruntime/gcc/libbacktrace.d.in
@@ -1,5 +1,5 @@
// GNU D Compiler bindings for the stack backtrace functions.
-// Copyright (C) 2013-2017 Free Software Foundation, Inc.
+// Copyright (C) 2013-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/unwind/arm.d b/libphobos/libdruntime/gcc/unwind/arm.d
index 34b845a5cbc..7ea8f59834d 100644
--- a/libphobos/libdruntime/gcc/unwind/arm.d
+++ b/libphobos/libdruntime/gcc/unwind/arm.d
@@ -1,5 +1,5 @@
// Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/unwind/c6x.d b/libphobos/libdruntime/gcc/unwind/c6x.d
index 490bcb2f78c..93a1944864d 100644
--- a/libphobos/libdruntime/gcc/unwind/c6x.d
+++ b/libphobos/libdruntime/gcc/unwind/c6x.d
@@ -1,5 +1,5 @@
// Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/unwind/generic.d b/libphobos/libdruntime/gcc/unwind/generic.d
index 2d8549414bb..e6071baba2f 100644
--- a/libphobos/libdruntime/gcc/unwind/generic.d
+++ b/libphobos/libdruntime/gcc/unwind/generic.d
@@ -1,5 +1,5 @@
// Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/unwind/package.d b/libphobos/libdruntime/gcc/unwind/package.d
index 2b9107c3624..0784a7ab85a 100644
--- a/libphobos/libdruntime/gcc/unwind/package.d
+++ b/libphobos/libdruntime/gcc/unwind/package.d
@@ -1,5 +1,5 @@
// Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/libdruntime/gcc/unwind/pe.d b/libphobos/libdruntime/gcc/unwind/pe.d
index a26c447c59a..caa21861b30 100644
--- a/libphobos/libdruntime/gcc/unwind/pe.d
+++ b/libphobos/libdruntime/gcc/unwind/pe.d
@@ -1,5 +1,5 @@
// Exception handling and frame unwind runtime interface routines.
-// Copyright (C) 2011-2017 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018 Free Software Foundation, Inc.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/src/libgphobos.spec.in b/libphobos/src/libgphobos.spec.in
index a11ec3ea192..0a33e834b1a 100644
--- a/libphobos/src/libgphobos.spec.in
+++ b/libphobos/src/libgphobos.spec.in
@@ -5,4 +5,4 @@
#
%rename lib liborig_gdc_renamed
-*lib: %(liborig_gdc_renamed) @SPEC_PHOBOS_DEPS@
+*lib: @SPEC_PHOBOS_DEPS@ %(liborig_gdc_renamed)