public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/54933] New: 'builtin symbol' referenced in section ... defined in discarded section
@ 2012-10-15 12:33 chrbr at gcc dot gnu.org
2013-01-18 6:33 ` [Bug lto/54933] " joey.ye at arm dot com
0 siblings, 1 reply; 2+ messages in thread
From: chrbr at gcc dot gnu.org @ 2012-10-15 12:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54933
Bug #: 54933
Summary: 'builtin symbol' referenced in section ... defined in
discarded section
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: chrbr@gcc.gnu.org
Target: x86
Created attachment 28450
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28450
preprocessed files
The attached case is a self-content skeleton reducing a newlib build, that
builds with -fno-builtin, used in a standard way (e.g no -fno-builtin.
this illustrates a problem when "malloc" and "free" are defined from the same
file, but the prevailing "free" version is called from no-builtin site, and the
"malloc" builtin version is called from the main site, so we get:
---
`malloc' referenced in section `.text' of bug.ltrans0.ltrans.o: defined in
discarded section `.text' of malloc.o (symbol from plugin)
---
malloc is PREVAILING_DEF_IRONLY. shouldn't it be PREVAILING_DEF ?
tested with binutils 2.22 and 2.23.51
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug lto/54933] 'builtin symbol' referenced in section ... defined in discarded section
2012-10-15 12:33 [Bug lto/54933] New: 'builtin symbol' referenced in section ... defined in discarded section chrbr at gcc dot gnu.org
@ 2013-01-18 6:33 ` joey.ye at arm dot com
0 siblings, 0 replies; 2+ messages in thread
From: joey.ye at arm dot com @ 2013-01-18 6:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54933
Joey Ye <joey.ye at arm dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |joey.ye at arm dot com
--- Comment #1 from Joey Ye <joey.ye at arm dot com> 2013-01-18 06:33:20 UTC ---
This issue especially impacts "retarget", where library functions are
"retargeted" to user implementations. Retarget is a common practice in
bare-metal development but runs into "defined in discarded section" with LTO
enabled.
Here is the retarget case:
# gcc version 4.8.0 20130115 (experimental) [trunk revision 195189] (GCC)
# GNU ld (GNU Binutils) 2.23.51.20130111
$ cat main.c
int main()
{
return puts("Hello");
}
// it works if following line is enabled
// __attribute__ ((used))
int _write(int c)
{
/* Do something */
return c;
}
$ cat lib-a.c
int puts(const char * str)
{
return _write(*str);
}
$ gcc -flto -c -o lib-a.o lib-a.c
$ ar rv liba.a lib-a.o
r - lib-a.o
$ gcc main.c liba.a -flto --entry=main -nostdlib -o l
`_write' referenced in section `.text' of liba.a(lib-a.o): defined in discarded
section `.text' of /tmp/ccwUUKiA.o (symbol from plugin)
collect2: error: ld returned 1 exit status
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-18 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 12:33 [Bug lto/54933] New: 'builtin symbol' referenced in section ... defined in discarded section chrbr at gcc dot gnu.org
2013-01-18 6:33 ` [Bug lto/54933] " joey.ye at arm 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).