source: rtems-tools/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch @ bfd2b7d

4.104.115
Last change on this file since bfd2b7d was bfd2b7d, checked in by Joel Sherrill <joel.sherrill@…>, on 03/26/15 at 18:20:45

Add Jiri Gaisler SIS patch set for gdb 7.9

This patch set adds a lot of new capability including support for
the leon2 and leon3. It also eliminates the difference between
the initial state of the simulated erc32 and the real hardware.

  • Property mode set to 100644
File size: 14.8 KB
  • sim/erc32/Makefile.in

    From fb01b2350dd60d0ec99e5f1a3b262add609507f7 Mon Sep 17 00:00:00 2001
    From: Jiri Gaisler <jiri@gaisler.se>
    Date: Wed, 18 Feb 2015 16:50:55 +0100
    Subject: [PATCH 11/23] sim/erc32: use SIM_AC_OPTION_HOSTENDIAN to probe for
     host endianess
    
    	* Makefile.in (end, end.h) Remove target rules.
    	* end.c Remove unnecessary local checks (end.c)
    	* configure, config.in : Regenerate.
    	* configure.ac : Use SIM_AC_OPTION_HOSTENDIAN
    	* erc32.c : Remove dependecy on end.h
    	* exec.c : Remove dependecy on end.h. Use HOST_LITTLE_ENDIAN.
    	* func.c : As above.
    	* sis.c : As above.
    ---
     sim/erc32/Makefile.in  |  18 +---
     sim/erc32/config.in    |  15 +++
     sim/erc32/configure    | 260 ++++++++++++++++++++++++++++++++++++++++++++++++-
     sim/erc32/configure.ac |   1 +
     sim/erc32/end.c        |  27 -----
     sim/erc32/erc32.c      |   1 -
     sim/erc32/exec.c       |   7 +-
     sim/erc32/func.c       |   3 +-
     sim/erc32/sis.h        |   9 +-
     9 files changed, 284 insertions(+), 57 deletions(-)
     delete mode 100644 sim/erc32/end.c
    
    diff --git a/sim/erc32/Makefile.in b/sim/erc32/Makefile.in
    index 418e7e4..e0860a0 100644
    a b sis: sis.o $(SIS_OFILES) $(COMMON_OBJS) $(LIBDEPS) 
    4141        $(CC) $(ALL_CFLAGS) -o sis \
    4242          sis.o $(SIS_OFILES) $(COMMON_OBJS) $(EXTRA_LIBS)
    4343
    44 # FIXME: This computes the build host's endianness, doesn't it?
    45 # There is AC_C_BIGENDIAN but it doesn't handle float endianness.
    46 # [Are int/float endians every different on a sparc?]
    47 end: $(srcdir)/end.c
    48         $(CC_FOR_BUILD) -I. $(srcdir)/end.c -o end
    49 end.h: end
    50         ./end > end.h
    51 
    5244# Copy the files into directories where they will be run.
    5345install-sis: installdirs
    5446        n=`echo sis | sed '$(program_transform_name)'`; \
    5547        $(INSTALL_PROGRAM) sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
    5648
    5749clean-sis:
    58         rm -f sis end end.h
     50        rm -f sis
    5951
    6052configure:
    6153        @echo "Rebuilding configure..."
    configure: 
    6456        else true ; fi ; \
    6557        (cd $${srcdir}; autoconf --localdir=../common)
    6658
    67 # Circumvent Sun Make bug with VPATH.
    68 erc32.o: erc32.c sis.h end.h
    69 exec.o: exec.c sis.h end.h
    70 float.o: float.c sis.h end.h
    71 func.o: func.c sis.h end.h
    72 help.o: help.c sis.h end.h
    73 interf.o: interf.c sis.h end.h
    74 sis.o: sis.c sis.h end.h
  • sim/erc32/config.in

    diff --git a/sim/erc32/config.in b/sim/erc32/config.in
    index 5fed8c1..b367e14 100644
    a b  
    11/* config.in.  Generated from configure.ac by autoheader.  */
    22
     3/* Define if building universal (internal helper macro) */
     4#undef AC_APPLE_UNIVERSAL_BUILD
     5
    36/* Define to 1 if translation of program messages to the user's native
    47   language is requested. */
    58#undef ENABLE_NLS
     
    135138#endif
    136139
    137140
     141/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
     142   significant byte first (like Motorola and SPARC, unlike Intel). */
     143#if defined AC_APPLE_UNIVERSAL_BUILD
     144# if defined __BIG_ENDIAN__
     145#  define WORDS_BIGENDIAN 1
     146# endif
     147#else
     148# ifndef WORDS_BIGENDIAN
     149#  undef WORDS_BIGENDIAN
     150# endif
     151#endif
     152
    138153/* Define to 1 if on MINIX. */
    139154#undef _MINIX
    140155
  • sim/erc32/configure

    diff --git a/sim/erc32/configure b/sim/erc32/configure
    index ba43717..cbdcea5 100755
    a b enable_sim_trace 
    761761enable_sim_profile
    762762with_pkgversion
    763763with_bugurl
     764enable_sim_hostendian
    764765'
    765766      ac_precious_vars='build_alias
    766767host_alias
    Optional Features: 
    14031404  --enable-sim-stdio                    Specify whether to use stdio for console input/output.
    14041405  --enable-sim-trace=opts               Enable tracing flags
    14051406  --enable-sim-profile=opts             Enable profiling flags
     1407  --enable-sim-hostendian=end           Specify host byte endian orientation.
    14061408
    14071409Optional Packages:
    14081410  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    $as_echo "$lt_cv_ld_force_load" >&6; } 
    81218123      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
    81228124        10.0,*86*-darwin8*|10.0,*-darwin[91]*)
    81238125          _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
    8124         10.[012]*)
     8126        10.[012][,.]*)
    81258127          _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
    81268128        10.*)
    81278129          _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
    _LT_EOF 
    1014410146      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
    1014510147         && test "$tmp_diet" = no
    1014610148      then
    10147         tmp_addflag=
     10149        tmp_addflag=' $pic_flag'
    1014810150        tmp_sharedflag='-shared'
    1014910151        case $cc_basename,$host_cpu in
    1015010152        pgcc*)                          # Portland Group C compiler
    else 
    1235412356  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    1235512357  lt_status=$lt_dlunknown
    1235612358  cat > conftest.$ac_ext <<_LT_EOF
    12357 #line 12357 "configure"
     12359#line 12359 "configure"
    1235812360#include "confdefs.h"
    1235912361
    1236012362#if HAVE_DLFCN_H
    else 
    1246012462  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    1246112463  lt_status=$lt_dlunknown
    1246212464  cat > conftest.$ac_ext <<_LT_EOF
    12463 #line 12463 "configure"
     12465#line 12465 "configure"
    1246412466#include "confdefs.h"
    1246512467
    1246612468#if HAVE_DLFCN_H
    fi 
    1311113113fi
    1311213114
    1311313115
     13116# Check whether --enable-sim-hostendian was given.
     13117if test "${enable_sim_hostendian+set}" = set; then :
     13118  enableval=$enable_sim_hostendian; case "${enableval}" in
     13119  no)    sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
     13120  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
     13121  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
     13122  *)     as_fn_error "\"Unknown value $enableval for --enable-sim-hostendian\"" "$LINENO" 5; sim_hostendian="";;
     13123esac
     13124if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
     13125  echo "Setting hostendian flags = $sim_hostendian" 6>&1
     13126fi
     13127else
     13128
     13129if test "x$cross_compiling" = "xno"; then
     13130   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
     13131$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
     13132if test "${ac_cv_c_bigendian+set}" = set; then :
     13133  $as_echo_n "(cached) " >&6
     13134else
     13135  ac_cv_c_bigendian=unknown
     13136    # See if we're dealing with a universal compiler.
     13137    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13138/* end confdefs.h.  */
     13139#ifndef __APPLE_CC__
     13140               not a universal capable compiler
     13141             #endif
     13142             typedef int dummy;
     13143
     13144_ACEOF
     13145if ac_fn_c_try_compile "$LINENO"; then :
     13146
     13147        # Check for potential -arch flags.  It is not universal unless
     13148        # there are at least two -arch flags with different values.
     13149        ac_arch=
     13150        ac_prev=
     13151        for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
     13152         if test -n "$ac_prev"; then
     13153           case $ac_word in
     13154             i?86 | x86_64 | ppc | ppc64)
     13155               if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
     13156                 ac_arch=$ac_word
     13157               else
     13158                 ac_cv_c_bigendian=universal
     13159                 break
     13160               fi
     13161               ;;
     13162           esac
     13163           ac_prev=
     13164         elif test "x$ac_word" = "x-arch"; then
     13165           ac_prev=arch
     13166         fi
     13167       done
     13168fi
     13169rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13170    if test $ac_cv_c_bigendian = unknown; then
     13171      # See if sys/param.h defines the BYTE_ORDER macro.
     13172      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13173/* end confdefs.h.  */
     13174#include <sys/types.h>
     13175             #include <sys/param.h>
     13176
     13177int
     13178main ()
     13179{
     13180#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
     13181                     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
     13182                     && LITTLE_ENDIAN)
     13183              bogus endian macros
     13184             #endif
     13185
     13186  ;
     13187  return 0;
     13188}
     13189_ACEOF
     13190if ac_fn_c_try_compile "$LINENO"; then :
     13191  # It does; now see whether it defined to BIG_ENDIAN or not.
     13192         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13193/* end confdefs.h.  */
     13194#include <sys/types.h>
     13195                #include <sys/param.h>
     13196
     13197int
     13198main ()
     13199{
     13200#if BYTE_ORDER != BIG_ENDIAN
     13201                 not big endian
     13202                #endif
     13203
     13204  ;
     13205  return 0;
     13206}
     13207_ACEOF
     13208if ac_fn_c_try_compile "$LINENO"; then :
     13209  ac_cv_c_bigendian=yes
     13210else
     13211  ac_cv_c_bigendian=no
     13212fi
     13213rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13214fi
     13215rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13216    fi
     13217    if test $ac_cv_c_bigendian = unknown; then
     13218      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
     13219      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13220/* end confdefs.h.  */
     13221#include <limits.h>
     13222
     13223int
     13224main ()
     13225{
     13226#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
     13227              bogus endian macros
     13228             #endif
     13229
     13230  ;
     13231  return 0;
     13232}
     13233_ACEOF
     13234if ac_fn_c_try_compile "$LINENO"; then :
     13235  # It does; now see whether it defined to _BIG_ENDIAN or not.
     13236         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13237/* end confdefs.h.  */
     13238#include <limits.h>
     13239
     13240int
     13241main ()
     13242{
     13243#ifndef _BIG_ENDIAN
     13244                 not big endian
     13245                #endif
     13246
     13247  ;
     13248  return 0;
     13249}
     13250_ACEOF
     13251if ac_fn_c_try_compile "$LINENO"; then :
     13252  ac_cv_c_bigendian=yes
     13253else
     13254  ac_cv_c_bigendian=no
     13255fi
     13256rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13257fi
     13258rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13259    fi
     13260    if test $ac_cv_c_bigendian = unknown; then
     13261      # Compile a test program.
     13262      if test "$cross_compiling" = yes; then :
     13263  # Try to guess by grepping values from an object file.
     13264         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13265/* end confdefs.h.  */
     13266short int ascii_mm[] =
     13267                  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
     13268                short int ascii_ii[] =
     13269                  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
     13270                int use_ascii (int i) {
     13271                  return ascii_mm[i] + ascii_ii[i];
     13272                }
     13273                short int ebcdic_ii[] =
     13274                  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
     13275                short int ebcdic_mm[] =
     13276                  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
     13277                int use_ebcdic (int i) {
     13278                  return ebcdic_mm[i] + ebcdic_ii[i];
     13279                }
     13280                extern int foo;
     13281
     13282int
     13283main ()
     13284{
     13285return use_ascii (foo) == use_ebcdic (foo);
     13286  ;
     13287  return 0;
     13288}
     13289_ACEOF
     13290if ac_fn_c_try_compile "$LINENO"; then :
     13291  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
     13292              ac_cv_c_bigendian=yes
     13293            fi
     13294            if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
     13295              if test "$ac_cv_c_bigendian" = unknown; then
     13296                ac_cv_c_bigendian=no
     13297              else
     13298                # finding both strings is unlikely to happen, but who knows?
     13299                ac_cv_c_bigendian=unknown
     13300              fi
     13301            fi
     13302fi
     13303rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     13304else
     13305  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     13306/* end confdefs.h.  */
     13307$ac_includes_default
     13308int
     13309main ()
     13310{
     13311
     13312             /* Are we little or big endian?  From Harbison&Steele.  */
     13313             union
     13314             {
     13315               long int l;
     13316               char c[sizeof (long int)];
     13317             } u;
     13318             u.l = 1;
     13319             return u.c[sizeof (long int) - 1] == 1;
     13320
     13321  ;
     13322  return 0;
     13323}
     13324_ACEOF
     13325if ac_fn_c_try_run "$LINENO"; then :
     13326  ac_cv_c_bigendian=no
     13327else
     13328  ac_cv_c_bigendian=yes
     13329fi
     13330rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
     13331  conftest.$ac_objext conftest.beam conftest.$ac_ext
     13332fi
     13333
     13334    fi
     13335fi
     13336{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
     13337$as_echo "$ac_cv_c_bigendian" >&6; }
     13338 case $ac_cv_c_bigendian in #(
     13339   yes)
     13340     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
     13341;; #(
     13342   no)
     13343      ;; #(
     13344   universal)
     13345
     13346$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
     13347
     13348     ;; #(
     13349   *)
     13350     as_fn_error "unknown endianness
     13351 presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
     13352 esac
     13353
     13354  if test $ac_cv_c_bigendian = yes; then
     13355    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
     13356  else
     13357    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
     13358  fi
     13359else
     13360  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
     13361fi
     13362fi
     13363
     13364
    1311413365ac_sources="$sim_link_files"
    1311513366ac_dests="$sim_link_links"
    1311613367while test -n "$ac_sources"; do
    if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then 
    1324513496Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1324613497fi
    1324713498
     13499
    1324813500: ${CONFIG_STATUS=./config.status}
    1324913501ac_write_fail=0
    1325013502ac_clean_files_save=$ac_clean_files
  • sim/erc32/configure.ac

    diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
    index bc46091..854845c 100644
    a b else 
    3232               AC_ERROR([the required "readline" library is missing]), $TERMCAP)
    3333fi
    3434AC_SUBST(READLINE)
     35SIM_AC_OPTION_HOSTENDIAN
    3536SIM_AC_OUTPUT
  • deleted file sim/erc32/end.c

    diff --git a/sim/erc32/end.c b/sim/erc32/end.c
    deleted file mode 100644
    index 9337198..0000000
    + -  
    1 #include "config.h"
    2 #include <stdio.h>
    3 
    4 int
    5 main()
    6 {
    7 
    8     unsigned int    u1;
    9     char           *c;
    10     double          d1;
    11     float          *f1;
    12 
    13     c = (char *) &u1;
    14     u1 = 0x0F;
    15     if (c[0] == 0x0F)
    16         puts("#define HOST_LITTLE_ENDIAN\n");
    17     else
    18         puts("#define HOST_BIG_ENDIAN\n");
    19 
    20     d1 = 1.0;
    21     f1 = (float *) &d1;
    22     if (*((int *) f1) != 0x3ff00000)
    23         puts("#define HOST_LITTLE_ENDIAN_FLOAT\n");
    24     else
    25         puts("#define HOST_BIG_ENDIAN_FLOAT\n");
    26     return 0;
    27 }
  • sim/erc32/erc32.c

    diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
    index 7c80e13..eac49f7 100644
    a b  
    3030#include <sys/file.h>
    3131#include <unistd.h>
    3232#include "sis.h"
    33 #include "end.h"
    3433#include "sim-config.h"
    3534
    3635extern int      ctrl_c;
  • sim/erc32/exec.c

    diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c
    index e80e02a..237bb53 100644
    a b  
    2121
    2222#include "config.h"
    2323#include "sis.h"
    24 #include "end.h"
    2524#include <math.h>
    2625#include <stdio.h>
    2726
    fpexec(op3, rd, rs1, rs2, sregs) 
    17361735       but what about machines where float values are different endianness
    17371736       from integer values? */
    17381737
    1739 #ifdef HOST_LITTLE_ENDIAN_FLOAT
     1738#ifdef HOST_LITTLE_ENDIAN
    17401739    rs1 &= 0x1f;
    17411740    switch (opf) {
    17421741        case FADDd:
    fpexec(op3, rd, rs1, rs2, sregs) 
    19141913
    19151914    accex = get_accex();
    19161915
    1917 #ifdef HOST_LITTLE_ENDIAN_FLOAT
     1916#ifdef HOST_LITTLE_ENDIAN
    19181917    switch (opf) {
    19191918    case FADDd:
    19201919    case FDIVd:
    init_regs(sregs) 
    20612060    sregs->err_mode = 0;
    20622061    ext_irl = 0;
    20632062    sregs->g[0] = 0;
    2064 #ifdef HOST_LITTLE_ENDIAN_FLOAT
     2063#ifdef HOST_LITTLE_ENDIAN
    20652064    sregs->fdp = (float32 *) sregs->fd;
    20662065    sregs->fsi = (int32 *) sregs->fs;
    20672066#else
  • sim/erc32/func.c

    diff --git a/sim/erc32/func.c b/sim/erc32/func.c
    index bcccf6d..ab21e3c 100644
    a b  
    2626#include <stdlib.h>
    2727#include <ctype.h>
    2828#include "sis.h"
    29 #include "end.h"
    3029#include <dis-asm.h>
    3130#include "sim-config.h"
    3231#include <inttypes.h>
    disp_fpu(sregs) 
    734733
    735734    printf("\n fsr: %08X\n\n", sregs->fsr);
    736735
    737 #ifdef HOST_LITTLE_ENDIAN_FLOAT
     736#ifdef HOST_LITTLE_ENDIAN
    738737    for (i = 0; i < 32; i++)
    739738      sregs->fdp[i ^ 1] = sregs->fs[i];
    740739#endif
  • sim/erc32/sis.h

    diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
    index 1ff6ced..ef5b149 100644
    a b  
    2323#include "ansidecl.h"
    2424#include "gdb/callback.h"
    2525#include "gdb/remote-sim.h"
     26#include <sim-config.h>
    2627
    27 #include "end.h"
     28#if WITH_HOST_BYTE_ORDER==BIG_ENDIAN
     29#define HOST_BIG_ENDIAN
     30#else
     31#define HOST_LITTLE_ENDIAN
     32#endif
    2833
    2934#define I_ACC_EXC 1
    3035
    typedef long long int64; /* 64-bit signed int */ 
    6570struct pstate {
    6671
    6772    float64         fd[16];     /* FPU registers */
    68 #ifdef HOST_LITTLE_ENDIAN_FLOAT
     73#ifdef HOST_LITTLE_ENDIAN
    6974    float32         fs[32];
    7075    float32        *fdp;
    7176#else
Note: See TracBrowser for help on using the repository browser.