sim: ppc: drop host endian configure option

The --enable-sim-hostendian flag was purely so people had an escape route
for when cross-compiling.  This is because historically, AC_C_BIGENDIAN
did not work in those cases.  That was fixed a while ago though, so we can
require that macro everywhere now and simplify a good bit of code.

This was done for all the other ports years ago, so catch ppc up.
This commit is contained in:
Mike Frysinger 2021-06-15 20:20:11 -04:00
parent dae666c968
commit 430456e347
12 changed files with 474 additions and 928 deletions

View File

@ -1,3 +1,23 @@
2021-06-16 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (HOSTENDIAN_CFLAGS): Delete.
* configure.ac: Delete sim-hostendian logic.
* altivec_registers.h (WITH_HOST_BYTE_ORDER): Rename to ...
(HOST_BYTE_ORDER): ... this.
* options.c: Likewise.
* sim-endian.c: Likewise.
* psim.c (current_host_byte_order): Delete.
(CURRENT_HOST_BYTE_ORDER): Rename to ...
(HOST_BYTE_ORDER): ... this.
* sim-endian-n.h: Likewise.
* sim-endian.h: Delete all custom endian include & define logic.
* std-config.h (WITH_HOST_BYTE_ORDER): Delete.
(LITTLE_ENDIAN): Define fallback.
(BIG_ENDIAN): Likewise.
(HOST_BYTE_ORDER): Define based on WORDS_BIGENDIAN.
(current_host_byte_order, CURRENT_HOST_BYTE_ORDER): Delete.
* config.in, configure: Regenerate.
2021-06-13 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (COMMON_OBJS_NAMES, +COMMON_OBJS): New variables.

View File

@ -73,7 +73,6 @@ RANLIB = @RANLIB@
INLINE_CFLAGS = @sim_inline@
ENDIAN_CFLAGS = @sim_endian@
HOSTENDIAN_CFLAGS = @sim_hostendian@
SMP_CFLAGS = @sim_smp@
XOR_ENDIAN_CFLAGS = @sim_xor_endian@
BITSIZE_CFLAGS = @sim_bitsize@
@ -88,7 +87,6 @@ WARNING_CFLAGS = @sim_warnings@
DEVZERO_CFLAGS = @sim_devzero@
CONFIG_CFLAGS = \
$(ENDIAN_CFLAGS) \
$(HOSTENDIAN_CFLAGS) \
$(SMP_CFLAGS) \
$(XOR_ENDIAN_CFLAGS) \
$(BITSIZE_CFLAGS) \

View File

@ -49,7 +49,7 @@ struct altivec_regs {
work on N independant bits of data. This is only for the
instructions that actually move data around. */
#if (WITH_HOST_BYTE_ORDER == BIG_ENDIAN)
#if (HOST_BYTE_ORDER == BIG_ENDIAN)
#define AV_BINDEX(x) ((x) & 15)
#define AV_HINDEX(x) ((x) & 7)
#else

View File

@ -1,8 +1,5 @@
/* 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
@ -77,15 +74,3 @@
/* Sim assert settings */
#undef WITH_ASSERT
/* 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

1116
sim/ppc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -287,29 +287,6 @@ if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
fi],[sim_hostbitsize=""])dnl
AC_ARG_ENABLE(sim-hostendian,
[ --enable-sim-hostendian=end Specify host byte endian orientation.],
[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";;
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
esac
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
echo "Setting hostendian flags = $sim_hostendian" 6>&1
fi],[
if test "x$cross_compiling" = "xno"; then
AC_C_BIGENDIAN
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])dnl
AC_ARG_ENABLE(sim-icache,
[ --enable-sim-icache=size Specify instruction-decode cache size and type.],
[icache="-R"
@ -799,7 +776,6 @@ AC_SUBST(sim_pk_obj)
AC_SUBST(sim_inline)
AC_SUBST(sim_endian)
AC_SUBST(sim_xor_endian)
AC_SUBST(sim_hostendian)
AC_SUBST(sim_smp)
AC_SUBST(sim_igen_smp)
AC_SUBST(sim_bitsize)

View File

@ -117,7 +117,7 @@ print_options (void)
printf_filtered ("Compiled on %s %s\n", __DATE__, __TIME__);
#endif
printf_filtered ("WITH_HOST_BYTE_ORDER = %s\n", options_byte_order (WITH_HOST_BYTE_ORDER));
printf_filtered ("HOST_BYTE_ORDER = %s\n", options_byte_order (HOST_BYTE_ORDER));
printf_filtered ("WITH_TARGET_BYTE_ORDER = %s\n", options_byte_order (WITH_TARGET_BYTE_ORDER));
printf_filtered ("WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
printf_filtered ("WITH_SMP = %d\n", WITH_SMP);

View File

@ -64,7 +64,6 @@ struct _psim {
int current_target_byte_order;
int current_host_byte_order;
int current_environment;
int current_alignment;
int current_floating_point;
@ -456,14 +455,6 @@ psim_create(const char *file_name,
if (CURRENT_TARGET_BYTE_ORDER != current_target_byte_order)
error("target and configured byte order conflict\n");
/* fill in the missing HOST BYTE ORDER information */
current_host_byte_order = (current_host_byte_order = 1,
(*(char*)(&current_host_byte_order)
? LITTLE_ENDIAN
: BIG_ENDIAN));
if (CURRENT_HOST_BYTE_ORDER != current_host_byte_order)
error("host and configured byte order conflict\n");
/* fill in the missing OEA/VEA information */
env = tree_find_string_property(root, "/openprom/options/env");
current_environment = ((strcmp(env, "user") == 0
@ -917,7 +908,7 @@ psim_read_register(psim *system,
break;
#ifdef WITH_ALTIVEC
case 16:
if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
{
union { vreg v; unsigned_8 d[2]; } h, t;
memcpy(&h.v/*dest*/, cooked_buf/*src*/, description.size);
@ -996,7 +987,7 @@ psim_write_register(psim *system,
break;
#ifdef WITH_ALTIVEC
case 16:
if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
{
union { vreg v; unsigned_8 d[2]; } h, t;
memcpy(&t.v/*dest*/, buf/*src*/, description.size);

View File

@ -38,7 +38,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_t2h_N(unsigned_N raw_in)
{
if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) {
return raw_in;
}
else {
@ -51,7 +51,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2t_N(unsigned_N raw_in)
{
if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) {
return raw_in;
}
else {
@ -73,7 +73,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2be_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
if (HOST_BYTE_ORDER == BIG_ENDIAN) {
return raw_in;
}
else {
@ -86,7 +86,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_be2h_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
if (HOST_BYTE_ORDER == BIG_ENDIAN) {
return raw_in;
}
else {
@ -99,7 +99,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2le_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
if (HOST_BYTE_ORDER == LITTLE_ENDIAN) {
return raw_in;
}
else {
@ -112,7 +112,7 @@ INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_le2h_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
if (HOST_BYTE_ORDER == LITTLE_ENDIAN) {
return raw_in;
}
else {

View File

@ -31,7 +31,7 @@
#define _SWAP_1(SET,RAW) SET (RAW)
#endif
#if !defined(_SWAP_2) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htons)
#if !defined(_SWAP_2) && (HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htons)
#define _SWAP_2(SET,RAW) SET htons (RAW)
#endif
@ -39,7 +39,7 @@
#define _SWAP_2(SET,RAW) SET (((RAW) >> 8) | ((RAW) << 8))
#endif
#if !defined(_SWAP_4) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htonl)
#if !defined(_SWAP_4) && (HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htonl)
#define _SWAP_4(SET,RAW) SET htonl (RAW)
#endif

View File

@ -60,181 +60,6 @@ INLINE_PSIM_ENDIAN(unsigned_4) endian_le2h_4(unsigned_4 x);
INLINE_PSIM_ENDIAN(unsigned_8) endian_le2h_8(unsigned_8 x);
/* Host dependant:
The CPP below defines information about the compilation host. In
particular it defines the macro's:
WITH_HOST_BYTE_ORDER The byte order of the host. Could
be any of LITTLE_ENDIAN, BIG_ENDIAN
or 0 (unknown). Those macro's also
need to be defined.
*/
/* NetBSD:
NetBSD is easy, everything you could ever want is in a header file
(well almost :-) */
#if defined(__NetBSD__)
# include <machine/endian.h>
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BYTE_ORDER
# endif
# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER)
# error "host endian incorrectly configured, check config.h"
# endif
#endif
/* Linux is similarly easy. */
#if defined(__linux__)
# include <endian.h>
# if defined(__LITTLE_ENDIAN) && !defined(LITTLE_ENDIAN)
# define LITTLE_ENDIAN __LITTLE_ENDIAN
# endif
# if defined(__BIG_ENDIAN) && !defined(BIG_ENDIAN)
# define BIG_ENDIAN __BIG_ENDIAN
# endif
# if defined(__BYTE_ORDER) && !defined(BYTE_ORDER)
# define BYTE_ORDER __BYTE_ORDER
# endif
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BYTE_ORDER
# endif
# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER)
# error "host endian incorrectly configured, check config.h"
# endif
#endif
/* INSERT HERE - hosts that have available LITTLE_ENDIAN and
BIG_ENDIAN macro's */
/* Some hosts don't define LITTLE_ENDIAN or BIG_ENDIAN, help them out */
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
/* SunOS on SPARC:
Big endian last time I looked */
#if defined(sparc) || defined(__sparc__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BIG_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
# error "sun was big endian last time I looked ..."
# endif
#endif
/* Random x86
Little endian last time I looked */
#if defined(i386) || defined(i486) || defined(i586) || defined (i686) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined (__i686__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
# error "x86 was little endian last time I looked ..."
# endif
#endif
/* Power or PowerPC running AIX */
#if defined(_POWER) && defined(_AIX)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BIG_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
# error "Power/PowerPC AIX was big endian last time I looked ..."
# endif
#endif
/* Solaris running PowerPC */
#if defined(__PPC) && defined(__sun__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
# error "Solaris on PowerPCs was little endian last time I looked ..."
# endif
#endif
/* HP/PA */
#if defined(__hppa__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BIG_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
# error "HP/PA was big endian last time I looked ..."
# endif
#endif
/* Big endian MIPS */
#if defined(__MIPSEB__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER BIG_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
# error "MIPSEB was big endian last time I looked ..."
# endif
#endif
/* Little endian MIPS */
#if defined(__MIPSEL__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
# error "MIPSEL was little endian last time I looked ..."
# endif
#endif
/* Windows NT */
#if defined(__WIN32__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
# error "Windows NT was little endian last time I looked ..."
# endif
#endif
/* Alpha running DEC unix */
#if defined(__osf__) && defined(__alpha__)
# if (WITH_HOST_BYTE_ORDER == 0)
# undef WITH_HOST_BYTE_ORDER
# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
# endif
# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
# error "AXP running DEC unix was little endian last time I looked ..."
# endif
#endif
/* INSERT HERE - additional hosts that do not have LITTLE_ENDIAN and
BIG_ENDIAN definitions available. */
/* SWAP */
#define SWAP_1 swap_1

View File

@ -30,18 +30,23 @@
Possible values are 0 (unknown), LITTLE_ENDIAN, BIG_ENDIAN */
#ifndef WITH_HOST_BYTE_ORDER
#define WITH_HOST_BYTE_ORDER 0 /*unknown*/
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifdef WORDS_BIGENDIAN
# define HOST_BYTE_ORDER BIG_ENDIAN
#else
# define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
#ifndef WITH_TARGET_BYTE_ORDER
#define WITH_TARGET_BYTE_ORDER 0 /*unknown*/
#endif
extern int current_host_byte_order;
#define CURRENT_HOST_BYTE_ORDER (WITH_HOST_BYTE_ORDER \
? WITH_HOST_BYTE_ORDER \
: current_host_byte_order)
extern int current_target_byte_order;
#define CURRENT_TARGET_BYTE_ORDER (WITH_TARGET_BYTE_ORDER \
? WITH_TARGET_BYTE_ORDER \