This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rs6000-tdep should probably not depend on the ppc-sim code


On Tuesday 13 March 2012 18:49:11 Hector Oron wrote:
>   Trying to compile gdb on mips(el) platform with
> --enable-targets=all, fails to build with following error:
> 
> mipsel-linux-gnu-gcc -g -O2      \
>                 -o gdb gdb.o libgdb.a \
>                   ../sim/mips/libsim.a -lreadline
> ../opcodes/libopcodes.a ../bfd/libbfd.a  ../libiberty/libiberty.a
> ../libdecnumber/libdecnumber.a    -lncurses -lz -lm
> -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7
> -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lexpat
> ../libiberty/libiberty.a  gnulib/libgnu.a -ldl -rdynamic
> libgdb.a(rs6000-tdep.o): In function `init_sim_regno_table':
> /home/zumbi/gdb-7.4really/gdb/rs6000-tdep.c:334: undefined reference
> to `sim_spr_register_name'
> collect2: ld returned 1 exit status
> 
> Looking into gdb/rs6000-tdep.c:334:
> 
> #ifdef WITH_SIM
>   /* Now handle all special-purpose registers.  Verify that they
>      haven't mistakenly been assigned numbers by any of the above
>      code.  */
>   for (i = 0; i < sim_ppc_num_sprs; i++)
>     {
>       const char *spr_name = sim_spr_register_name (i);
>       int gdb_regno = -1;
> 
>       if (spr_name != NULL)
>         gdb_regno = user_reg_map_name_to_regnum (arch, spr_name, -1);
> 
>       if (gdb_regno != -1)
>         set_sim_regno (sim_regno, gdb_regno, sim_ppc_spr0_regnum + i);
>     }
> #endif
> 
> And sim_spr_register_name is defined under ./include/gdb/sim-ppc.h
> which expects to build ./sim/ppc/gdb-sim.c
> 
> I was hoping to provide a patch to fix the issue, but I do not really
> know whats the fix? Should sim_spr_register_name be defined somewhere
> else? Should we enable the build ppc simulator?

the sim is a looooooooong way off from supporting --enable-targets=all.  only 
sane thing to do is to have the ppc gdb code not enable the sim logic if the 
default target is non-powerpc.  but i'm not sure if the current gdb framework 
provides any information for that.

#if WITH_SIM && (DEFAULT_BFD_ARCH == bfd_rs6000_arch)
	...
#endif

obviously this won't work in actual CPP code.  not sure sure if the gdb peeps 
have workable suggestions short of opencoding some logic in configure.tgt to 
append a unique -D to CPPFLAGS to tell the code to not enable things.

relying on the compiler's DCE and doing:
	if (WITH_SIM && DEFAULT_BFD_ARCH == bfd_rs6000_arch)
wouldn't work with lower optimization levels :(
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]