[RFC] Getting LTO incremental linking work

Tom de Vries Tom_deVries@mentor.com
Sat Nov 28 12:03:00 GMT 2015


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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.patch
Type: text/x-patch
Size: 574 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151128/4295bc8e/attachment.bin>


More information about the Gcc-patches mailing list