From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5359 invoked by alias); 10 Jan 2019 12:46:19 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 5339 invoked by uid 89); 10 Jan 2019 12:46:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:1c86 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mail-pf1-f169.google.com Received: from mail-pf1-f169.google.com (HELO mail-pf1-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Jan 2019 12:46:17 +0000 Received: by mail-pf1-f169.google.com with SMTP id w73so5251360pfk.10 for ; Thu, 10 Jan 2019 04:46:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=S5uDp+LmbbO7bhmi0StTOI+0G76R+SKp7hZ8g9jqeFA=; b=T1hmtg3GfGs6GklXTgCQj/l2ZGYD92vKgdnIiiGuUuvEOpXiapfkbRpJRrGBwmwEDq 8eaVvNyLGhx9bRJu7n9kcwv04Q8JanVeBF8eb9PNpNJOssISuML+UPQ2EIyopsy2VAYV dwcgDF2kpyShXlswYFLmhPXJGPrGzBGfbNwEAUjeMcho/uOt73U1T5yI4yt3Veslok3l hKwfblPY3mJCwGuPrekSaFBxgOt1I9+EnNLTs1CtXNczv+YLrq6kPtwPGfCZvyZGd3lx hrpXr8JIYVOQWjffh+ZuXOkGrik1dSRYVF1VGZzRVwkB5ddKNMxSAb//++gNb+d+Oc2u QfMA== X-Gm-Message-State: AJcUukfgCQYC9Z71tLj1mj5BVJnbpM49qoOecvocSHZGUjgU7EhyWHP1 G0O8wPgtir4e7LZQ11XunxykbFaa2aQf+Pw/ZU4= X-Google-Smtp-Source: ALg8bN5yeJQ/LEu1JqCY57vPm2QjihRcI+AuBKAEFWFzHpZyACOcWZQD02N3H/AVEZlIau+GyjqaiYEyH9trrcT1GU4= X-Received: by 2002:a62:1c86:: with SMTP id c128mr10523940pfc.54.1547124375441; Thu, 10 Jan 2019 04:46:15 -0800 (PST) MIME-Version: 1.0 References: <0511991f924b445cad0467ad28fc8f45.squirrel@mx.sdf.org> In-Reply-To: From: =?UTF-8?Q?Marc_Nieper=2DWi=C3=9Fkirchen?= Date: Tue, 01 Jan 2019 00:00:00 -0000 Message-ID: Subject: Re: about header file parsing To: Basile Starynkevitch Cc: akrl , jit@gcc.gnu.org, David Malcolm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-q1/txt/msg00031.txt.bz2 Am Do., 10. Jan. 2019 um 09:21 Uhr schrieb Marc Nieper-Wi=C3=9Fkirchen : > > Am Di., 8. Jan. 2019 um 22:16 Uhr schrieb Basile Starynkevitch > : > > [...] > > > Still another thing could be to use LTO: you'll compile your C file with > > GCC using -flto, you'll do LIBGCCJIT things, and the final executable > > sould be compiled and linked with -flto. > > Is using: > > gcc_jit_context_add_command_line_option (ctxt, "-flto helper.o"); > > supported to have the object generated by libgccjit statically linked > with the object helper.o before libgccjit emits the final dynamic > library? (Let's assume that helper.o has been compiled with -flto.) [...] Having taken a look at the source code of libgccjit, it seems that the command line options set by `gcc_jit_context_add_command_line_option' are not passed to the driver used to compile the generated 'fake.s': https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/jit/jit-playback.c?view=3Dmarkup#= l2407 Dave, would you agree to add a patch that reuses the command line options set by `gcc_jit_context_add_command_line_option' when the driver is invoked? In particular, one would want to be able to override `-fno-use-linker-plugin'. Here is a use case. Assume that jitted code wants to use (just to give an example). The struct obstack is opaque, and many "functions" are implemented as macros. To solve the issues raised in this thread, I would write a jit-obstack.c like the following: #include #include #include #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free struct jit_obstack { alignas (alignof (struct obstack)) char p[sizeof (struct obstack)]; }; int jit_obstack_init (struct jit_obstack *op) __attribute__ ((visibility ("hidden"))) { return obstack_init ((struct obstack *) op); } ... The jitted code would then access obstacks solely through jit-obstack.c. By doing so, we do not have to look at the internals of (which may be different on the programmer's and the target system!) and we do not have to recreate opaque structures in a gcc_jit_context. However, the code will only run as fast as C directly including if and only if we can use link-time optimization when creating the jitted shared object through libgccjit. -- Marc