[Bug lto/60395] LTO link fails when -fno-builtin is specified

2021-12-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #6 from Andrew Pinski  ---
Dup of bug 58203.

*** This bug has been marked as a duplicate of bug 58203 ***

[Bug lto/60395] LTO link fails when -fno-builtin is specified

2014-03-03 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||lto, wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-03-03
 CC||hubicka at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1
  Known to fail||4.7.2, 4.8.2, 4.9.0

--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org ---
Confirmed on x86_64 with using -mstringop-strategy=libcall.  Shorter
single-file testcase:

void *memset(void *dest, int ch, __SIZE_TYPE__ count)
{
  char *p = (char *)dest;

  while (count--)
*p++ = (char)ch;
  return dest;
}
int main ()
{
  volatile int dummy[10] = {0};
  return dummy[0];
}

 gcc t.c -Os -mstringop-strategy=libcall -flto -fno-builtin
`memset' referenced in section `.text.startup' of
/tmp/ccdDUr5m.ltrans0.ltrans.o: defined in discarded section `.text' of
/tmp/ccApnJzK.o (symbol from plugin)
collect2: error: ld returned 1 exit status

1
t.o 2
177 b0e6a56d4c94b3b5 PREVAILING_DEF_IRONLY memset
180 b0e6a56d4c94b3b5 PREVAILING_DEF main

and then IPA kills the memset definition because it's unused at IPA time
and it isn't a builtin.  Then expansion re-introduces a call to memset
an we use the linker resolution and try to bind it locally which obviously
fails (even though a fallback is available in libc).

IMHO even with -fno-builtin IPA needs to preserve certain function bodies
we may introduce calls to late (memset, memcpy, memmove are the obvious
ones), much like we have special_function_p which matches on the function
name and not only the builtin property.  Or we need to simply _not_ mark
those definitons as non-builtin as we introduce calls to them late.  Or
we need to fixup things at the linker side (we introduce a call to the
_builtin_ memset but we discarded a non-builtin memset).

The special_function_p-like hack is probably easiest but not the robustest
solution.  Not sure if we can adjust the linkers idea of where a def resides
at all.

Honza?


[Bug lto/60395] LTO link fails when -fno-builtin is specified

2014-03-03 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org ---
This isn't just about builtins, but any library calls introduced after IPA.
E.g. -mveclibabi= calls come to my mind, if you define those functions in your
library/binary and link with -flto, you'll probably get the same problem.


[Bug lto/60395] LTO link fails when -fno-builtin is specified

2014-03-02 Thread patrick at motec dot com.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

--- Comment #1 from Patrick Oppenlander patrick at motec dot com.au ---
Created attachment 32245
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32245action=edit
Test cases


[Bug lto/60395] LTO link fails when -fno-builtin is specified

2014-03-02 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

--- Comment #2 from Andrew Pinski pinskia at gcc dot gnu.org ---
*** Bug 60394 has been marked as a duplicate of this bug. ***


[Bug lto/60395] LTO link fails when -fno-builtin is specified

2014-03-02 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60395

--- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org ---
Related to bug 58203 (or even a dup of that bug).