bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/29961] /include/plugin-api.h:162:2: error: #error "Could n


From: dclarke at blastwave dot org
Subject: [Bug binutils/29961] /include/plugin-api.h:162:2: error: #error "Could not detect architecture endianess"
Date: Wed, 04 Jan 2023 15:53:14 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29961

--- Comment #10 from Dennis Clarke <dclarke at blastwave dot org> ---


For the sake of reference this is a very old machine and the OS is also
very very old. Runs fine.

Firstly the sys/byteorder.h merely asks if _BIG_ENDIAN is defined :

n$ /usr/xpg4/bin/nl -b a -n rz /usr/include/sys/byteorder.h
000001  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
000002  /*        All Rights Reserved   */
000003  
000004  /*      THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
000005  /*      The copyright notice above does not evidence any        */
000006  /*      actual or intended publication of such source code.     */
000007  
000008  #ifndef _SYS_BYTEORDER_H
000009  #define _SYS_BYTEORDER_H
000010  
000011  #pragma ident   "@(#)byteorder.h        1.14    98/04/19 SMI"   /*
SVr4.0 1.2 */
000012  
000013  #include <sys/isa_defs.h>
000014  
000015  #ifdef  __cplusplus
000016  extern "C" {
000017  #endif
000018  
000019  /*
000020   *              PROPRIETARY NOTICE (Combined)
000021   *
000022   *  This source code is unpublished proprietary information
000023   *  constituting, or derived under license from AT&T's Unix(r) System
V.
000024   *  In addition, portions of such source code were derived from
Berkeley
000025   *  4.3 BSD under license from the Regents of the University of
000026   *  California.
000027   *
000028   *
000029   *
000030   *              Copyright Notice
000031   *
000032   *  Notice of copyright on this source code product does not indicate
000033   *  publication.
000034   *
000035   *      (c) 1986,1987,1988,1989  Sun Microsystems, Inc.
000036   *      (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
000037   *              All rights reserved.
000038   */
000039  
000040  /*
000041   * macros for conversion between host and (internet) network byte order
000042   */
000043  
000044  #if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(lint)
000045  /* big-endian */
000046  #define ntohl(x)        (x)
000047  #define ntohs(x)        (x)
000048  #define htonl(x)        (x)
000049  #define htons(x)        (x)
000050  
000051  #elif !defined(ntohl) /* little-endian */
000052  
000053  #ifndef _IN_PORT_T
000054  #define _IN_PORT_T
000055  typedef uint16_t in_port_t;
000056  #endif
000057  
000058  #ifndef _IN_ADDR_T
000059  #define _IN_ADDR_T
000060  typedef uint32_t in_addr_t;
000061  #endif
000062  
000063  #if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
000064  extern  uint32_t htonl(uint32_t);
000065  extern  uint16_t htons(uint16_t);
000066  extern  uint32_t ntohl(uint32_t);
000067  extern  uint16_t ntohs(uint16_t);
000068  #else
000069  extern  in_addr_t htonl(in_addr_t);
000070  extern  in_port_t htons(in_port_t);
000071  extern  in_addr_t ntohl(in_addr_t);
000072  extern  in_port_t ntohs(in_port_t);
000073  #endif  /* !defined(_XPG4_2) || defined(__EXTENSIONS__) ||
defined(_XPG5) */
000074  #endif
000075  
000076  #ifdef  __cplusplus
000077  }
000078  #endif
000079  
000080  #endif /* _SYS_BYTEORDER_H */
n$ 

The real meat and potatoes we are looking for is in sys/isa_defs.h which
seems to focus on the question : is this SPARC or Intel ia64 or some 
variation on x86? I don't see anything about PowerPC so lets forget that
for now. Ultimately we could check for __i386 or __sparc and that sorts
out the _BIG_ENDIAN or _LITTLE_ENDIAN : 

n$ /usr/xpg4/bin/nl -b a -n rz /usr/include/sys/isa_defs.h
000001  /*
000002   * Copyright (c) 1993-1999 by Sun Microsystems, Inc.
000003   * All rights reserved.
000004   */
000005  
000006  #ifndef _SYS_ISA_DEFS_H
000007  #define _SYS_ISA_DEFS_H
000008  
000009  #pragma ident   "@(#)isa_defs.h 1.20    99/05/04 SMI"
000010  
000011  /*
000012   * This header file serves to group a set of well known defines and to
000013   * set these for each instruction set architecture.  These defines may
000014   * be divided into two groups;  characteristics of the processor and
000015   * implementation choices for Solaris on a processor.
000016   *
000017   * Processor Characteristics:
000018   *
000019   * _LITTLE_ENDIAN / _BIG_ENDIAN:
000020   *      The natural byte order of the processor.  A pointer to an int
points
000021   *      to the least/most significant byte of that int.
000022   *
000023   * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
000024   *      The processor specific direction of stack growth.  A push onto
the
000025   *      stack increases/decreases the stack pointer, so it stores data
at
000026   *      successively higher/lower addresses.  (Stackless machines
ignored
000027   *      without regrets).
000028   *
000029   * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
000030   *      A pointer to a long long points to the most/least significant
long
000031   *      within that long long.
000032   *
000033   * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
000034   *      The C compiler assigns bit fields from the high/low to the
low/high end
000035   *      of an int (most to least significant vs. least to most
significant).
000036   *
000037   * _IEEE_754:
000038   *      The processor (or supported implementations of the processor)
000039   *      supports the ieee-754 floating point standard.  No other
floating
000040   *      point standards are supported (or significant).  Any other
supported
000041   *      floating point formats are expected to be cased on the ISA
processor
000042   *      symbol.
000043   *
000044   * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
000045   *      The C Compiler implements objects of type `char' as `unsigned'
or
000046   *      `signed' respectively.  This is really an implementation choice
of
000047   *      the compiler writer, but it is specified in the ABI and tends
to
000048   *      be uniform across compilers for an instruction set
architecture.
000049   *      Hence, it has the properties of a processor characteristic.
000050   *
000051   * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT /
_LONG_ALIGNMENT /
000052   * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
000053   * _POINTER_ALIGNMENT:
000054   *      The ABI defines alignment requirements of each of the primitive
000055   *      object types.  Some, if not all, may be hardware requirements
as
000056   *      well.  The values are expressed in "byte-alignment" units.
000057   *
000058   * _MAX_ALIGNMENT:
000059   *      The most stringent alignment requirement as specified by the
ABI.
000060   *      Equal to the maximum of all the above _XXX_ALIGNMENT values.
000061   *
000062   * _ALIGNMENT_REQUIRED:
000063   *      True or false (1 or 0) whether or not the hardware requires the
ABI
000064   *      alignment.
000065   *
000066   *
000067   * Implementation Choices:
000068   *
000069   * _ILP32 / _LP64:
000070   *      This specifies the compiler data type implementation as
specified in
000071   *      the relevant ABI.  The choice between these is strongly
influenced
000072   *      by the underlying hardware, but is not absolutely tied to it.
000073   *      Currently only two data type models are supported:
000074   *
000075   *      _ILP32:
000076   *              Int/Long/Pointer are 32 bits.  This is the historical
UNIX
000077   *              and Solaris implementation.  Due to its historical
standing,
000078   *              this is the default case.
000079   *
000080   *      _LP64:
000081   *              Long/Pointer are 64 bits, Int is 32 bits.  This is the
chosen
000082   *              implementation for 64-bit ABIs such as SPARC V9.
000083   *
000084   *      _I32LPx:
000085   *              A compilation environment where 'int' is 32-bit, and
000086   *              longs and pointers are simply the same size.
000087   *
000088   *      In all cases, Char is 8 bits and Short is 16 bits.
000089   *
000090   * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
000091   *      This specifies the form of the disk VTOC (or label):
000092   *
000093   *      _SUNOS_VTOC_8:
000094   *              This is a VTOC form which is upwardly compatible with
the
000095   *              SunOS 4.x disk label and allows 8 partitions per disk.
000096   *
000097   *      _SUNOS_VTOC_16:
000098   *              In this format the incore vtoc image matches the ondisk
000099   *              version.  It allows 16 slices per disk, and is not
000100   *              compatible with the SunOS 4.x disk label.
000101   *
000102   *      Note that these are not the only two VTOC forms possible and
000103   *      additional forms may be added.  One possible form would be the
000104   *      SVr4 VTOC form.  The symbol for that is reserved now, although
000105   *      it is not implemented.
000106   *
000107   *      _SVR4_VTOC_16:
000108   *              This VTOC form is compatible with the System V Release
4
000109   *              VTOC (as implemented on the SVr4 Intel and 3b ports)
with
000110   *              16 partitions per disk.
000111   *
000112   *
000113   * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
000114   *      This describes the type of addresses used by system DMA:
000115   *
000116   *      _DMA_USES_PHYSADDR:
000117   *              This type of DMA, used in the x86 implementation,
000118   *              requires physical addresses for DMA buffers.  The
24-bit
000119   *              addresses used by some legacy boards is the source of
the
000120   *              "low-memory" (<16MB) requirement for some devices using
DMA.
000121   *
000122   *      _DMA_USES_VIRTADDR:
000123   *              This method of DMA allows the use of virtual addresses
for
000124   *              DMA transfers.
000125   *
000126   * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
000127   *      This indicates the presence/absence of an fdisk table.
000128   *
000129   *      _FIRMWARE_NEEDS_FDISK
000130   *              The fdisk table is required by system firmware.  If
present,
000131   *              it allows a disk to be subdivided into multiple fdisk
000132   *              partitions, each of which is equivalent to a separate,
000133   *              virtual disk.  This enables the co-existence of
multiple
000134   *              operating systems on a shared hard disk.
000135   *
000136   *      _NO_FDISK_PRESENT
000137   *              If the fdisk table is absent, it is assumed that the
entire
000138   *              media is allocated for a single operating system.
000139   *
000140   * _CONSOLE_OUTPUT_VIA_FIRMWARE / _CONSOLE_OUTPUT_VIA_SOFTWARE
000141   *      This indicates whether framebuffer console output is done by
000142   *      firmware or software.
000143   *
000144   *      _CONSOLE_OUTPUT_VIA_FIRMWARE
000145   *              Framebuffer console output is done via prom_* calls.
000146   *
000147   *      _CONSOLE_OUTPUT_VIA_SOFTWARE
000148   *              Framebuffer console output is done via the software
000149   *              terminal emulator.
000150   *      _DONT_USE_1275_GENERIC_NAMES
000151   *              Controls whether or not device tree node names should
000152   *              comply with the IEEE 1275 "Generic Names" Recommended
000153   *              Practice. With _DONT_USE_GENERIC_NAMES, device-specific
000154   *              names identifying the particular device will be used.
000155   */
000156  
000157  #ifdef  __cplusplus
000158  extern "C" {
000159  #endif
000160  
000161  
000162  /*
000163   * The following set of definitions characterize the Solaris on Intel
systems.
000164   *
000165   * The feature test macro __ia64 is generic for all processors
implementing
000166   * the Intel ia64 instruction set.  Specifically, this includes Merced.
000167   */
000168  #if defined(__ia64)
000169  
000170  /*
000171   * Define the appropriate "processor characteristics"
000172   */
000173  #define _LITTLE_ENDIAN
000174  #define _STACK_GROWS_DOWNWARD           /* sort of */
000175  #define _LONG_LONG_LTOH
000176  #define _BIT_FIELDS_LTOH
000177  #define _IEEE_754
000178  #define _CHAR_IS_SIGNED
000179  #define _CHAR_ALIGNMENT         1
000180  #define _SHORT_ALIGNMENT        2
000181  #define _INT_ALIGNMENT          4
000182  #define _LONG_ALIGNMENT         8
000183  #define _LONG_LONG_ALIGNMENT    8
000184  #define _DOUBLE_ALIGNMENT       8
000185  #define _LONG_DOUBLE_ALIGNMENT  16
000186  #define _POINTER_ALIGNMENT      8
000187  #define _MAX_ALIGNMENT          16
000188  #define _ALIGNMENT_REQUIRED     1
000189  
000190  /*
000191   * Define the appropriate "implementation choices".
000192   */
000193  #define _LP64
000194  #if !defined(_I32LPx) && defined(_KERNEL)
000195  #define _I32LPx
000196  #endif
000197  #define _MULTI_DATAMODEL
000198  #define _SUNOS_VTOC_16
000199  #define _DMA_USES_PHYSADDR
000200  #define _FIRMWARE_NEEDS_FDISK
000201  #define _CONSOLE_OUTPUT_VIA_SOFTWARE
000202  
000203  /*
000204   * The feature test macro __i386 is generic for all processors
implementing
000205   * the Intel 386 instruction set or a superset of it.  Specifically,
this
000206   * includes all members of the 386, 486, and Pentium family of
processors.
000207   */
000208  #elif defined(__i386) || defined(i386)
000209  
000210  /*
000211   * Make sure that the ANSI-C "politically correct" symbol is defined.
000212   */
000213  #if !defined(__i386)
000214  #define __i386
000215  #endif
000216  
000217  /*
000218   * Define the appropriate "processor characteristics"
000219   */
000220  #define _LITTLE_ENDIAN
000221  #define _STACK_GROWS_DOWNWARD
000222  #define _LONG_LONG_LTOH
000223  #define _BIT_FIELDS_LTOH
000224  #define _IEEE_754
000225  #define _CHAR_IS_SIGNED
000226  #define _CHAR_ALIGNMENT         1
000227  #define _SHORT_ALIGNMENT        2
000228  #define _INT_ALIGNMENT          4
000229  #define _LONG_ALIGNMENT         4
000230  #define _LONG_LONG_ALIGNMENT    4
000231  #define _DOUBLE_ALIGNMENT       4
000232  #define _LONG_DOUBLE_ALIGNMENT  4
000233  #define _POINTER_ALIGNMENT      4
000234  #define _MAX_ALIGNMENT          4
000235  #define _ALIGNMENT_REQUIRED     0
000236  #define _DONT_USE_1275_GENERIC_NAMES
000237  /*
000238   * Define the appropriate "implementation choices".
000239   */
000240  #define _ILP32
000241  #if !defined(_I32LPx) && defined(_KERNEL)
000242  #define _I32LPx
000243  #endif
000244  #define _SUNOS_VTOC_16
000245  #define _DMA_USES_PHYSADDR
000246  #define _FIRMWARE_NEEDS_FDISK
000247  #define _CONSOLE_OUTPUT_VIA_SOFTWARE
000248  
000249  /*
000250   * The following set of definitions characterize the Solaris on SPARC
systems.
000251   *
000252   * The symbol __sparc indicates any of the SPARC family of processor
000253   * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
000254   *
000255   * The symbol sparc is a deprecated historical synonym for __sparc.
000256   *
000257   * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as
defined
000258   * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close
enough
000259   * to SPARC V8 for the former to be subsumed into the latter
definition.)
000260   *
000261   * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as
defined
000262   * by Version 9 of the SPARC Architecture Manual.
000263   *
000264   * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are
only
000265   * relevant when the symbol __sparc is defined.
000266   */
000267  #elif defined(__sparc) || defined(sparc)
000268  
000269  /*
000270   * Make sure that the ANSI-C "politically correct" symbol is defined.
000271   */
000272  #if !defined(__sparc)
000273  #define __sparc
000274  #endif
000275  
000276  /*
000277   * You can be 32-bit or 64-bit, but not both at the same time.
000278   */
000279  #if defined(__sparcv8) && defined(__sparcv9)
000280  #error  "SPARC Versions 8 and 9 are mutually exclusive choices"
000281  #endif
000282  
000283  /*
000284   * Existing compilers do not set __sparcv8.  Years will transpire
before
000285   * the compilers can be depended on to set the feature test macro. In
000286   * the interim, we'll set it here on the basis of historical behaviour;
000287   * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
000288   */
000289  #if !defined(__sparcv9) && !defined(__sparcv8)
000290  #define __sparcv8
000291  #endif
000292  
000293  /*
000294   * Define the appropriate "processor characteristics" shared between
000295   * all Solaris on SPARC systems.
000296   */
000297  #define _BIG_ENDIAN
000298  #define _STACK_GROWS_DOWNWARD
000299  #define _LONG_LONG_HTOL
000300  #define _BIT_FIELDS_HTOL
000301  #define _IEEE_754
000302  #define _CHAR_IS_SIGNED
000303  #define _CHAR_ALIGNMENT         1
000304  #define _SHORT_ALIGNMENT        2
000305  #define _INT_ALIGNMENT          4
000306  #define _LONG_LONG_ALIGNMENT    8
000307  #define _DOUBLE_ALIGNMENT       8
000308  #define _ALIGNMENT_REQUIRED     1
000309  
000310  /*
000311   * Define the appropriate "implementation choices" shared between
versions.
000312   */
000313  #define _SUNOS_VTOC_8
000314  #define _DMA_USES_VIRTADDR
000315  #define _NO_FDISK_PRESENT
000316  #define _CONSOLE_OUTPUT_VIA_FIRMWARE
000317  
000318  /*
000319   * The following set of definitions characterize the implementation of
000320   * 32-bit Solaris on SPARC V8 systems.
000321   */
000322  #if defined(__sparcv8)
000323  
000324  /*
000325   * Define the appropriate "processor characteristics"
000326   */
000327  #define _LONG_ALIGNMENT         4
000328  #define _LONG_DOUBLE_ALIGNMENT  8
000329  #define _POINTER_ALIGNMENT      4
000330  #define _MAX_ALIGNMENT          8
000331  
000332  /*
000333   * Define the appropriate "implementation choices"
000334   */
000335  #define _ILP32
000336  
000337  #if !defined(_I32LPx) && defined(_KERNEL)
000338  #define _I32LPx
000339  #endif
000340  
000341  /*
000342   * The following set of definitions characterize the implementation of
000343   * 64-bit Solaris on SPARC V9 systems.
000344   */
000345  #elif defined(__sparcv9)
000346  
000347  /*
000348   * Define the appropriate "processor characteristics"
000349   */
000350  #define _LONG_ALIGNMENT         8
000351  #define _LONG_DOUBLE_ALIGNMENT  16
000352  #define _POINTER_ALIGNMENT      8
000353  #define _MAX_ALIGNMENT          16
000354  
000355  /*
000356   * Define the appropriate "implementation choices"
000357   */
000358  #define _LP64
000359  #if !defined(_I32LPx)
000360  #define _I32LPx
000361  #endif
000362  #define _MULTI_DATAMODEL
000363  
000364  #else
000365  #error  "unknown SPARC version"
000366  #endif
000367  
000368  /*
000369   * #error is strictly ansi-C, but works as well as anything for K&R
systems.
000370   */
000371  #else
000372  #error "ISA not supported"
000373  #endif
000374  
000375  #if defined(_ILP32) && defined(_LP64)
000376  #error "Both _ILP32 and _LP64 are defined"
000377  #endif
000378  
000379  #ifdef  __cplusplus
000380  }
000381  #endif
000382  
000383  #endif  /* _SYS_ISA_DEFS_H */
n$ 

Solaris 10 and Solaris 11.3 have the same essentials in there.

I will give that patch a whirl and see what happens. This will just be
a moment or two ... or three. 

Dennis

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]