Re: [gdb-7.5.91] mips sim fails to build on mingw32

Joel Sherrill
2013-03-17T16:05:20Z

[-- Attachment #1: Type: text/plain, Size: 5057 bytes --]

Comments interspersed but the bottom line is that this is
an ugly issue where I believe a number of the simulators
have hard-coded dependencies on dv-sockser.o and do
not link without it even on CentOS. These sims are:

frv/Makefile.in:CONFIG_DEVICES = dv-sockser.o
iq2000/Makefile.in:CONFIG_DEVICES = dv-sockser.o
m32r/Makefile.in:CONFIG_DEVICES = dv-sockser.o
mn10300/Makefile.in: dv-sockser.o
sh64/Makefile.in:CONFIG_DEVICES = dv-sockser.o

Plus m68hc11 which does not honor --enable-sim-hardware
in its configure.ac. Based on the target name, it just enables
hardware. It appears to be broken in another way.

I have attached a patch which addresses common, mips, bfin
and makes m68hc11 use the conditional for dv-sockser.o. It
doesn't make m68hc11 honor --enable-sim-hardware.

mips and bfin build fine with this patch with or without
--enable-sim-hardware.

I don't know what to do about the other targets. My recommendation
would be:

+ m68hc11 -minimum honor --enable-sim-hardware
+ others - if dependency on dv-sockser.o is hard-coded and unavoidable,
the entire simulator is unsupported on mingw32.

I am certainly open for suggestions.

On 3/16/2013 11:14 PM, Ralf Corsepius wrote:
> On 03/16/2013 04:08 PM, Joel Sherrill wrote:
>> On 3/16/2013 1:52 AM, Ralf Corsepius wrote:
>>> On 03/16/2013 05:33 AM, Ralf Corsepius wrote:
>>>> On 03/15/2013 07:37 PM, Joel Sherrill wrote:
>>>>> My recollection is that it did not link on CentOS 6 and was missing
>>>>> these symbols. Disabling it again should make it obvious.
>>>> Reverting your patch lets build mips-rtems*gdb-7.5.91 build
>>>> successfully on all hosts I am build gdb on [1]
>>>>
>>>> This is not surprising to me, as reverting the patch pushes
>>>> mips*gdb-7.5.91's configuration into a similar state as gdb-7.5.1 was,
>>>> which built for all of my build hosts.
>>>>
>>>>> But I didn't build in any particularly special way and it failed.
>>>> I am suspecting you were building mipstx39-rtems-gdb.
>>> OK, I found the original thread:
>>> http://www.sourceware.org/ml/gdb-patches/2012-09/msg00030.html
>>>
>>> All I can say, I can not reproduce the issue you were reporting with
>>> gdb-7.5.1 and gdb-7.5.91. Reverting this change brings back
>>> mingw32-w64/gdb-7.5.91.
>> It is still there if you configure correctly.
> "Correctly" is a bold term!
>
>> On a completely up to date
>> CentOS 6.x install. I reversed the patch locally and configured like this:
>>
>> ../gdb-7.5.91/configure --target=mips-rtems4.11 \
>> --prefix=/home/joel/test-gdb/install/ --enable-sim \
>> --enable-sim-hardware --enable-timebase --enable-sim-trace &&
>> make
>>
>> And the build failed like this:
>>
>> -o run \
>> nrun.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a
>> ../../libiberty/libiberty.a -lm -lm -lz -lnsl
>> libsim.a(interp.o): In function `sim_open':
>> /home/joel/test-gdb/b-gdb/sim/mips/../../../gdb-7.5.91/sim/mips/interp.c:552:
>> undefined reference to `sockser_addr'
> This fails on all hosts for me.
FWIW the host pattern is mingw32 for the work around and
mingw64 may have this as well. I have no way to test this.
> But ... this provides further insights:
>
> I configure using "default" simulator flags:
> --enable-sim
>
> You configure using "exotic" simulator flags:
> --enable-sim --enable-sim-hardware --enable-timebase --enable-sim-trace
>
> Why you're using them, I don't know.
Very simple. configure options are supposed to be used or ignored
by each component. That is by definition.

--enable-sim-hardware
====================
It is a generic option to indicate that if the simulator has optional
devices, enable them all.

Simulators that don't have anything to enable should just work or ignore
the flag.

The PowerPC simulator does something meaningful with this. All simulators
using common/acinclude.m4 are apparently broken when this is enabled.

--enable-sim-timease
==================
sim/ppc specific. Correctly ignored everywhere else. No issue.

--enable-sim-trace
================
This enables execution trace capabilities which are useful in debug.
This option is present in 26 subdirectories in sim so appears to be
universal or close.
>
> Further trial and error with your patch reversed shows:
> --enable-sim-hardware triggers the link-error your reported on all hosts.
> All other permutations of --enable-sim --enable-sim-{timebase,sim-trace}
> build.
>
> I conclude from this:
> sim/mips only needs dv-sockser.o for tx39* targets or when
> --enable-sim-hardware is used.
>
> => The patch is wrong and should be reverted. The configuration magic to
> pull in dv-socksers.o should be reworked and likely needs to be keyed to
> -enable-sim-hardware.
Agreed. This is a bug in common/acinclude.m4 and (possibly) the Makefile.in
for the actual simulators.
>
>
> Ralf
>

--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985

[-- Attachment #2: sockser_diff_v1.txt --]
[-- Type: text/plain, Size: 3286 bytes --]

common/ChangeLog:
2013-03-17 Joel Sherrill <joel.sherrill@oarcorp.com>

* acinclude.m4: Add SIM_DV_SOCKSER_O which is empty on hosts
which do not support dv-sockser.o.

bfin/ChangeLog:
2013-03-17 Joel Sherrill <joel.sherrill@oarcorp.com>

* configure.ac: Use $SIM_DV_SOCKSER_O
* configure: Regenerated.

m68hc11/ChangeLog:
2013-03-17 Joel Sherrill <joel.sherrill@oarcorp.com>

* configure.ac: Use $SIM_DV_SOCKSER_O
* configure: Regenerated.

mips/ChangeLog:
2013-03-17 Joel Sherrill <joel.sherrill@oarcorp.com>

* configure.ac: Use $SIM_DV_SOCKSER_O
* configure: Regenerated.

diff -uNr gdb-7.5.91-virgin/sim/bfin/configure.ac gdb-7.5.91/sim/bfin/configure.ac
--- gdb-7.5.91-virgin/sim/bfin/configure.ac 2012-04-09 01:13:06.000000000 -0500
+++ gdb-7.5.91/sim/bfin/configure.ac 2013-03-17 10:29:12.831880985 -0500
@@ -56,17 +56,7 @@
sys/mman.h \
])

-BFIN_SIM_EXTRA_OBJS=
-
-dnl make sure the dv-sockser code can be supported (i.e. windows)
-case ${host} in
- *mingw32*) ;;
- *)
- AC_DEFINE_UNQUOTED([HAVE_DV_SOCKSER], 1, [Define if dv-sockser is usable.])
- BFIN_SIM_EXTRA_OBJS="${BFIN_SIM_EXTRA_OBJS} dv-sockser.o"
- ;;
-esac
-
+BFIN_SIM_EXTRA_OBJS="${BFIN_SIM_EXTRA_OBJS} ${SIM_DV_SOCKSER_O}"
AC_SUBST([BFIN_SIM_EXTRA_OBJS], ${BFIN_SIM_EXTRA_OBJS})

PKG_PROG_PKG_CONFIG
Binary files gdb-7.5.91-virgin/sim/bfin/.configure.ac.swp and gdb-7.5.91/sim/bfin/.configure.ac.swp differ
diff -uNr gdb-7.5.91-virgin/sim/common/acinclude.m4 gdb-7.5.91/sim/common/acinclude.m4
--- gdb-7.5.91-virgin/sim/common/acinclude.m4 2012-11-20 08:41:08.000000000 -0600
+++ gdb-7.5.91/sim/common/acinclude.m4 2013-03-17 10:24:21.757167294 -0500
@@ -647,6 +647,16 @@
*) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
esac
done
+ # mingw32 does not support sockser
+ SIM_DV_SOCKSER_O=""
+ case ${host} in
+ *mingw32*) ;;
+ *) SIM_DV_SOCKSER_O="dv-sockser.o"
+ AC_DEFINE_UNQUOTED(
+ [HAVE_DV_SOCKSER], 1, [Define if dv-sockser is usable.])
+ ;;
+ esac
+ AC_SUBST(SIM_DV_SOCKSER_O)
fi
if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
diff -uNr gdb-7.5.91-virgin/sim/m68hc11/configure.ac gdb-7.5.91/sim/m68hc11/configure.ac
--- gdb-7.5.91-virgin/sim/m68hc11/configure.ac 2011-10-17 19:30:58.000000000 -0500
+++ gdb-7.5.91/sim/m68hc11/configure.ac 2013-03-17 10:17:21.532456675 -0500
@@ -19,7 +19,7 @@
m68hc11-*-*|m6811-*-*)
hw_enabled=yes
hw_extra_devices="m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram"
- m68hc11_extra_objs="dv-sockser.o"
+ m68hc11_extra_objs="$SIM_SV_SOCKSER_O"
SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_M68HC11=1"
;;
*)
diff -uNr gdb-7.5.91-virgin/sim/mips/configure.ac gdb-7.5.91/sim/mips/configure.ac
--- gdb-7.5.91-virgin/sim/mips/configure.ac 2013-01-01 00:41:39.000000000 -0600
+++ gdb-7.5.91/sim/mips/configure.ac 2013-03-17 10:36:33.251716513 -0500
@@ -414,12 +414,12 @@
hw_enabled=yes
hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
+ mips_extra_objs="$SIM_DV_SOCKSER_O"
;;
*)
;;
esac
SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
-mips_extra_objs="dv-sockser.o"
AC_SUBST(mips_extra_objs)