public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: jit@gcc.gnu.org, "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2))
Date: Thu, 30 Oct 2014 19:29:00 -0000	[thread overview]
Message-ID: <1414695171.29411.16.camel@surprise> (raw)
In-Reply-To: <Pine.LNX.4.64.1410172126240.14369@digraph.polyomino.org.uk>

On Fri, 2014-10-17 at 21:52 +0000, Joseph S. Myers wrote:
> Does libgccjit.so end up getting linked with -static-libstdc++ 
> -static-libgcc? 
(sorry for belated reply)

It does when built with a bootstrap, but doesn't with
--disable-bootstrap.  In the former case, the builddir's gcc/Makefile in
the final stage has:
  LDFLAGS = -static-libstdc++ -static-libgcc
and we use $(LDFLAGS) in the src's gcc/jit/Make-lang.in in the rule for
$(LIBGCCJIT_FILENAME).

As far as I can tell, this comes from these lines:
   if test "$poststage1_libs" = ""; then
     poststage1_ldflags="-static-libstdc++ -static-libgcc"
   fi])
in the top-level configure.ac's code for:
   AC_ARG_WITH(boot-ldflags,

> If so, that could be problematic (are static libstdc++ 
> and libgcc necessarily built as PIC so it's even possible to embed them 
> into a shared library?).

It works (on this machine at least); the built libgccjit.so library
successfully runs the test suite.

Looking at the build logs, I see:
  -fPIC
within the xgcc args in the libgcc build logs, and
  -prefer-pic
within the libtool args in the libstdc++ build, which according to the
libtool docs means "try to build only PIC objects".

Hence I believe although we're currently statically-linking libgcc and
libstdc++ into libgccjit.so, they're position-independent.

> It's certainly not clear that the 
> -static-libstdc++ -static-libgcc default for building the compiler 
> executables is the right one for building libgccjit.so.

Agreed, but it's unclear to me what the default should be, and how to go
about fixing it.

That said, it appears that people who want the libgccjit.so to
dynamically-link against libgcc and libstdc++ can already do so, by
selecting appropriate configuration flags (though it's not quite clear
to me what the incantation is; presumably $poststage1_libs needs to be
non-empty to avoid triggering this clause:
   if test "$poststage1_libs" = ""; then
     poststage1_ldflags="-static-libstdc++ -static-libgcc"
   fi
, right ?)

Or maybe I could turn off that clause if the "--enable-host-shared" has
been specified, so it defaults to shared linkage for that setting?

Do you have thoughts on how I should address this?  Also, given that the
code works as-is, is resolving this a blocker for merging the jit
branch?  (I've been rebasing, and plan to repost the fixed-up patches
for review shortly)

Thanks
Dave


> The dump file handling appears to have no I/O error checking (no
> checking 
> for error on fopen, nothing obvious to prevent fwrite to a NULL m_file
> if 
> fopen did have an error, no checking for error on fclose (or fwrite)).

(already addressed in a different reply)

  parent reply	other threads:[~2014-10-30 18:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 17:39 [PATCH 0/5] Merger of jit branch (v2) David Malcolm
2014-10-13 17:39 ` [PATCH 3/5] timevar.h: Add an auto_timevar class David Malcolm
2014-10-14  9:14   ` Richard Biener
2014-10-14 15:58     ` David Malcolm
2014-10-15  8:09       ` Richard Biener
2014-10-13 17:39 ` [PATCH 1/5] libiberty: Expose choose_tmpdir, and fix constness of return type David Malcolm
2014-10-15 17:34   ` Jeff Law
2014-10-15 19:10     ` David Malcolm
2014-10-15 19:22       ` DJ Delorie
2014-10-13 17:39 ` [PATCH 2/5] gcc: configure and Makefile changes needed by jit David Malcolm
2014-10-15 17:37   ` Jeff Law
2014-10-15 18:48     ` David Malcolm
2014-10-15 19:00       ` Joseph S. Myers
2014-10-15 21:01       ` Jeff Law
2014-10-15 21:46         ` David Malcolm
2014-10-17 16:20           ` [PATCH] Avoid the need to install when running the jit testsuite David Malcolm
2014-10-17 17:58             ` Joseph S. Myers
2014-10-20 17:59       ` [jit] Drop libgccjit.pc David Malcolm
2014-10-20 20:12         ` Basile Starynkevitch
2014-10-20 20:30           ` Matthias Klose
2014-10-20 20:44           ` David Malcolm
2014-10-13 18:38 ` [PATCH 4/5] State cleanups David Malcolm
2014-10-16 22:08   ` [PATCH 4/5] State cleanups -- also note for MPX work Jeff Law
2014-10-17  2:12     ` David Malcolm
2014-10-17 17:04       ` Jeff Law
2014-10-14 15:14 ` Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-14 15:17   ` [PATCH 05/10] JIT-related changes outside of jit subdir David Malcolm
2014-10-15 17:46     ` Jeff Law
2014-10-17 21:52     ` Joseph S. Myers
2014-10-20 19:59       ` [jit] Add Sphinx to install.texi David Malcolm
2014-10-21  0:01         ` Joseph S. Myers
2014-10-21 16:20         ` Gerald Pfeifer
2014-10-21 19:30           ` David Malcolm
2014-10-30  3:08             ` [jit] Tweaks " David Malcolm
2014-10-14 15:22   ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-17 21:54     ` Joseph S. Myers
2014-10-20 18:58       ` [jit] Error-handling within gcc::jit::dump David Malcolm
2014-10-21  0:01         ` Joseph S. Myers
2014-10-30 19:29       ` David Malcolm [this message]
2014-10-31  5:16         ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) Joseph S. Myers
2014-10-31  6:30           ` [PATCH 06/10] Heart of the JIT implementation Jeff Law
2014-10-14 15:24   ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:50     ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 20:04       ` Mike Stump
2014-10-14 15:39   ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:55     ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 17:02   ` [PATCH 08/10] Documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 20:51     ` Jeff Law
2014-10-21 19:02       ` [jit] Update the docs David Malcolm
2014-10-15 17:03   ` [PATCH 09/10] Prebuilt texinfo documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 17:52     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414695171.29411.16.camel@surprise \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).