public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51205] New: -flto discards memset/memcpy when only referenced by g++ generated code
@ 2011-11-18 8:02 bruck.michael at googlemail dot com
2012-06-06 10:54 ` [Bug lto/51205] " rguenth at gcc dot gnu.org
2012-06-19 2:13 ` bruck.michael at googlemail dot com
0 siblings, 2 replies; 3+ messages in thread
From: bruck.michael at googlemail dot com @ 2011-11-18 8:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51205
Bug #: 51205
Summary: -flto discards memset/memcpy when only referenced by
g++ generated code
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bruck.michael@googlemail.com
When LTO encounters a call to memset (or memcpy) that was auto-generated by g++
it does not register that dependency and incorrectly throws away instances of
memset/memcpy if they are not referenced elsewhere by the program.
*** command line:
arm-elf-gcc -nostartfiles -static -nostdlib -nodefaultlibs -flto
-fwhole-program test.cpp -o test
*** error:
`memset' referenced in section `.text' of /tmp/cc7Mshjq.ltrans0.ltrans.o:
defined in discarded section `.text' of /tmp/ccBgVaJK.o (symbol from plugin)
collect2: ld returned 1 exit status
*** test.cpp:
typedef void (*action_t)(const unsigned char *);
extern "C" void _start(action_t action)
{
// this creates a call to memset() in g++
const unsigned char foo[256] = {};
action(foo);
}
#include <stddef.h>
// uncomment for workaround:
// extern "C" void * memset(void * dst, int c, size_t length)
// __attribute__((externally_visible));
extern "C" void * memset(void * dst, int c, size_t length)
{
unsigned char * _dst = (unsigned char *)dst;
while (length--)
*_dst = c;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug lto/51205] -flto discards memset/memcpy when only referenced by g++ generated code
2011-11-18 8:02 [Bug c++/51205] New: -flto discards memset/memcpy when only referenced by g++ generated code bruck.michael at googlemail dot com
@ 2012-06-06 10:54 ` rguenth at gcc dot gnu.org
2012-06-19 2:13 ` bruck.michael at googlemail dot com
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-06 10:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51205
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2012-06-06
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-06 10:54:36 UTC ---
Can you try if this is fixed with GCC 4.7.x when using binutils 2.22 or newer
and using the linker plugin?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug lto/51205] -flto discards memset/memcpy when only referenced by g++ generated code
2011-11-18 8:02 [Bug c++/51205] New: -flto discards memset/memcpy when only referenced by g++ generated code bruck.michael at googlemail dot com
2012-06-06 10:54 ` [Bug lto/51205] " rguenth at gcc dot gnu.org
@ 2012-06-19 2:13 ` bruck.michael at googlemail dot com
1 sibling, 0 replies; 3+ messages in thread
From: bruck.michael at googlemail dot com @ 2012-06-19 2:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51205
Michael Bruck <bruck.michael at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |FIXED
--- Comment #2 from Michael Bruck <bruck.michael at googlemail dot com> 2012-06-19 02:13:02 UTC ---
(In reply to comment #1)
> Can you try if this is fixed with GCC 4.7.x when using binutils 2.22 or newer
> and using the linker plugin?
I tried with arm-eabi-gcc 4.7.1 and binutils 2.22.52 with the same command line
and the bug is fixed in those.
(don't know if it makes a difference that I switched to arm-eabi, but arm-elf
won't build anymore for me)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-19 2:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-18 8:02 [Bug c++/51205] New: -flto discards memset/memcpy when only referenced by g++ generated code bruck.michael at googlemail dot com
2012-06-06 10:54 ` [Bug lto/51205] " rguenth at gcc dot gnu.org
2012-06-19 2:13 ` bruck.michael at googlemail dot com
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).