Building RTEMS's PowerPC (--target=powerpc-rtems4.12) GDB 7.12 fails with the following errors: ../sim/ppc/libsim.a(sim_calls.o): In function `sim_io_printf_filtered': ../../../gdb-7.12/sim/ppc/sim_calls.c:(.text+0x17c): undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_load': ../../../gdb-7.12/sim/ppc/sim_calls.c:(.text+0x291): undefined reference to `error' ../../../gdb-7.12/sim/ppc/sim_calls.c:(.text+0x31d): undefined reference to `error' ../../../gdb-7.12/sim/ppc/sim_calls.c:(.text+0x357): undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_create_inferior': ../../../gdb-7.12/sim/ppc/sim_calls.c:(.text+0x53e): undefined reference to `error' The errors.o object file has a C++ mangled `error` symbol while the sim code is looking for a C linkage symbol: nm build/powerpc-rtems4.12-gdb-7.12-x86_64-freebsd10.3-1/build/gdb/errors.o 0000000000000120 T _Z14internal_errorPKciS0_z U _Z15internal_verrorPKciS0_P13__va_list_tag 00000000000001a0 T _Z16internal_warningPKciS0_z U _Z17internal_vwarningPKciS0_P13__va_list_tag 0000000000000090 T _Z5errorPKcz U _Z6verrorPKcP13__va_list_tag 0000000000000000 T _Z7warningPKcz U _Z8vwarningPKcP13__va_list_tag The GDB target builds on Linux and does not build on FreeBSD.
This is a regression in 7.12 and later (including 8.0). It results in build failures on both FreeBSD and OS X. It probably results in runtime failures on Linux as the powerpc simulator code is invoking the 'error' function from glibc with a different prototype. A patch has been posted to gdb-patches@ since November of 2016 but is awaiting review by an approver.
This issue also happens on Windows when building on MSYS2: ../sim/ppc/libsim.a(sim_calls.o): In function `sim_io_read_stdin': D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:302: undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_io_write_stdout': D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:320: undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_io_write_stderr': D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:339: undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_io_printf_filtered': D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:358: undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o): In function `sim_load': D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:105: undefined reference to `error' ../sim/ppc/libsim.a(sim_calls.o):D:\opt\rtems\rsb.git\rtems\build\prg7xwm1\build\sim\ppc/../../../gdb-7.12/sim/ppc/sim_calls.c:125: more undefined references to `error' follow Also tracked in RTEMS under https://devel.rtems.org/ticket/2990#comment:13
A patch was proposed in this thread https://sourceware.org/ml/gdb-patches/2016-11/msg00760.html by John Baldwin. Any chance of reaching a conclusion on it so psim builds on FreeBSD?
We use the "Target Milestone" field when the GDB group has decided that the PR must be fixed for that release. Since this is not an 8.0.x regression, I do not consider this issue as being required for the 8.0.1 release, and therefore removed the target milestone.
This was a regression that appeared in 7.12. Isn't that enough to include it in an 8.0.1?
> This was a regression that appeared in 7.12. Isn't that enough to > include it in an 8.0.1? If the fix is accepted and deemed safe for backporting, then yes, absolutely. We also typically give a bit of extra time to those actively working on fixing a bug they would really like to be fixed when they can show a plan to have the bug fixed relatively quickly. However, since this isn't an 8.0 -> 8.0.1 regression, an 8.0.1 release without the fix wouldn't make the situation worse for that particular issue. So it's unfair in that case to block everyone else while hoping someone fixes it.
To be clear, there is a fix that hass been posted multiple times to gdb-patches@ since November of 2016, it is just waiting on a reviewer / approver. Pedro agreed to the approach used in the patch when this issue was first raised in a thread on gdb@ back in November (and asked me to then submit the patch to gdb-patches@ for review). The issue here is that I can't get anyone to approve the patch, not that a fix isn't available. I had marked it as a milestone in the hopes of resolving the impasse.
I pinged Mike Frysinger about this PR since he was the one who commented on the email thread and isn't on this PR.
The master branch has been updated by John Baldwin <jhb@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=625ce09c1cfb557725310f602ee66ac1475d780e commit 625ce09c1cfb557725310f602ee66ac1475d780e Author: John Baldwin <jhb@FreeBSD.org> Date: Mon Sep 4 19:53:50 2017 -0700 Define an error function in the PPC simulator library. Previously this used the error function from GDB directly when linked against GDB instead of the error method in the host callbacks structure. This was exposed via a link error when GDB was converted to C++. The error function invokes the error callback similar to sim_io_error. Note that there are also error functions in sim/ppc/main.c and sim/ppc/misc.c. The ppc libsim.a expects each consumer to provide several symbols used by the library including "error". sim-calls.c provides these symbols when the library is linked into gdb. The dgen, igen, tmp-filter, tmp-ld-decode, tmp-ld-cache, and tmp-ld-insn programs use the functions from misc.c. psim uses the functions from main.c. sim/ppc/ChangeLog: PR sim/20863 * sim_calls.c (error): New function.
The gdb-8.0-branch branch has been updated by John Baldwin <jhb@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6854bcdfba43dd3a2058565bbf85868c9914bf39 commit 6854bcdfba43dd3a2058565bbf85868c9914bf39 Author: John Baldwin <jhb@FreeBSD.org> Date: Mon Sep 4 19:53:50 2017 -0700 Define an error function in the PPC simulator library. Previously this used the error function from GDB directly when linked against GDB instead of the error method in the host callbacks structure. This was exposed via a link error when GDB was converted to C++. The error function invokes the error callback similar to sim_io_error. Note that there are also error functions in sim/ppc/main.c and sim/ppc/misc.c. The ppc libsim.a expects each consumer to provide several symbols used by the library including "error". sim-calls.c provides these symbols when the library is linked into gdb. The dgen, igen, tmp-filter, tmp-ld-decode, tmp-ld-cache, and tmp-ld-insn programs use the functions from misc.c. psim uses the functions from main.c. sim/ppc/ChangeLog: PR sim/20863 * sim_calls.c (error): New function.
Fix merged to 8.0 branch for 8.0.1.