From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19362 invoked by alias); 20 Aug 2013 15:27:33 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19346 invoked by uid 48); 20 Aug 2013 15:27:32 -0000 From: "kukyakya at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/58203] New: memset/memcpy are discarded with -flto Date: Tue, 20 Aug 2013 15:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kukyakya at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg01047.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58203 Bug ID: 58203 Summary: memset/memcpy are discarded with -flto Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: kukyakya at gmail dot com It might be a duplicate of bug 51205 but it's happening again. [test.cpp] typedef void (*action_t)(const unsigned char*); extern "C" void _start(action_t action) { const unsigned char foo[256] = {}; action(foo); } typedef __SIZE_TYPE__ size_t; extern "C" void* //__attribute__((externally_visible)) // Workaround memset(void* dst, int c, size_t len) { unsigned char * d = (unsigned char*)dst; while(len--) *d++ = c; return dst; } [error] $ arm-none-linux-gnueabi-g++ -fno-exceptions -nostartfiles -static -nostdlib -nodefaultlibs -flto test.cpp -o test `memset' referenced in section `.text' of /tmp/cc7ooAE0.ltrans0.ltrans.o: defined in discarded section `.text' of /tmp/ccVDnjy6.o (symbol from plugin) collect2: error: ld returned 1 exit status [versions] arm-none-linux-gnueabi-g++ --version : 4.8.1 arm-none-linux-gnueabi-ld --version : 2.23.2