summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-02-28 16:23:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-02-28 16:23:15 +0000
commit19e194ad5a0b332a85659fe3309d0a3b36eef904 (patch)
tree4d1e9450dbff4857b435353983efdd1e3af2482c /ext
parent419f661778e370673da98a64e4f8542f2c1d4968 (diff)
downloadperl-19e194ad5a0b332a85659fe3309d0a3b36eef904.tar.gz
AIX 64-bit patches from Steven Hirsch <hirschs@btv.ibm.com>
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
Diffstat (limited to 'ext')
-rw-r--r--ext/DynaLoader/dl_aix.xs41
-rw-r--r--ext/File/Glob/Makefile.PL10
2 files changed, 45 insertions, 6 deletions
diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs
index f845681ae1..0a92af7ca6 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
+ * <hirschs@btv.ibm.com> */
+#ifdef USE_64_BIT_ALL
+# define __XCOFF64__
+# define __XCOFF32__
+#endif
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -29,6 +38,18 @@
#include <a.out.h>
#include <ldfcn.h>
+#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 c82988fdb1..98781c98e7 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;
+}