public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options
@ 2013-01-15 17:10 janis at gcc dot gnu.org
  2013-01-15 17:15 ` [Bug lto/55994] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: janis at gcc dot gnu.org @ 2013-01-15 17:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

             Bug #: 55994
           Summary: multiple definition or memset or strlen for builtins
                    tests with LTO options
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janis@gcc.gnu.org
            Target: *-*-eabi or *-elf


I get the following test failures for multiple targets for GCC 4.7 and
mainline:

FAIL: gcc.c-torture/execute/builtins/memcpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/memmove-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/memops-asm.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/mempcpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/memset-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/memset.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/pr23484-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/snprintf-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/sprintf-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/stpcpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/stpncpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strcat-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strcpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strlen-2.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strlen-3.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strlen.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strncat-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/strncpy-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/builtins/vsnprintf-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects 
FAIL: gcc.c-torture/execute/builtins/vsprintf-chk.c compilation,  -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects

The reported failure is

/tmp/cc3DFMVG.ltrans1.ltrans.o: In function `memset':
cc3DFMVG.ltrans1.o:(.text+0x558): multiple definition of `memset'
/scratch/janisjo/build6/fsf-4.7-arm-eabi/install/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-memset.o):/scratch/janisjo/build6/fsf-4.7-arm-eabi/src/newlib-mainline/newlib/libc/string/memset.c:57:
first defined here
collect2: error: ld returned 1 exit status

or

/tmp/cc2KdAgP.ltrans0.ltrans.o: In function `strlen':
cc2KdAgP.ltrans0.o:(.text+0x0): multiple definition of `strlen'
/scratch/janisjo/build6/fsf-4.7-arm-eabi/install/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-strlen.o):/scratch/janisjo/build6/fsf-4.7-arm-eabi/src/newlib-mainline/newlib/libc/machine/arm/strlen.c:68:
first defined here
collect2: error: ld returned 1 exit status

I've seen the failures for arm-none-eabi and powerpc-none-eabi with FSF sources
(the only targets I've tried) and also for CodeSourcery sources for those plus
mips-sde-elf, m68k-elf, and i686-mingw32.  They all use newlib.  The same tests
pass for GNU/Linux targets.

These test options were added for GCC 4.7.

This problem was mentioned in PR54139.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
@ 2013-01-15 17:15 ` pinskia at gcc dot gnu.org
  2013-01-15 17:44 ` ubizjak at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-15 17:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-15
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-15 17:14:25 UTC ---
I think these all fail with a static libc.  Anyways confirmed on
aarch64-thunder-elf and mipsisa64-octeon-elf targets.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
  2013-01-15 17:15 ` [Bug lto/55994] " pinskia at gcc dot gnu.org
@ 2013-01-15 17:44 ` ubizjak at gmail dot com
  2013-01-15 17:49 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-15 17:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-15 17:44:20 UTC ---
"-Wl,--allow-multiple-definition" should be appended to additional_flags for
affected targets.

--cut here--
Index: builtins.exp
===================================================================
--- builtins.exp        (revision 195056)
+++ builtins.exp        (working copy)
@@ -40,6 +40,8 @@
 set additional_flags ""
 if [istarget "powerpc-*-darwin*"] {
    lappend additional_flags "-Wl,-multiply_defined,suppress"
+} elseif [istarget "arm-*-*"] {
+   lappend additional_flags "-Wl,--allow-multiple-definition"
 }

 foreach src [lsort [find $srcdir/$subdir *.c]] {
--cut here--

Probably this option should be the default in builtins.exp.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
  2013-01-15 17:15 ` [Bug lto/55994] " pinskia at gcc dot gnu.org
  2013-01-15 17:44 ` ubizjak at gmail dot com
@ 2013-01-15 17:49 ` ubizjak at gmail dot com
  2013-01-15 20:00 ` [Bug testsuite/55994] " janis at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-15 17:49 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-15 17:48:51 UTC ---
Please also read thread at [1].

[1] http://gcc.gnu.org/ml/gcc-help/2011-10/msg00201.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug testsuite/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-01-15 17:49 ` ubizjak at gmail dot com
@ 2013-01-15 20:00 ` janis at gcc dot gnu.org
  2013-01-16 18:53 ` janis at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janis at gcc dot gnu.org @ 2013-01-15 20:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

--- Comment #4 from Janis Johnson <janis at gcc dot gnu.org> 2013-01-15 20:00:17 UTC ---
Patch posted: <http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00801.html>.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug testsuite/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-01-15 20:00 ` [Bug testsuite/55994] " janis at gcc dot gnu.org
@ 2013-01-16 18:53 ` janis at gcc dot gnu.org
  2013-01-25  0:27 ` janis at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janis at gcc dot gnu.org @ 2013-01-16 18:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

--- Comment #5 from Janis Johnson <janis at gcc dot gnu.org> 2013-01-16 18:52:56 UTC ---
Author: janis
Date: Wed Jan 16 18:52:51 2013
New Revision: 195250

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195250
Log:
    PR testsuite/55994
    * gcc.c-torture/execute/builtins/builtins.exp: Add
    -Wl,--allow-multiple-definition for eabi and elf targets.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug testsuite/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-01-16 18:53 ` janis at gcc dot gnu.org
@ 2013-01-25  0:27 ` janis at gcc dot gnu.org
  2013-03-20  9:20 ` sebastian.huber@embedded-brains.de
  2013-03-22 16:03 ` joel at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: janis at gcc dot gnu.org @ 2013-01-25  0:27 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

--- Comment #6 from Janis Johnson <janis at gcc dot gnu.org> 2013-01-25 00:26:43 UTC ---
Author: janis
Date: Fri Jan 25 00:26:34 2013
New Revision: 195458

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195458
Log:
    Backport from mainline
    2013-01-16  Janis Johnson  <janisjo@codesourcery.com>

    PR testsuite/55994
    * gcc.c-torture/execute/builtins/builtins.exp: Add
    -Wl,--allow-multiple-definition for eabi and elf targets.

Modified:
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_7-branch/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug testsuite/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-01-25  0:27 ` janis at gcc dot gnu.org
@ 2013-03-20  9:20 ` sebastian.huber@embedded-brains.de
  2013-03-22 16:03 ` joel at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2013-03-20  9:20 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

Sebastian Huber <sebastian.huber@embedded-brains.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sebastian.huber@embedded-br
                   |                            |ains.de

--- Comment #7 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2013-03-20 09:20:24 UTC ---
The crucial thing is also that all these functions are recognized as builtins
and GCC knows what they are expected to do.  The failure also vanishes if
-fno-builtin is used.

Lets have a look at this example:

gcc 1.c 2.c 3.c -l4

I expect that the modules 1.o 2.o 3.o end up in the executable and unresolved
symbols inside this module set are resolved with definitions provided by the
library 4.  In particular if I have a global function f() in 2.c then I expect
to have this function in my executable even in case a global function f() is
also defined in the library 4.

This is wrong for builtins.  Here GCC seems to assume that implementations are
interchangeable.  It would be quite interesting to know what happens if we
compile libc with -flto.

In one failed GCC test f() is memcpy(), 2.c is 20010124-1-lib.c and lib4 is
libc.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug testsuite/55994] multiple definition or memset or strlen for builtins tests with LTO options
  2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-03-20  9:20 ` sebastian.huber@embedded-brains.de
@ 2013-03-22 16:03 ` joel at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: joel at gcc dot gnu.org @ 2013-03-22 16:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55994

Joel Sherrill <joel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |joel at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #8 from Joel Sherrill <joel at gcc dot gnu.org> 2013-03-22 16:03:14 UTC ---
Sebastian's patch applied to the head and 4.8 branch. Closing.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-03-22 16:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-15 17:10 [Bug lto/55994] New: multiple definition or memset or strlen for builtins tests with LTO options janis at gcc dot gnu.org
2013-01-15 17:15 ` [Bug lto/55994] " pinskia at gcc dot gnu.org
2013-01-15 17:44 ` ubizjak at gmail dot com
2013-01-15 17:49 ` ubizjak at gmail dot com
2013-01-15 20:00 ` [Bug testsuite/55994] " janis at gcc dot gnu.org
2013-01-16 18:53 ` janis at gcc dot gnu.org
2013-01-25  0:27 ` janis at gcc dot gnu.org
2013-03-20  9:20 ` sebastian.huber@embedded-brains.de
2013-03-22 16:03 ` joel at gcc dot gnu.org

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).