summaryrefslogtreecommitdiff
path: root/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch')
-rw-r--r--tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch564
1 files changed, 564 insertions, 0 deletions
diff --git a/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch b/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch
new file mode 100644
index 0000000..3632610
--- /dev/null
+++ b/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch
@@ -0,0 +1,564 @@
+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/sim/erc32/Makefile.in
++++ b/sim/erc32/Makefile.in
+@@ -41,21 +41,13 @@ sis: sis.o $(SIS_OFILES) $(COMMON_OBJS) $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) -o sis \
+ sis.o $(SIS_OFILES) $(COMMON_OBJS) $(EXTRA_LIBS)
+
+-# FIXME: This computes the build host's endianness, doesn't it?
+-# There is AC_C_BIGENDIAN but it doesn't handle float endianness.
+-# [Are int/float endians every different on a sparc?]
+-end: $(srcdir)/end.c
+- $(CC_FOR_BUILD) -I. $(srcdir)/end.c -o end
+-end.h: end
+- ./end > end.h
+-
+ # Copy the files into directories where they will be run.
+ install-sis: installdirs
+ n=`echo sis | sed '$(program_transform_name)'`; \
+ $(INSTALL_PROGRAM) sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
+
+ clean-sis:
+- rm -f sis end end.h
++ rm -f sis
+
+ configure:
+ @echo "Rebuilding configure..."
+@@ -64,11 +56,3 @@ configure:
+ else true ; fi ; \
+ (cd $${srcdir}; autoconf --localdir=../common)
+
+-# Circumvent Sun Make bug with VPATH.
+-erc32.o: erc32.c sis.h end.h
+-exec.o: exec.c sis.h end.h
+-float.o: float.c sis.h end.h
+-func.o: func.c sis.h end.h
+-help.o: help.c sis.h end.h
+-interf.o: interf.c sis.h end.h
+-sis.o: sis.c sis.h end.h
+diff --git a/sim/erc32/config.in b/sim/erc32/config.in
+index 5fed8c1..b367e14 100644
+--- a/sim/erc32/config.in
++++ b/sim/erc32/config.in
+@@ -1,5 +1,8 @@
+ /* config.in. Generated from configure.ac by autoheader. */
+
++/* Define if building universal (internal helper macro) */
++#undef AC_APPLE_UNIVERSAL_BUILD
++
+ /* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+ #undef ENABLE_NLS
+@@ -135,6 +138,18 @@
+ #endif
+
+
++/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
++ significant byte first (like Motorola and SPARC, unlike Intel). */
++#if defined AC_APPLE_UNIVERSAL_BUILD
++# if defined __BIG_ENDIAN__
++# define WORDS_BIGENDIAN 1
++# endif
++#else
++# ifndef WORDS_BIGENDIAN
++# undef WORDS_BIGENDIAN
++# endif
++#endif
++
+ /* Define to 1 if on MINIX. */
+ #undef _MINIX
+
+diff --git a/sim/erc32/configure b/sim/erc32/configure
+index ba43717..cbdcea5 100755
+--- a/sim/erc32/configure
++++ b/sim/erc32/configure
+@@ -761,6 +761,7 @@ enable_sim_trace
+ enable_sim_profile
+ with_pkgversion
+ with_bugurl
++enable_sim_hostendian
+ '
+ ac_precious_vars='build_alias
+ host_alias
+@@ -1403,6 +1404,7 @@ Optional Features:
+ --enable-sim-stdio Specify whether to use stdio for console input/output.
+ --enable-sim-trace=opts Enable tracing flags
+ --enable-sim-profile=opts Enable profiling flags
++ --enable-sim-hostendian=end Specify host byte endian orientation.
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -8121,7 +8123,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+- 10.[012]*)
++ 10.[012][,.]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+@@ -10144,7 +10146,7 @@ _LT_EOF
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+- tmp_addflag=
++ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+@@ -12354,7 +12356,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12357 "configure"
++#line 12359 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -12460,7 +12462,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12463 "configure"
++#line 12465 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -13111,6 +13113,255 @@ fi
+ fi
+
+
++# Check whether --enable-sim-hostendian was given.
++if test "${enable_sim_hostendian+set}" = set; then :
++ enableval=$enable_sim_hostendian; case "${enableval}" in
++ no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
++ b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
++ l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
++ *) as_fn_error "\"Unknown value $enableval for --enable-sim-hostendian\"" "$LINENO" 5; sim_hostendian="";;
++esac
++if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
++ echo "Setting hostendian flags = $sim_hostendian" 6>&1
++fi
++else
++
++if test "x$cross_compiling" = "xno"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
++$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
++if test "${ac_cv_c_bigendian+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_cv_c_bigendian=unknown
++ # See if we're dealing with a universal compiler.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#ifndef __APPLE_CC__
++ not a universal capable compiler
++ #endif
++ typedef int dummy;
++
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++ # Check for potential -arch flags. It is not universal unless
++ # there are at least two -arch flags with different values.
++ ac_arch=
++ ac_prev=
++ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
++ if test -n "$ac_prev"; then
++ case $ac_word in
++ i?86 | x86_64 | ppc | ppc64)
++ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
++ ac_arch=$ac_word
++ else
++ ac_cv_c_bigendian=universal
++ break
++ fi
++ ;;
++ esac
++ ac_prev=
++ elif test "x$ac_word" = "x-arch"; then
++ ac_prev=arch
++ fi
++ done
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ if test $ac_cv_c_bigendian = unknown; then
++ # See if sys/param.h defines the BYTE_ORDER macro.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <sys/types.h>
++ #include <sys/param.h>
++
++int
++main ()
++{
++#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
++ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
++ && LITTLE_ENDIAN)
++ bogus endian macros
++ #endif
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ # It does; now see whether it defined to BIG_ENDIAN or not.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <sys/types.h>
++ #include <sys/param.h>
++
++int
++main ()
++{
++#if BYTE_ORDER != BIG_ENDIAN
++ not big endian
++ #endif
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_cv_c_bigendian=yes
++else
++ ac_cv_c_bigendian=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ fi
++ if test $ac_cv_c_bigendian = unknown; then
++ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <limits.h>
++
++int
++main ()
++{
++#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
++ bogus endian macros
++ #endif
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ # It does; now see whether it defined to _BIG_ENDIAN or not.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <limits.h>
++
++int
++main ()
++{
++#ifndef _BIG_ENDIAN
++ not big endian
++ #endif
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_cv_c_bigendian=yes
++else
++ ac_cv_c_bigendian=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ fi
++ if test $ac_cv_c_bigendian = unknown; then
++ # Compile a test program.
++ if test "$cross_compiling" = yes; then :
++ # Try to guess by grepping values from an object file.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++short int ascii_mm[] =
++ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
++ short int ascii_ii[] =
++ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
++ int use_ascii (int i) {
++ return ascii_mm[i] + ascii_ii[i];
++ }
++ short int ebcdic_ii[] =
++ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
++ short int ebcdic_mm[] =
++ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
++ int use_ebcdic (int i) {
++ return ebcdic_mm[i] + ebcdic_ii[i];
++ }
++ extern int foo;
++
++int
++main ()
++{
++return use_ascii (foo) == use_ebcdic (foo);
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
++ ac_cv_c_bigendian=yes
++ fi
++ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
++ if test "$ac_cv_c_bigendian" = unknown; then
++ ac_cv_c_bigendian=no
++ else
++ # finding both strings is unlikely to happen, but who knows?
++ ac_cv_c_bigendian=unknown
++ fi
++ fi
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$ac_includes_default
++int
++main ()
++{
++
++ /* Are we little or big endian? From Harbison&Steele. */
++ union
++ {
++ long int l;
++ char c[sizeof (long int)];
++ } u;
++ u.l = 1;
++ return u.c[sizeof (long int) - 1] == 1;
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_run "$LINENO"; then :
++ ac_cv_c_bigendian=no
++else
++ ac_cv_c_bigendian=yes
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++ conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
++
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
++$as_echo "$ac_cv_c_bigendian" >&6; }
++ case $ac_cv_c_bigendian in #(
++ yes)
++ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
++;; #(
++ no)
++ ;; #(
++ universal)
++
++$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
++
++ ;; #(
++ *)
++ as_fn_error "unknown endianness
++ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
++ esac
++
++ if test $ac_cv_c_bigendian = yes; then
++ sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
++ else
++ sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
++ fi
++else
++ sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
++fi
++fi
++
++
+ ac_sources="$sim_link_files"
+ ac_dests="$sim_link_links"
+ while test -n "$ac_sources"; do
+@@ -13245,6 +13496,7 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+
++
+ : ${CONFIG_STATUS=./config.status}
+ ac_write_fail=0
+ ac_clean_files_save=$ac_clean_files
+diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
+index bc46091..854845c 100644
+--- a/sim/erc32/configure.ac
++++ b/sim/erc32/configure.ac
+@@ -32,4 +32,5 @@ else
+ AC_ERROR([the required "readline" library is missing]), $TERMCAP)
+ fi
+ AC_SUBST(READLINE)
++SIM_AC_OPTION_HOSTENDIAN
+ SIM_AC_OUTPUT
+diff --git a/sim/erc32/end.c b/sim/erc32/end.c
+deleted file mode 100644
+index 9337198..0000000
+--- a/sim/erc32/end.c
++++ /dev/null
+@@ -1,27 +0,0 @@
+-#include "config.h"
+-#include <stdio.h>
+-
+-int
+-main()
+-{
+-
+- unsigned int u1;
+- char *c;
+- double d1;
+- float *f1;
+-
+- c = (char *) &u1;
+- u1 = 0x0F;
+- if (c[0] == 0x0F)
+- puts("#define HOST_LITTLE_ENDIAN\n");
+- else
+- puts("#define HOST_BIG_ENDIAN\n");
+-
+- d1 = 1.0;
+- f1 = (float *) &d1;
+- if (*((int *) f1) != 0x3ff00000)
+- puts("#define HOST_LITTLE_ENDIAN_FLOAT\n");
+- else
+- puts("#define HOST_BIG_ENDIAN_FLOAT\n");
+- return 0;
+-}
+diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
+index 7c80e13..eac49f7 100644
+--- a/sim/erc32/erc32.c
++++ b/sim/erc32/erc32.c
+@@ -30,7 +30,6 @@
+ #include <sys/file.h>
+ #include <unistd.h>
+ #include "sis.h"
+-#include "end.h"
+ #include "sim-config.h"
+
+ extern int ctrl_c;
+diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c
+index e80e02a..237bb53 100644
+--- a/sim/erc32/exec.c
++++ b/sim/erc32/exec.c
+@@ -21,7 +21,6 @@
+
+ #include "config.h"
+ #include "sis.h"
+-#include "end.h"
+ #include <math.h>
+ #include <stdio.h>
+
+@@ -1736,7 +1735,7 @@ fpexec(op3, rd, rs1, rs2, sregs)
+ but what about machines where float values are different endianness
+ from integer values? */
+
+-#ifdef HOST_LITTLE_ENDIAN_FLOAT
++#ifdef HOST_LITTLE_ENDIAN
+ rs1 &= 0x1f;
+ switch (opf) {
+ case FADDd:
+@@ -1914,7 +1913,7 @@ fpexec(op3, rd, rs1, rs2, sregs)
+
+ accex = get_accex();
+
+-#ifdef HOST_LITTLE_ENDIAN_FLOAT
++#ifdef HOST_LITTLE_ENDIAN
+ switch (opf) {
+ case FADDd:
+ case FDIVd:
+@@ -2061,7 +2060,7 @@ init_regs(sregs)
+ sregs->err_mode = 0;
+ ext_irl = 0;
+ sregs->g[0] = 0;
+-#ifdef HOST_LITTLE_ENDIAN_FLOAT
++#ifdef HOST_LITTLE_ENDIAN
+ sregs->fdp = (float32 *) sregs->fd;
+ sregs->fsi = (int32 *) sregs->fs;
+ #else
+diff --git a/sim/erc32/func.c b/sim/erc32/func.c
+index bcccf6d..ab21e3c 100644
+--- a/sim/erc32/func.c
++++ b/sim/erc32/func.c
+@@ -26,7 +26,6 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ #include "sis.h"
+-#include "end.h"
+ #include <dis-asm.h>
+ #include "sim-config.h"
+ #include <inttypes.h>
+@@ -734,7 +733,7 @@ disp_fpu(sregs)
+
+ printf("\n fsr: %08X\n\n", sregs->fsr);
+
+-#ifdef HOST_LITTLE_ENDIAN_FLOAT
++#ifdef HOST_LITTLE_ENDIAN
+ for (i = 0; i < 32; i++)
+ sregs->fdp[i ^ 1] = sregs->fs[i];
+ #endif
+diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
+index 1ff6ced..ef5b149 100644
+--- a/sim/erc32/sis.h
++++ b/sim/erc32/sis.h
+@@ -23,8 +23,13 @@
+ #include "ansidecl.h"
+ #include "gdb/callback.h"
+ #include "gdb/remote-sim.h"
++#include <sim-config.h>
+
+-#include "end.h"
++#if WITH_HOST_BYTE_ORDER==BIG_ENDIAN
++#define HOST_BIG_ENDIAN
++#else
++#define HOST_LITTLE_ENDIAN
++#endif
+
+ #define I_ACC_EXC 1
+
+@@ -65,7 +70,7 @@ typedef long long int64; /* 64-bit signed int */
+ struct pstate {
+
+ float64 fd[16]; /* FPU registers */
+-#ifdef HOST_LITTLE_ENDIAN_FLOAT
++#ifdef HOST_LITTLE_ENDIAN
+ float32 fs[32];
+ float32 *fdp;
+ #else
+--
+1.9.1
+