public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
@ 2020-07-02  6:04 sebastian.huber@embedded-brains.de
  2020-07-02 12:35 ` [Bug sim/26194] " simark at simark dot ca
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2020-07-02  6:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

            Bug ID: 26194
           Summary: sim/igen generates code leading to linker errors with
                    -fno-common (GCC 10 default)
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: sim
          Assignee: unassigned at sourceware dot org
          Reporter: sebastian.huber@embedded-brains.de
                CC: vapier at gentoo dot org
  Target Milestone: ---

For example building the v850 simulator for the v850-rtems target results with
a GCC 10 build compiler:

make[3]: Entering directory
'/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850'
gcc -O2 -g -pipe
-I/scratch/git-rtems-source-builder/rtems/build/tmp/sb-10000/6/rtems-v850/build/rtems/6/include
-DHAVE_CONFIG_H  -DWITH_DEFAULT_ALIGNMENT=NONSTRICT_ALIGNMENT
-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE   -DDEFAULT_INLINE=0
-DWITH_RESERVED_BITS=1  -Wall -Wdeclaration-after-statement -Wpointer-arith
-Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch
-Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement
-Wempty-body -Wmissing-parameter-type -Wold-style-declaration
-Wold-style-definition -Wformat-nonliteral   -DDEBUG
-I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850/../../newlib/libc/sys/sysnecv850
  -I. -I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850 -I../common
-I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850/../common
-I../../include
-I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850/../../include
-I../../bfd
-I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850/../../bfd
-I../../opcodes
-I../../../sourceware-mirror-binutils-gdb-4e394b2/sim/v850/../../opcodes  -g
-O2
-L/scratch/git-rtems-source-builder/rtems/build/tmp/sb-10000/6/rtems-v850/build/rtems/6/lib
-o run \
  nrun.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a 
../../libiberty/libiberty.a -ldl  -L../../zlib -lz  
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
libsim.a(idecode.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
multiple definition of `idecode_issue';
libsim.a(irun.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
libsim.a(engine.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
multiple definition of `idecode_issue';
libsim.a(irun.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
libsim.a(support.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
multiple definition of `idecode_issue';
libsim.a(irun.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
libsim.a(semantics.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
multiple definition of `idecode_issue';
libsim.a(irun.o):/scratch/git-rtems-source-builder/rtems/build/v850-rtems6-gdb-4e394b2-x86_64-linux-gnu-1/build/sim/v850/idecode.h:71:
first defined here

We have:

tail ./sim/v850/idecode.h
(SIM_DESC sd,
 instruction_word instruction_0,
 instruction_address cia);

instruction_address (*idecode_issue)
(SIM_DESC sd,
 instruction_word instruction_0,
 instruction_address cia);

#endif /* _IDECODE_H_*/

This is probably generated by (sim/igen/gen-idecode.c):

void
print_idecode_issue_function_header (lf *file,
                                     const char *processor,
                                     function_decl_type decl_type,
                                     int nr_prefetched_words)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug sim/26194] sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
  2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
@ 2020-07-02 12:35 ` simark at simark dot ca
  2020-07-02 15:45 ` sebastian.huber@embedded-brains.de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: simark at simark dot ca @ 2020-07-02 12:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Same idea as [1], the header file should only contain an "extern" declaration,
and the definition should be in one of the source files.

[1] https://sourceware.org/pipermail/gdb/2020-July/048772.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug sim/26194] sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
  2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
  2020-07-02 12:35 ` [Bug sim/26194] " simark at simark dot ca
@ 2020-07-02 15:45 ` sebastian.huber@embedded-brains.de
  2020-07-02 15:58 ` simark at simark dot ca
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2020-07-02 15:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

--- Comment #2 from Sebastian Huber <sebastian.huber@embedded-brains.de> ---
(In reply to Simon Marchi from comment #1)
> Same idea as [1], the header file should only contain an "extern"
> declaration, and the definition should be in one of the source files.
> 
> [1] https://sourceware.org/pipermail/gdb/2020-July/048772.html

This issue is unrelated to sim/ppc. For this I sent a patch:

https://sourceware.org/pipermail/gdb-patches/2020-July/170049.html

I have some difficulties to fix this bug in sim/igen.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug sim/26194] sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
  2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
  2020-07-02 12:35 ` [Bug sim/26194] " simark at simark dot ca
  2020-07-02 15:45 ` sebastian.huber@embedded-brains.de
@ 2020-07-02 15:58 ` simark at simark dot ca
  2020-07-03 19:04 ` cvs-commit at gcc dot gnu.org
  2020-07-03 19:05 ` sebastian.huber@embedded-brains.de
  4 siblings, 0 replies; 6+ messages in thread
From: simark at simark dot ca @ 2020-07-02 15:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

--- Comment #3 from Simon Marchi <simark at simark dot ca> ---
I did not mean it's the exact same issue, but it's the same idea.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug sim/26194] sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
  2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
                   ` (2 preceding siblings ...)
  2020-07-02 15:58 ` simark at simark dot ca
@ 2020-07-03 19:04 ` cvs-commit at gcc dot gnu.org
  2020-07-03 19:05 ` sebastian.huber@embedded-brains.de
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-03 19:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sebastian Huber <sh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4df5bbeb87a445dbc84b9ed677b2c721e5051b5

commit c4df5bbeb87a445dbc84b9ed677b2c721e5051b5
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Thu Jul 2 18:10:49 2020 +0200

    sim/igen: Fix linker error with -fno-common

    GCC 10 enables -fno-common by default.  This resulted in multiple
    definition linker errors since a global variable was declared and
    defined in a header file:

      ld: libsim.a(idecode.o):sim/v850/idecode.h:71: multiple definition of
      `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
      here

      ld: libsim.a(engine.o):sim/v850/idecode.h:71: multiple definition of
      `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
      here

      ld: libsim.a(support.o):sim/v850/idecode.h:71: multiple definition of
      `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
      here

      ld: libsim.a(semantics.o):sim/v850/idecode.h:71: multiple definition
      of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first
      defined here

    sim/igen

            PR sim/26194

            * lf.h (lf_get_file_type): Declare.
            * lf.c (lf_get_file_type): Define.
            * gen-idecode.c (print_idecode_issue_function_header): Use
            lf_get_file_type() to issue an extern variable declaration in
            case of header files.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug sim/26194] sim/igen generates code leading to linker errors with -fno-common (GCC 10 default)
  2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
                   ` (3 preceding siblings ...)
  2020-07-03 19:04 ` cvs-commit at gcc dot gnu.org
@ 2020-07-03 19:05 ` sebastian.huber@embedded-brains.de
  4 siblings, 0 replies; 6+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2020-07-03 19:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26194

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Sebastian Huber <sebastian.huber@embedded-brains.de> ---
Should be fixed now.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-07-03 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  6:04 [Bug sim/26194] New: sim/igen generates code leading to linker errors with -fno-common (GCC 10 default) sebastian.huber@embedded-brains.de
2020-07-02 12:35 ` [Bug sim/26194] " simark at simark dot ca
2020-07-02 15:45 ` sebastian.huber@embedded-brains.de
2020-07-02 15:58 ` simark at simark dot ca
2020-07-03 19:04 ` cvs-commit at gcc dot gnu.org
2020-07-03 19:05 ` sebastian.huber@embedded-brains.de

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