public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled.
@ 2015-02-16 16:21 m.ostapenko at partner dot samsung.com
  2015-02-16 16:48 ` [Bug gdb/17984] " palves at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: m.ostapenko at partner dot samsung.com @ 2015-02-16 16:21 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17984
           Summary: GDB fails to build on Aarch64 when -fno-common is
                    enabled.
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: m.ostapenko at partner dot samsung.com
                CC: marcus.shawcroft at arm dot com, y.gribov at samsung dot com
            Target: aarch64-linux-gnu

Created attachment 8131
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8131&action=edit
Trivial fix

When testing, I found out, that building GDB with -fno-common option fails on
Aarch64 with:

[  190s] gcc -O2 -g2 -feliminate-unused-debug-types -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector -Wformat
-Wformat-security -fmessage-length=0 -g -O0 -fno-common   -static-libstdc++
-static-libgcc    \
[  190s] >-------o gdb gdb.o aarch64-tdep.o aarch64-linux-tdep.o glibc-tdep.o
linux-tdep.o solib-svr4.o symfile-mem.o ser-base.o ser-unix.o ser-pipe.o
ser-tcp.o inf-ptrace.o fork-child.o aarch64-linux-nat.o proc-service.o
linux-thread-db.o linux-nat.o linux-fork.o linux-procfs.o linux-ptrace.o
linux-osdata.o linux-waitpid.o linux-personality.o remote.o dcache.o
tracepoint.o ax-general.o ax-gdb.o remote-fileio.o remote-notif.o ctf.o
tracefile.o tracefile-tfile.o  cli-dump.o cli-decode.o cli-script.o cli-cmds.o
cli-setshow.o cli-logging.o cli-interp.o cli-utils.o mi-out.o mi-console.o
mi-cmds.o mi-cmd-catch.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o
mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o
mi-cmd-info.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o tui-command.o
tui-data.o tui-disasm.o tui-file.o tui-hooks.o tui-interp.o tui-io.o
tui-layout.o tui-out.o tui-regs.o tui-source.o tui-stack.o tui-win.o
tui-windata.o tui-wingeneral.o tui-winsource.o tui.o python.o py-arch.o
py-auto-load.o py-block.o py-bpevent.o py-breakpoint.o py-cmd.o
py-continueevent.o py-xmethods.o py-event.o py-evtregistry.o py-evts.o
py-exitedevent.o py-finishbreakpoint.o py-frame.o py-framefilter.o
py-function.o py-gdb-readline.o py-inferior.o py-infevents.o py-infthread.o
py-lazy-string.o py-linetable.o py-newobjfileevent.o py-objfile.o py-param.o
py-prettyprint.o py-progspace.o py-signalevent.o py-stopevent.o py-symbol.o
py-symtab.o py-threadevent.o py-type.o py-utils.o py-value.o py-varobj.o
guile.o elfread.o stap-probe.o posix-hdep.o posix-strerror.o c-exp.o
cp-name-parser.o ada-exp.o jv-exp.o d-exp.o f-exp.o go-exp.o m2-exp.o p-exp.o
version.o annotate.o addrmap.o auto-load.o auxv.o agent.o bfd-target.o
blockframe.o breakpoint.o break-catch-sig.o break-catch-throw.o findvar.o
regcache.o cleanups.o charset.o continuations.o corelow.o disasm.o
dummy-frame.o dfp.o source.o value.o eval.o valops.o valarith.o valprint.o
printcmd.o block.o symtab.o psymtab.o symfile.o symfile-debug.o symmisc.o
linespec.o dictionary.o infcall.o infcmd.o infrun.o expprint.o environ.o
stack.o thread.o exceptions.o extension.o filesystem.o filestuff.o inf-child.o
interps.o minidebug.o main.o macrotab.o macrocmd.o macroexp.o macroscope.o
mi-common.o event-loop.o event-top.o inf-loop.o completer.o gdbarch.o
arch-utils.o gdbtypes.o gdb_bfd.o gdb_obstack.o osabi.o copying.o memattr.o
mem-break.o target.o target-dcache.o parse.o language.o build-id.o buildsym.o
findcmd.o std-regs.o signals.o exec.o reverse.o bcache.o objfiles.o observer.o
minsyms.o maint.o demangle.o dbxread.o coffread.o coff-pe-read.o dwarf2read.o
mipsread.o stabsread.o corefile.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o
dwarf2-frame-tailcall.o ada-lang.o c-lang.o d-lang.o f-lang.o objc-lang.o
ada-tasks.o ada-varobj.o c-varobj.o ui-out.o cli-out.o varobj.o vec.o go-lang.o
go-valprint.o go-typeprint.o jv-lang.o jv-valprint.o jv-typeprint.o jv-varobj.o
m2-lang.o opencl-lang.o p-lang.o p-typeprint.o p-valprint.o sentinel-frame.o
complaints.o typeprint.o ada-typeprint.o c-typeprint.o f-typeprint.o
m2-typeprint.o ada-valprint.o c-valprint.o cp-valprint.o d-valprint.o
f-valprint.o m2-valprint.o serial.o mdebugread.o top.o utils.o ui-file.o
user-regs.o frame.o frame-unwind.o doublest.o frame-base.o inline-frame.o
gnu-v2-abi.o gnu-v3-abi.o cp-abi.o cp-support.o cp-namespace.o reggroups.o
trad-frame.o tramp-frame.o solib.o solib-target.o prologue-value.o memory-map.o
memrange.o xml-support.o xml-syscall.o xml-utils.o target-descriptions.o
target-memory.o xml-tdesc.o xml-builtin.o inferior.o osdata.o gdb_usleep.o
record.o record-full.o gcore.o gdb_vecs.o jit.o progspace.o skip.o probe.o
common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o format.o registry.o
btrace.o record-btrace.o waitstatus.o print-utils.o rsp-low.o errors.o
common-debug.o debug.o common-exceptions.o btrace-common.o compile.o
compile-c-symbols.o compile-c-types.o compile-object-load.o
compile-object-run.o compile-loc2c.o compile-c-support.o inflow.o    init.o \
[  190s] >------   ../readline/libreadline.a ../opcodes/libopcodes.a
../bfd/libbfd.a  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   
-ldl -ldl -lncurses -lm -ldl     -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker
-export-dynamic /usr/lib64/libexpat.so   ../libiberty/libiberty.a 
build-gnulib/import/libgnu.a -ldl -Wl,--dynamic-list=./proc-service.list
[  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[  199s] /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[  199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540: first
defined here
[  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[  199s] /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[  199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540: first
defined here
[  199s] collect2: error: ld returned 1 exit status
[  199s] make[2]: *** [gdb] Error 1
[  199s] make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb'
[  199s] make[1]: *** [all-gdb] Error 2
[  199s] make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/gdb-7.8.1'
[  199s] make: *** [all] Error 2
[  199s] error: Bad exit status from /var/tmp/rpm-tmp.YfrTV4 (%build)


This happens because struct target_desc *tdesc_aarch64 is defined in
gdb/features/aarch64.c source file, that is included to many other source files
(gdb/aarch64-linux-nat.c, for example). So, we have multiple definition of
`tdesc_aarch64' error during link stage.

One possible solution for this issue is replacing 'struct target_desc
*tdesc_aarch64' with 'extern struct target_desc *tdesc_aarch64' in
gdb/features/aarch64.c and defining this pointer into another source file, for
example gdb/aarch64-linux-nat.c.

Trivial fix is attached.

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
@ 2015-02-16 16:48 ` palves at redhat dot com
  2015-02-16 16:50 ` m.ostapenko at partner dot samsung.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2015-02-16 16:48 UTC (permalink / raw)
  To: gdb-prs

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

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
Note features/aarch64.c is autogenerated (see top of file).

Instead, please remove the '#include "features/aarch64.c"' line
from aarch64-linux-nat.c, and add

extern struct target_desc *tdesc_aarch64;

to aarch64-tdep.h.

Try "grep tdesc_powerpc_e500l *" to see the same thing done for PowerPC.

You'll need to remove the initialize_tdesc_aarch64 line from
aarch64_linux_read_description, but that's really not necessary anyway - that's
already called in aarch64-tdep.c, at GDB startup.

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
  2015-02-16 16:48 ` [Bug gdb/17984] " palves at redhat dot com
@ 2015-02-16 16:50 ` m.ostapenko at partner dot samsung.com
  2015-02-16 16:56 ` m.ostapenko at partner dot samsung.com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: m.ostapenko at partner dot samsung.com @ 2015-02-16 16:50 UTC (permalink / raw)
  To: gdb-prs

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

Maxim Ostapenko <m.ostapenko at partner dot samsung.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #8131|0                           |1
        is obsolete|                            |

--- Comment #2 from Maxim Ostapenko <m.ostapenko at partner dot samsung.com> ---
Created attachment 8133
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8133&action=edit
Trivial fix - 2

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
  2015-02-16 16:48 ` [Bug gdb/17984] " palves at redhat dot com
  2015-02-16 16:50 ` m.ostapenko at partner dot samsung.com
@ 2015-02-16 16:56 ` m.ostapenko at partner dot samsung.com
  2015-02-16 21:02 ` palves at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: m.ostapenko at partner dot samsung.com @ 2015-02-16 16:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Maxim Ostapenko <m.ostapenko at partner dot samsung.com> ---
Pedro, thank you for your reply.

(In reply to Pedro Alves from comment #1)
> Note features/aarch64.c is autogenerated (see top of file).
> 
> Instead, please remove the '#include "features/aarch64.c"' line
> from aarch64-linux-nat.c, and add
> 
> extern struct target_desc *tdesc_aarch64;
> 
> to aarch64-tdep.h.
> 
> Try "grep tdesc_powerpc_e500l *" to see the same thing done for PowerPC.
> 
> You'll need to remove the initialize_tdesc_aarch64 line from
> aarch64_linux_read_description, but that's really not necessary anyway -
> that's already called in aarch64-tdep.c, at GDB startup.

Yes it works fine for me, I'm attaching another patch. Perhaps I should send it
to ML?

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
                   ` (2 preceding siblings ...)
  2015-02-16 16:56 ` m.ostapenko at partner dot samsung.com
@ 2015-02-16 21:02 ` palves at redhat dot com
  2015-02-17 17:19 ` cvs-commit at gcc dot gnu.org
  2015-02-24 22:20 ` qiyao at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2015-02-16 21:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
Yes, please.  If you could bundle that with a ChangeLog entry and a git commit
log, it'd be great.  See:

  https://sourceware.org/gdb/wiki/ContributionChecklist

Thanks!

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
                   ` (3 preceding siblings ...)
  2015-02-16 21:02 ` palves at redhat dot com
@ 2015-02-17 17:19 ` cvs-commit at gcc dot gnu.org
  2015-02-24 22:20 ` qiyao at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-02-17 17:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

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

commit 9f2e07213aa91f1882112df3e0d227638b7a085b
Author: Maxim Ostapenko <m.ostapenko@partner.samsung.com>
Date:   Mon Feb 16 20:24:53 2015 +0400

    Fix GDB build fail on Aarch64 when -fno-common is enabled

    Current trunk GDB (and gdb-7.8.1 too) fails to build on Aarch64 when
    -fno-common is enabled.  It fails during link stage due to multiple
    definition of `tdesc_aarch64':

    ...
    [  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
    [  199s]
    /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
    multiple definition of `tdesc_aarch64'
    [  199s]
    aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
    first defined here
    [  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
    [  199s]
    /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
    multiple definition of `tdesc_aarch64'
    [  199s]
    aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
    first defined here
    [  199s] collect2: error: ld returned 1 exit status
    [  199s] make[2]: *** [gdb] Error 1
    ...

    This happens because struct target_desc *tdesc_aarch64 is defined in
    gdb/features/aarch64.c, which is included by two files
    (gdb/aarch64-linux-nat.c and gdb/aarch64-tdep.c).

    gdb/Changelog
    2015-02-17  Max Ostapenko  <m.ostapenko@partner.samsung.com>

        PR gdb/17984
        * aarch64-linux-nat.c: Don't include features/aarch64.c anymore.
        (aarch64_linux_read_description): Remove initialize_tdesc_aarch64
        call.
        * aarch64-tdep.h (tdesc_aarch64): Declare.

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


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

* [Bug gdb/17984] GDB fails to build on Aarch64 when -fno-common is enabled.
  2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
                   ` (4 preceding siblings ...)
  2015-02-17 17:19 ` cvs-commit at gcc dot gnu.org
@ 2015-02-24 22:20 ` qiyao at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-02-24 22:20 UTC (permalink / raw)
  To: gdb-prs

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

Yao Qi <qiyao at gcc dot gnu.org> changed:

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

--- Comment #6 from Yao Qi <qiyao at gcc dot gnu.org> ---
Close as it is fixed.

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


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

end of thread, other threads:[~2015-02-24 22:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 16:21 [Bug gdb/17984] New: GDB fails to build on Aarch64 when -fno-common is enabled m.ostapenko at partner dot samsung.com
2015-02-16 16:48 ` [Bug gdb/17984] " palves at redhat dot com
2015-02-16 16:50 ` m.ostapenko at partner dot samsung.com
2015-02-16 16:56 ` m.ostapenko at partner dot samsung.com
2015-02-16 21:02 ` palves at redhat dot com
2015-02-17 17:19 ` cvs-commit at gcc dot gnu.org
2015-02-24 22:20 ` qiyao 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).