[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||7.4.1, 8.3.1, 9.0
 Resolution|--- |FIXED
  Known to fail||7.4.0, 8.3.0

--- Comment #9 from Richard Biener  ---
Fixed.

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

--- Comment #10 from Richard Biener  ---
Author: rguenth
Date: Wed Apr  3 08:47:19 2019
New Revision: 270114

URL: https://gcc.gnu.org/viewcvs?rev=270114=gcc=rev
Log:
2019-04-03  Richard Biener  

PR lto/89896
* lto-wrapper.c (run_gcc): Avoid implicit rules making
the all target phony.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/lto-wrapper.c

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Wed Apr  3 08:46:35 2019
New Revision: 270113

URL: https://gcc.gnu.org/viewcvs?rev=270113=gcc=rev
Log:
2019-04-03  Richard Biener  

PR lto/89896
* lto-wrapper.c (run_gcc): Avoid implicit rules making
the all target phony.

Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/lto-wrapper.c

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

--- Comment #7 from Richard Biener  ---
Author: rguenth
Date: Wed Apr  3 08:46:00 2019
New Revision: 270112

URL: https://gcc.gnu.org/viewcvs?rev=270112=gcc=rev
Log:
2019-04-03  Richard Biener  

PR lto/89896
* lto-wrapper.c (run_gcc): Avoid implicit rules making
the all target phony.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/lto-wrapper.c

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

--- Comment #6 from Andreas Schwab  ---
Just make the target .PHONY.

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

H.J. Lu  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot 
gnu.org

--- Comment #5 from H.J. Lu  ---
$ gcc -shared -fPIC -flto=4 -o x.so isl.o -v
...
make -f /tmp/ccj2DsQs.mk -j4 all
 ^^^
...
/usr/local/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/../lib64/crt1.o: in
function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [: all] Error 1
lto-wrapper: fatal error: make returned 2 exit status

Since all.c matches the target "all", make tries to create "all".

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

--- Comment #4 from Richard Biener  ---
Index: gcc/lto-wrapper.c
===
--- gcc/lto-wrapper.c   (revision 270053)
+++ gcc/lto-wrapper.c   (working copy)
@@ -1671,7 +1671,7 @@ cont:
  int j = ltrans_priorities[i*2 + 1];
  fprintf (mstream, " \\\n\t%s", output_names[j]);
}
- fprintf (mstream, "\n");
+ fprintf (mstream, "\n\t@:\n");
  fclose (mstream);
  if (!jobserver)
{

fixes this, adding an empty rule to the all target:

/tmp/ccZYd6M0.ltrans0.ltrans.o:
@gcc-8  '-xlto' '-c' '-fno-openmp' '-fno-openacc' '-mtune=generic'
'-march=x86-64' '-fPIC' '-shared' '-fPIC' '-B' '/abuild/rguenther/trunk2-g/gcc'
'-v' '-save-temps' '-mtune=generic' '-march=x86-64'
'-fltrans-output-list=/tmp/ccZYd6M0.ltrans.out' '-fltrans' '-o'
'/tmp/ccZYd6M0.ltrans0.ltrans.o' '/tmp/ccZYd6M0.ltrans0.o'
all: \
/tmp/ccZYd6M0.ltrans0.ltrans.o
@:

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #3 from Richard Biener  ---
It seems to be make looking for all.c via the LTRANS makefile and us
invoking make -f /tmp/ccfGbAMc.mk -j2 all

/tmp/cczwBPXD.ltrans0.ltrans.o:
@gcc-8  '-xlto' '-c' '-fno-openmp' '-fno-openacc' '-mtune=generic'
'-march=x86-64' '-fPIC' '-shared' '-fPIC' '-v' '-save-temps' '-mtune=generic'
'-march=x86-64' '-fltrans-output-list=/tmp/cczwBPXD.ltrans.out' '-fltrans' '-o'
'/tmp/cczwBPXD.ltrans0.ltrans.o' '/tmp/cczwBPXD.ltrans0.o'
all: \
/tmp/cczwBPXD.ltrans0.ltrans.o

which eventually leads to

4924  execve("/usr/bin/cc", ["cc", "all.c", "/tmp/cczwBPXD.ltrans0.ltrans.o",
"-o", "all"], [/* 107 vars */]) = 0

if you make all.c invalid C then you see

> gcc-8  -shared -fPIC -flto=2 -x c t.c 
all.c:1:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ at end of
input
 invalid
 ^~~
make: *** [all] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-04-01 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-01
 CC||hjl.tools at gmail dot com,
   ||hubicka at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Liška  ---
Confirmed, minimal reproducer:

$ echo "" | gcc  -shared -fPIC -flto=2 -x c -
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld:
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64/../lib64/crt1.o: in
function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.29/csu/../sysdeps/x86_64/start.S:104:
undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [: all] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Looks to me a LD issue.
@H.J. can you please take a look?

[Bug lto/89896] -flto=4 is confused by presence of 'all.c' in a local directory. -flto=1 is not.

2019-03-31 Thread slyfox at inbox dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89896

Sergei Trofimovich  changed:

   What|Removed |Added

Summary|-flto=4 is confused by  |-flto=4 is confused by
   |presence of all.o in a  |presence of 'all.c' in a
   |local directory. -flto=1 is |local directory. -flto=1 is
   |not.|not.

--- Comment #1 from Sergei Trofimovich  ---
It seems that 'all.c' is actual trigger, not 'all.o'.