[gcc-7] 43/354: * gdc: Link with the shared libgphobos runtime by default.

Ximin Luo infinity0 at debian.org
Thu Nov 23 15:50:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository gcc-7.

commit 62e9b33e01837488ceba1013437ef9932fc47872
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Tue Nov 22 23:55:10 2016 +0000

      * gdc: Link with the shared libgphobos runtime by default.
    
    
    git-svn-id: svn+ssh://svn.debian.org/svn/gcccvs/branches/sid/gcc-7@9122 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/changelog                       |  1 +
 debian/patches/gdc-libphobos-link.diff | 84 +++++++++++++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 72d82c6..f75a583 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ gcc-7 (7-20161117-1) UNRELEASED; urgency=medium
   * Mark libgphobos symbols changing with the file location (sic!) as optional.
   * Add pkg-config to the build dependencies.
   * Drop the work around for PR libstdc++/65913.
+  * gdc: Link with the shared libgphobos runtime by default.
 
   [ YunQiang Su ]
   * Update gnat patches for GCC 7, stop building libgnatvsn and libgnatprj.
diff --git a/debian/patches/gdc-libphobos-link.diff b/debian/patches/gdc-libphobos-link.diff
index 8ed8bc4..9dc0e96 100644
--- a/debian/patches/gdc-libphobos-link.diff
+++ b/debian/patches/gdc-libphobos-link.diff
@@ -4,7 +4,16 @@ Index: b/src/gcc/d/d-spec.c
 ===================================================================
 --- a/src/gcc/d/d-spec.c
 +++ b/src/gcc/d/d-spec.c
-@@ -75,6 +75,10 @@
+@@ -36,6 +36,8 @@
+ #define WITHLIBCXX	(1<<5)
+ /* this bit is set if they did `-lc'.  */
+ #define WITHLIBC	(1<<6)
++/* this bit is set if they did `-ldl'.  */
++#define DLLIB		(1<<7)
+ /* This bit is set when the argument should not be passed to gcc or the backend */
+ #define SKIPOPT		(1<<8)
+ 
+@@ -75,6 +77,10 @@
  #define LIBDRUNTIME_PROFILE LIBDRUNTIME
  #endif
  
@@ -15,7 +24,62 @@ Index: b/src/gcc/d/d-spec.c
  void
  lang_specific_driver (cl_decoded_option **in_decoded_options,
  		      unsigned int *in_decoded_options_count,
-@@ -510,6 +514,10 @@ lang_specific_driver (cl_decoded_option
+@@ -123,6 +129,9 @@ lang_specific_driver (cl_decoded_option
+   /* "-lstdc++" if it appears on the command line.  */
+   const cl_decoded_option *saw_libcxx = 0;
+ 
++  /* "-ldl" if it appears on the command line.  */
++  const cl_decoded_option *saw_libdl = 0;
++
+   /* An array used to flag each argument that needs a bit set for
+      DSOURCE, MATHLIB, WITHTHREAD, WITHLIBC or WITHLIBCXX.  */
+   int *args;
+@@ -139,6 +148,9 @@ lang_specific_driver (cl_decoded_option
+   /* By default, we throw on the time library if we have one.  */
+   int need_time = (TIME_LIBRARY[0] != '\0');
+ 
++  /* By default, we throw on the dl library if we have one.  */
++  int need_dl = (DL_LIBRARY[0] != '\0');
++
+   /* True if we saw -static. */
+   int static_link = 0;
+ 
+@@ -248,6 +260,11 @@ lang_specific_driver (cl_decoded_option
+ 	      args[i] |= TIMELIB;
+ 	      need_time = 0;
+ 	    }
++	  else if (strcmp (arg, DL_LIBRARY) == 0)
++	    {
++	      args[i] |= DLLIB;
++	      need_dl = 0;
++	    }
+ 	  else if (strcmp (arg, "c") == 0)
+ 	    args[i] |= WITHLIBC;
+ 	  else
+@@ -423,6 +440,12 @@ lang_specific_driver (cl_decoded_option
+ 	  saw_time = &decoded_options[i];
+ 	}
+ 
++      if (!saw_dl && (args[i] & DLLIB) && library > 0)
++	{
++	  --j;
++	  saw_dl = &decoded_options[i];
++	}
++
+       if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
+ 	{
+ 	  --j;
+@@ -483,9 +506,6 @@ lang_specific_driver (cl_decoded_option
+   /* Add `-lgphobos' if we haven't already done so.  */
+   if (library > 0 && phobos)
+     {
+-      // Default to static linking
+-      if (library == 1)
+-        library = 2;
+ 
+ #ifdef HAVE_LD_STATIC_DYNAMIC
+       if (library == 3 && static_link)
+@@ -510,6 +530,10 @@ lang_specific_driver (cl_decoded_option
  		       CL_DRIVER, &new_decoded_options[j]);
        added_libraries++;
        j++;
@@ -26,3 +90,19 @@ Index: b/src/gcc/d/d-spec.c
  
  #ifdef HAVE_LD_STATIC_DYNAMIC
        if (library == 3 && static_link)
+@@ -580,6 +604,15 @@ lang_specific_driver (cl_decoded_option
+ 		       &new_decoded_options[j++]);
+       added_libraries++;
+     }
++
++  if (saw_dl)
++    new_decoded_options[j++] = *saw_dl;
++  else if (library > 0 && need_dl)
++    {
++      generate_option (OPT_l, DL_LIBRARY, 1, CL_DRIVER,
++		       &new_decoded_options[j++]);
++      added_libraries++;
++    }
+ 
+   if (saw_libc)
+     new_decoded_options[j++] = *saw_libc;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gcc-7.git



More information about the Reproducible-commits mailing list