source:
rtems-tools/tools/4.11/gdb/sparc/7.9/0011-sim-erc32-use-SIM_AC_OPTION_HOSTENDIAN-to-probe-for-.patch
@
bfd2b7d
Last change on this file since bfd2b7d was bfd2b7d, checked in by Joel Sherrill <joel.sherrill@…>, on 03/26/15 at 18:20:45 | |
---|---|
|
|
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) 41 41 $(CC) $(ALL_CFLAGS) -o sis \ 42 42 sis.o $(SIS_OFILES) $(COMMON_OBJS) $(EXTRA_LIBS) 43 43 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.c48 $(CC_FOR_BUILD) -I. $(srcdir)/end.c -o end49 end.h: end50 ./end > end.h51 52 44 # Copy the files into directories where they will be run. 53 45 install-sis: installdirs 54 46 n=`echo sis | sed '$(program_transform_name)'`; \ 55 47 $(INSTALL_PROGRAM) sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) 56 48 57 49 clean-sis: 58 rm -f sis end end.h50 rm -f sis 59 51 60 52 configure: 61 53 @echo "Rebuilding configure..." … … configure: 64 56 else true ; fi ; \ 65 57 (cd $${srcdir}; autoconf --localdir=../common) 66 58 67 # Circumvent Sun Make bug with VPATH.68 erc32.o: erc32.c sis.h end.h69 exec.o: exec.c sis.h end.h70 float.o: float.c sis.h end.h71 func.o: func.c sis.h end.h72 help.o: help.c sis.h end.h73 interf.o: interf.c sis.h end.h74 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 1 1 /* config.in. Generated from configure.ac by autoheader. */ 2 2 3 /* Define if building universal (internal helper macro) */ 4 #undef AC_APPLE_UNIVERSAL_BUILD 5 3 6 /* Define to 1 if translation of program messages to the user's native 4 7 language is requested. */ 5 8 #undef ENABLE_NLS … … 135 138 #endif 136 139 137 140 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 138 153 /* Define to 1 if on MINIX. */ 139 154 #undef _MINIX 140 155 -
sim/erc32/configure
diff --git a/sim/erc32/configure b/sim/erc32/configure index ba43717..cbdcea5 100755
a b enable_sim_trace 761 761 enable_sim_profile 762 762 with_pkgversion 763 763 with_bugurl 764 enable_sim_hostendian 764 765 ' 765 766 ac_precious_vars='build_alias 766 767 host_alias … … Optional Features: 1403 1404 --enable-sim-stdio Specify whether to use stdio for console input/output. 1404 1405 --enable-sim-trace=opts Enable tracing flags 1405 1406 --enable-sim-profile=opts Enable profiling flags 1407 --enable-sim-hostendian=end Specify host byte endian orientation. 1406 1408 1407 1409 Optional Packages: 1408 1410 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] … … $as_echo "$lt_cv_ld_force_load" >&6; } 8121 8123 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 8122 8124 10.0,*86*-darwin8*|10.0,*-darwin[91]*) 8123 8125 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 8124 10.[012] *)8126 10.[012][,.]*) 8125 8127 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 8126 8128 10.*) 8127 8129 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; … … _LT_EOF 10144 10146 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ 10145 10147 && test "$tmp_diet" = no 10146 10148 then 10147 tmp_addflag= 10149 tmp_addflag=' $pic_flag' 10148 10150 tmp_sharedflag='-shared' 10149 10151 case $cc_basename,$host_cpu in 10150 10152 pgcc*) # Portland Group C compiler … … else 12354 12356 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 12355 12357 lt_status=$lt_dlunknown 12356 12358 cat > conftest.$ac_ext <<_LT_EOF 12357 #line 1235 7"configure"12359 #line 12359 "configure" 12358 12360 #include "confdefs.h" 12359 12361 12360 12362 #if HAVE_DLFCN_H … … else 12460 12462 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 12461 12463 lt_status=$lt_dlunknown 12462 12464 cat > conftest.$ac_ext <<_LT_EOF 12463 #line 1246 3"configure"12465 #line 12465 "configure" 12464 12466 #include "confdefs.h" 12465 12467 12466 12468 #if HAVE_DLFCN_H … … fi 13111 13113 fi 13112 13114 13113 13115 13116 # Check whether --enable-sim-hostendian was given. 13117 if 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="";; 13123 esac 13124 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then 13125 echo "Setting hostendian flags = $sim_hostendian" 6>&1 13126 fi 13127 else 13128 13129 if 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; } 13132 if test "${ac_cv_c_bigendian+set}" = set; then : 13133 $as_echo_n "(cached) " >&6 13134 else 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 13145 if 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 13168 fi 13169 rm -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 13177 int 13178 main () 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 13190 if 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 13197 int 13198 main () 13199 { 13200 #if BYTE_ORDER != BIG_ENDIAN 13201 not big endian 13202 #endif 13203 13204 ; 13205 return 0; 13206 } 13207 _ACEOF 13208 if ac_fn_c_try_compile "$LINENO"; then : 13209 ac_cv_c_bigendian=yes 13210 else 13211 ac_cv_c_bigendian=no 13212 fi 13213 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 13214 fi 13215 rm -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 13223 int 13224 main () 13225 { 13226 #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) 13227 bogus endian macros 13228 #endif 13229 13230 ; 13231 return 0; 13232 } 13233 _ACEOF 13234 if 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 13240 int 13241 main () 13242 { 13243 #ifndef _BIG_ENDIAN 13244 not big endian 13245 #endif 13246 13247 ; 13248 return 0; 13249 } 13250 _ACEOF 13251 if ac_fn_c_try_compile "$LINENO"; then : 13252 ac_cv_c_bigendian=yes 13253 else 13254 ac_cv_c_bigendian=no 13255 fi 13256 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 13257 fi 13258 rm -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. */ 13266 short 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 13282 int 13283 main () 13284 { 13285 return use_ascii (foo) == use_ebcdic (foo); 13286 ; 13287 return 0; 13288 } 13289 _ACEOF 13290 if 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 13302 fi 13303 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 13304 else 13305 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13306 /* end confdefs.h. */ 13307 $ac_includes_default 13308 int 13309 main () 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 13325 if ac_fn_c_try_run "$LINENO"; then : 13326 ac_cv_c_bigendian=no 13327 else 13328 ac_cv_c_bigendian=yes 13329 fi 13330 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 13331 conftest.$ac_objext conftest.beam conftest.$ac_ext 13332 fi 13333 13334 fi 13335 fi 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 13359 else 13360 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" 13361 fi 13362 fi 13363 13364 13114 13365 ac_sources="$sim_link_files" 13115 13366 ac_dests="$sim_link_links" 13116 13367 while test -n "$ac_sources"; do … … if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then 13245 13496 Usually this means the macro was only invoked conditionally." "$LINENO" 5 13246 13497 fi 13247 13498 13499 13248 13500 : ${CONFIG_STATUS=./config.status} 13249 13501 ac_write_fail=0 13250 13502 ac_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 32 32 AC_ERROR([the required "readline" library is missing]), $TERMCAP) 33 33 fi 34 34 AC_SUBST(READLINE) 35 SIM_AC_OPTION_HOSTENDIAN 35 36 SIM_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 int5 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 else18 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 else25 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 30 30 #include <sys/file.h> 31 31 #include <unistd.h> 32 32 #include "sis.h" 33 #include "end.h"34 33 #include "sim-config.h" 35 34 36 35 extern 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 21 21 22 22 #include "config.h" 23 23 #include "sis.h" 24 #include "end.h"25 24 #include <math.h> 26 25 #include <stdio.h> 27 26 … … fpexec(op3, rd, rs1, rs2, sregs) 1736 1735 but what about machines where float values are different endianness 1737 1736 from integer values? */ 1738 1737 1739 #ifdef HOST_LITTLE_ENDIAN _FLOAT1738 #ifdef HOST_LITTLE_ENDIAN 1740 1739 rs1 &= 0x1f; 1741 1740 switch (opf) { 1742 1741 case FADDd: … … fpexec(op3, rd, rs1, rs2, sregs) 1914 1913 1915 1914 accex = get_accex(); 1916 1915 1917 #ifdef HOST_LITTLE_ENDIAN _FLOAT1916 #ifdef HOST_LITTLE_ENDIAN 1918 1917 switch (opf) { 1919 1918 case FADDd: 1920 1919 case FDIVd: … … init_regs(sregs) 2061 2060 sregs->err_mode = 0; 2062 2061 ext_irl = 0; 2063 2062 sregs->g[0] = 0; 2064 #ifdef HOST_LITTLE_ENDIAN _FLOAT2063 #ifdef HOST_LITTLE_ENDIAN 2065 2064 sregs->fdp = (float32 *) sregs->fd; 2066 2065 sregs->fsi = (int32 *) sregs->fs; 2067 2066 #else -
sim/erc32/func.c
diff --git a/sim/erc32/func.c b/sim/erc32/func.c index bcccf6d..ab21e3c 100644
a b 26 26 #include <stdlib.h> 27 27 #include <ctype.h> 28 28 #include "sis.h" 29 #include "end.h"30 29 #include <dis-asm.h> 31 30 #include "sim-config.h" 32 31 #include <inttypes.h> … … disp_fpu(sregs) 734 733 735 734 printf("\n fsr: %08X\n\n", sregs->fsr); 736 735 737 #ifdef HOST_LITTLE_ENDIAN _FLOAT736 #ifdef HOST_LITTLE_ENDIAN 738 737 for (i = 0; i < 32; i++) 739 738 sregs->fdp[i ^ 1] = sregs->fs[i]; 740 739 #endif -
sim/erc32/sis.h
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h index 1ff6ced..ef5b149 100644
a b 23 23 #include "ansidecl.h" 24 24 #include "gdb/callback.h" 25 25 #include "gdb/remote-sim.h" 26 #include <sim-config.h> 26 27 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 28 33 29 34 #define I_ACC_EXC 1 30 35 … … typedef long long int64; /* 64-bit signed int */ 65 70 struct pstate { 66 71 67 72 float64 fd[16]; /* FPU registers */ 68 #ifdef HOST_LITTLE_ENDIAN _FLOAT73 #ifdef HOST_LITTLE_ENDIAN 69 74 float32 fs[32]; 70 75 float32 *fdp; 71 76 #else
Note: See TracBrowser
for help on using the repository browser.