public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
	Richard Biener <rguenther@suse.de>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Andi Kleen <ak@linux.intel.com>,
	Cary Coutant <ccoutant@google.com>,
	Ian Lance Taylor <iant@google.com>,
	Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: Re: [RFC] Getting LTO incremental linking work
Date: Sat, 28 Nov 2015 12:03:00 -0000	[thread overview]
Message-ID: <56598994.2010703@mentor.com> (raw)
In-Reply-To: <5659757A.2080700@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

On 28/11/15 10:35, Tom de Vries wrote:
> On 26/11/15 00:07, Jan Hubicka wrote:
>> (flinker_output): New flag.
>
> Hi,
>
> this seems to have cause a regression when using a compiler configured
> for offloading (giving ~1000 fails in libgomp testing).
>
> For test-case libgomp.c/examples-4/array_sections-3.c, we enter run_gcc
> in lto-wrapper with args:
> ...
> Breakpoint 1, run_gcc (argc=4, argv=0x7fffffffde68) at
> src/gcc-gomp-4_0-branch/gcc/lto-wrapper.c:897
> 897       char *list_option_full = NULL;
> (gdb) p argv[0]
> $8 = 0x7fffffffe104 "lto-wrapper"
> (gdb) p argv[1]
> $9 = 0x7fffffffe1af "-fresolution=array_sections-3.res"
> (gdb) p argv[2]
> $10 = 0x7fffffffe1d1 "-flinker-output=exec"
> (gdb) p argv[3]
> $11 = 0x7fffffffe1e6 "array_sections-3.o"
> ...
>
> And here (cc-ing author of this bit) we decide that -flinker-output=exec
> is a file:
> ...
> /* If object files contain offload sections, but do not contain LTO
>     sections,
>     then there is no need to perform a link-time recompilation, i.e.
>     lto-wrapper is used only for a compilation of offload images. */
> if (have_offload && !have_lto)
>    {
>      for (i = 1; i < argc; ++i)
>        if (strncmp (argv[i], "-fresolution=",
>             sizeof ("-fresolution=") - 1))
>      {
>        char *out_file;
>        /* Can be ".o" or ".so". */
>        char *ext = strrchr (argv[i], '.');
>        if (ext == NULL)
>          out_file = make_temp_file ("");
>        else
>          out_file = make_temp_file (ext);
>        /* The linker will delete the files we give it, so make
>           copies. */
>        copy_file (out_file, argv[i]);
>        printf ("%s\n", out_file);
>      }
>      goto finish;
>    }
> ...
>
> And try to copy it:
> ...
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff783d7e0 in feof () from /lib/libc.so.6
> (gdb) bt
> #0  0x00007ffff783d7e0 in feof () from /lib/libc.so.6
> #1  0x0000000000406ff5 in copy_file (dest=0x71cdd0 "/tmp/ccL6HCCe",
> src=0x7fffffffe1d1 "-flinker-output=exec")
>      at lto-wrapper.c:769
> #2  0x00000000004080b7 in run_gcc (argc=4, argv=0x7fffffffde68) at
> gcc/lto-wrapper.c:1109
> #3  0x0000000000409873 in main (argc=4, argv=0x7fffffffde68) at
> gcc/lto-wrapper.c:1396
> ...
>

This patch fixes the failures. I'm not sure if this is the right or 
complete fix though.

Thanks,
- Tom




[-- Attachment #2: tmp.patch --]
[-- Type: text/x-patch, Size: 574 bytes --]

diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index b9ac535..e4772d1 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1096,7 +1096,10 @@ run_gcc (unsigned argc, char *argv[])
   if (have_offload && !have_lto)
     {
       for (i = 1; i < argc; ++i)
-	if (strncmp (argv[i], "-fresolution=", sizeof ("-fresolution=") - 1))
+	if (strncmp (argv[i], "-fresolution=",
+		     sizeof ("-fresolution=") - 1) != 0
+	    && strncmp (argv[i], "-flinker-output=",
+			sizeof ("-flinker-output=") - 1) != 0)
 	  {
 	    char *out_file;
 	    /* Can be ".o" or ".so".  */

  reply	other threads:[~2015-11-28 11:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25  9:04 Jan Hubicka
2015-11-25 11:19 ` Richard Biener
2015-11-25 15:45   ` H.J. Lu
2015-11-25 19:21     ` Jan Hubicka
2015-11-25 23:09       ` Jan Hubicka
2015-11-25 23:56         ` Jan Hubicka
2015-11-28 10:35         ` Tom de Vries
2015-11-28 12:03           ` Tom de Vries [this message]
2015-11-28 16:05             ` Ilya Verbin
2015-11-28 17:41               ` Tom de Vries
2015-11-29 21:15                 ` Jan Hubicka
2015-11-25 18:54   ` Jan Hubicka
2015-11-26 10:15     ` Richard Biener
2015-11-26 20:30       ` Jan Hubicka
2015-11-25 23:59   ` Andi Kleen
2015-11-26  0:24 ` Andi Kleen
2015-11-26  0:54   ` Jan Hubicka
2015-11-26  1:55     ` Andi Kleen
2015-11-26  2:02       ` Jan Hubicka
2015-11-26  2:12         ` Andi Kleen
2015-11-26  6:33           ` Jan Hubicka
2015-11-26 10:33     ` Richard Biener
2016-03-16 17:33 ` H.J. Lu

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=56598994.2010703@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=ak@linux.intel.com \
    --cc=ccoutant@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=hubicka@ucw.cz \
    --cc=iant@google.com \
    --cc=kirill.yukhin@gmail.com \
    --cc=rguenther@suse.de \
    /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).