public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kukyakya at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-58203-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2013-08-20 15:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 15:27 kukyakya at gmail dot com [this message]
2013-08-20 15:28 ` [Bug lto/58203] " kukyakya at gmail dot com
2021-03-12 18:15 ` pinskia at gcc dot gnu.org
2021-12-24  8:26 ` pinskia at gcc dot gnu.org
2021-12-24 12:51 ` pinskia at gcc dot gnu.org
2021-12-24 12:51 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58203-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).