[RFA] Fix libiberty compilation failure on systems running AiX 4.x

Joel Brobecker
2003-06-01T07:01:26Z

[-- Attachment #1: Type: text/plain, Size: 4533 bytes --]

Hello,

The following change in libiberty works for Aix 5.x, but breaks the
build on AiX 4.x:

2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>

* configure.in: Check for sys/systemcfg.h and
_system_configuration.
* physmem.c: Add support for AIX. Tweek formatting as per
upstream coreutils beta.

This is because the _system_configuration structure does not contain
a field named "physmem", which is used in physmem.c:

#if HAVE__SYSTEM_CONFIGURATION
/* This works on AIX. */
return _system_configuration.physmem;
#endif

For the record, I have pasted at then end of this message the definition
of this varible on a machine running 4.3.2 .

Given that the only field in _system_configuration used is "physmem",
the attached patch seemed to be the simplest change to get back the
build on AiX 4.x machines. I essentially deactivated the test for
_system_configuration on machines running AiX 4.x.

2003-06-01 J. Brobecker <brobecker@gnat.com>

* configure.in: Deactivate the test for _system_configuration
for *-*-aix4*.
* configure: Regenerate.

I have verified this test by verifying that GDB builds again on AiX 4.3.2
and by verifying that the config.h file generated on AiX 5.1 was unchanged
by the change in configure.in.

Ok to apply? (I have an FSF assignment on file via Ada Core Technologies)

Thanks.

The _system_configuration definition on 4.3.2:

<<
extern struct {
int architecture; /* processor architecture */
int implementation; /* processor implementation */
int version; /* processor version */
int width; /* width (32 || 64) */
int ncpus; /* 1 = UP, n = n-way MP */
int cache_attrib; /* cache attributes (bit flags) */
/* bit 0/1 meaning */
/* -------------------------------------*/
/* 31 no cache / cache present */
/* 30 separate I and D / combined */
int icache_size; /* size of L1 instruction cache */
int dcache_size; /* size of L1 data cache */
int icache_asc; /* L1 instruction cache associativity */
int dcache_asc; /* L1 data cache associativity */
int icache_block; /* L1 instruction cache block size */
int dcache_block; /* L1 data cache block size */
int icache_line; /* L1 instruction cache line size */
int dcache_line; /* L1 data cache line size */
int L2_cache_size; /* size of L2 cache, 0 = No L2 cache */
int L2_cache_asc; /* L2 cache associativity */
int tlb_attrib; /* TLB attributes (bit flags) */
/* bit 0/1 meaning */
/* -------------------------------------*/
/* 31 no TLB / TLB present */
/* 30 separate I and D / combined */
int itlb_size; /* entries in instruction TLB */
int dtlb_size; /* entries in data TLB */
int itlb_asc; /* instruction tlb associativity */
int dtlb_asc; /* data tlb associativity */
int resv_size; /* size of reservation */
int priv_lck_cnt; /* spin lock count in supevisor mode */
int prob_lck_cnt; /* spin lock count in problem state */
int rtc_type; /* RTC type */
int virt_alias; /* 1 if hardware aliasing is supported */
int cach_cong; /* number of page bits for cache synonym */
int model_arch; /* used by system for model determination */
int model_impl; /* used by system for model determination */
int Xint; /* used by system for time base conversion */
int Xfrac; /* used by system for time base conversion */
int kernel; /* kernel attributes */
/* bit 0/1 meaning */
/* -----------------------------------------*/
/* 31 32-bit kernel / 64-bit kernel */
}_system_configuration;
>>

--
Joel

[-- Attachment #2: libiberty.diff --]
[-- Type: text/plain, Size: 843 bytes --]

Index: configure.in
===================================================================
RCS file: /cvs/src/src/libiberty/configure.in,v
retrieving revision 1.46
diff -c -r1.46 configure.in
*** configure.in 7 May 2003 18:06:23 -0000 1.46
--- configure.in 1 Jun 2003 06:39:15 -0000
***************
*** 350,355 ****
--- 350,363 ----

case "${host}" in

+ *-*-aix4*)
+ # The _system_configuration variable on AiX 4.x does not contain the
+ # field "physmem", which is the only field used in this structure by
+ # libiberty. So no need to check the availability of that variable
+ # on such systems.
+ vars="`echo $vars | sed -e 's/_system_configuration//'`"
+ ;;
+
*-*-cygwin*)
# The Cygwin library actually uses a couple of files from
# libiberty when it is built. If we are building a native