This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Getting LTO incremental linking work
- From: Tom de Vries <Tom_deVries at mentor dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Richard Biener <rguenther at suse dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Andi Kleen <ak at linux dot intel dot com>, Cary Coutant <ccoutant at google dot com>, Ian Lance Taylor <iant at google dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Sat, 28 Nov 2015 10:35:54 +0100
- Subject: Re: [RFC] Getting LTO incremental linking work
- Authentication-results: sourceware.org; auth=none
- References: <20151125085912 dot GD58491 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1511251155460 dot 4884 at t29 dot fhfr dot qr> <CAMe9rOpqi6fM_g1uG2077D+7SrJ5QqBX8mxhPDbah2jQzSpquw at mail dot gmail dot com> <20151125191740 dot GB5371 at kam dot mff dot cuni dot cz> <20151125230758 dot GF20593 at kam dot mff dot cuni dot cz>
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
...
Thanks,
- Tom