From 19e194ad5a0b332a85659fe3309d0a3b36eef904 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 28 Feb 2000 16:23:15 +0000 Subject: [PATCH] AIX 64-bit patches from Steven Hirsch The patch to File/Glob/Makefile.PL is inconvenient but at the moment necessary: adding an ext/FIle/Glob/hints/aix.pl to turn off the optimization ($self->{OPTIMIZE} = '') doesn't work, the file is processed by MakeMaker but OPTIMIZE ends up as -O in the resulting Makefile. A MakeMaker bug? p4raw-id: //depot/cfgperl@5323 --- ext/DynaLoader/dl_aix.xs | 41 ++++++++++++--- ext/File/Glob/Makefile.PL | 10 ++++ hints/aix.sh | 131 ++++++++++++++++++++++++++++++++++++++++++++-- t/lib/ipc_sysv.t | 19 +++++-- 4 files changed, 187 insertions(+), 14 deletions(-) diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index f845681..0a92af7 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -20,6 +20,15 @@ #include "perl.h" #include "XSUB.h" +/* When building as a 64-bit binary on AIX, define this to get the + * correct structure definitions. Also determines the field-name + * macros and gates some logic in readEntries(). -- Steven N. Hirsch + * */ +#ifdef USE_64_BIT_ALL +# define __XCOFF64__ +# define __XCOFF32__ +#endif + #include #include #include @@ -29,6 +38,18 @@ #include #include +#ifdef USE_64_BIT_ALL +# define AIX_SCNHDR SCNHDR_64 +# define AIX_LDHDR LDHDR_64 +# define AIX_LDSYM LDSYM_64 +# define AIX_LDHDRSZ LDHDRSZ_64 +#else +# define AIX_SCNHDR SCNHDR +# define AIX_LDHDR LDHDR +# define AIX_LDSYM LDSYM +# define AIX_LDHDRSZ LDHDRSZ +#endif + /* When using Perl extensions written in C++ the longer versions * of load() and unload() from libC and libC_r need to be used, * otherwise statics in the extensions won't get initialized right. @@ -394,10 +415,10 @@ static int readExports(ModulePtr mp) { dTHX; LDFILE *ldp = NULL; - SCNHDR sh; - LDHDR *lhp; + AIX_SCNHDR sh; + AIX_LDHDR *lhp; char *ldbuf; - LDSYM *ls; + AIX_LDSYM *ls; int i; ExportPtr ep; @@ -463,7 +484,11 @@ static int readExports(ModulePtr mp) return -1; } } +#ifdef USE_64_BIT_ALL + if (TYPE(ldp) != U803XTOCMAGIC) { +#else if (TYPE(ldp) != U802TOCMAGIC) { +#endif errvalid++; strcpy(errbuf, "readExports: bad magic"); while(ldclose(ldp) == FAILURE) @@ -511,8 +536,8 @@ static int readExports(ModulePtr mp) ; return -1; } - lhp = (LDHDR *)ldbuf; - ls = (LDSYM *)(ldbuf+LDHDRSZ); + lhp = (AIX_LDHDR *)ldbuf; + ls = (AIX_LDSYM *)(ldbuf+AIX_LDHDRSZ); /* * Count the number of exports to include in our export table. */ @@ -536,15 +561,19 @@ static int readExports(ModulePtr mp) * the entry point we got from load. */ ep = mp->exports; - ls = (LDSYM *)(ldbuf+LDHDRSZ); + ls = (AIX_LDSYM *)(ldbuf+AIX_LDHDRSZ); for (i = lhp->l_nsyms; i; i--, ls++) { char *symname; if (!LDR_EXPORT(*ls)) continue; +#ifndef USE_64_BIT_ALL if (ls->l_zeroes == 0) +#endif symname = ls->l_offset+lhp->l_stoff+ldbuf; +#ifndef USE_64_BIT_ALL else symname = ls->l_name; +#endif ep->name = savepv(symname); ep->addr = (void *)((unsigned long)mp->entry + ls->l_value); ep++; diff --git a/ext/File/Glob/Makefile.PL b/ext/File/Glob/Makefile.PL index c82988f..98781c9 100644 --- a/ext/File/Glob/Makefile.PL +++ b/ext/File/Glob/Makefile.PL @@ -9,3 +9,13 @@ WriteMakefile( # DEFINE => '-DGLOB_DEBUG', # OPTIMIZE => '-g', ); +use Config; +sub MY::cflags { + package MY; + my $inherited = shift->SUPER::cflags(@_); + if ($Config::Config{archname} =~ /^aix/ and + $Config::Config{use64bitall} eq 'define') { + $inherited =~ s/\s-O\d?//m; + } + $inherited; +} diff --git a/hints/aix.sh b/hints/aix.sh index 1029a36..6e8a4b3 100644 --- a/hints/aix.sh +++ b/hints/aix.sh @@ -3,6 +3,7 @@ # AIX 4.1 hints thanks to Christopher Chan-Nui . # AIX 4.1 pthreading by Christopher Chan-Nui and # Jarkko Hietaniemi . +# AIX 4.3.x LP64 build by Steven Hirsch # Merged on Mon Feb 6 10:22:35 EST 1995 by # Andy Dougherty @@ -67,6 +68,31 @@ so="a" # Stephanie Beals dlext="so" +# Take possible hint from the environment. If 32-bit is set in the +# environment, we can override it later. If set for 64, the +# 'sizeof' test sees a native 64-bit architecture and never looks back. +case "$OBJECT_MODE" in +32) + cat >&4 <&4 <&4 < UU/use64bitall.cbu <<'EOCBU' +case "$use64bitall" in +$define|true|[yY]*) + case "`oslevel`" in + 3.*|4.[012].*) + cat >&4 <&4 + $cat >size.c < +#include +int main (void) +{ + printf("%d\n",_system_configuration.width); + return(0); +} +EOCP + set size + if eval $compile_ok; then + lfcpuwidth=`./size` + echo "You are running on $lfcpuwidth bit hardware." + else + dflt="32" + echo " " + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the width of your CPU (in bits)?" + . ./myread + lfcpuwidth="$ans" + fi + $rm -f size.c size + case "$lfcpuwidth" in + 32*) + cat >&4 <