HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

Started by Shinji Teragaitoover 21 years ago12 messages
#1Shinji Teragaito
shinji@kobe.hp.com
2 attachment(s)

Hi,

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform. Also this patch contains
tas code for HP-UX Itanium.

I verified this patch on the following environment and specified as
followings at executing configure script:

* HP-UX 11.11 PA-RISC

PHSS_30766 s700_800 ANSI C compiler B.11.11.10 cumulative patch
PHSS_30966 s700_800 ld(1) and linker tools cumulative patch
PHCO_30269 s700_800 cumulative sh-posix(1) patch
PHCO_29816 s700_800 rc(1M) scripts cumulative patch
gcc (GCC) 3.4.1

1) env CC=cc ./configure --without-readline --without-zlib

2) env CC=cc CFLAGS=+DD64 ./configure --without-readline \
--without-zlib

Note: you may specify +DA2.0W instead of +DD64

3) env CC=gcc ./configure --without-readline --without-zlib

4) env CC=/usr/local/pa64/bin/gcc ./configure --without-readline \
--without-zlib

The regression test has no problem to all 96 tests in the 4 cases
above.

* HP-UX 11.23 Itanium

PHSS_30848 s700_800 HP C Compiler (A.05.57)
PHSS_30849 s700_800 u2comp/be/plugin library Patch
gcc (GCC) 3.4.1

1) env CC=cc CFLAGS="+O2" ./configure --without-readline \
--without-zlib

2) env CC=cc CFLAGS="+O2 +DD64" ./configure --without-readline \
--without-zlib

3) env CC=gcc CFLAGS="-O2" ./configure --without-readline \
--without-zlib

4) env CC=gcc CFLAGS="-O2 -mlp64" ./configure --without-readline \
--without-zlib

Only 'float8' of the regression test fails in the 4 cases above.

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

P.S. First I made this patch for PostgreSQL 7.4.3. It's easy to
backport this patch to 7.4.3. But please be carefull to build 7.4.3 on
HP-UX 11.23 (aka HP-UX 11i v2 for HP Integrity Server): you must
specify "cc -E +legacy_cpp" in CPP at running configure. Otherwise you
will see the concatenation problem caused by genbki.sh. Now you don't
need to specify CPP to the CVS tree source code because the latest
genbki.sh doesn't use the preprocessor.

Attachments:

postgresql-8.0.0beta1-hpux.patchapplication/octet-stream; type=patchDownload
Index: src/include/storage/s_lock.h
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/include/storage/s_lock.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 s_lock.h
*** src/include/storage/s_lock.h	23 Aug 2004 23:12:06 -0000	1.1.1.1
--- src/include/storage/s_lock.h	24 Aug 2004 02:09:30 -0000
***************
*** 540,545 ****
--- 540,557 ----
  
  #endif	 /* __hppa || __hppa__ */
  
+ #if defined(__hpux) && defined(__ia64)
+ #if !defined(__GNUC__)
+ 
+ #define HAS_TEST_AND_SET
+ 
+ typedef unsigned int slock_t;
+ 
+ #include <ia64/sys/inline.h>
+ #define TAS(lock) _Asm_xchg(_SZ_W, lock, 1, _LDHINT_NONE)
+ 
+ #endif        /* !defined(__GNUC__) */
+ #endif
  
  #if defined(__QNX__) && defined(__WATCOMC__)
  /*
Index: src/Makefile.shlib
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/Makefile.shlib,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.shlib
*** src/Makefile.shlib	23 Aug 2004 23:12:03 -0000	1.1.1.1
--- src/Makefile.shlib	24 Aug 2004 02:09:30 -0000
***************
*** 148,156 ****
  
  ifeq ($(PORTNAME), hpux)
    shlib			= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
-   LINK.shared		= $(LD) +h $(soname) -b +b $(libdir)
    ifeq ($(GCC), yes)
!     SHLIB_LINK		+= `$(CC) -print-libgcc-file-name`
    endif
  endif
  
--- 148,158 ----
  
  ifeq ($(PORTNAME), hpux)
    shlib			= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
    ifeq ($(GCC), yes)
!     LINK.shared               = $(CC) $(LDFLAGS) -shared -Wl,+h -Wl,$(soname) -Wl,+b -Wl,$(libdir)
!     SHLIB_LINK                += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
!   else
!     LINK.shared               = $(LD) +h $(soname) -b +b $(libdir)
    endif
  endif
  
Index: src/makefiles/Makefile.hpux
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/makefiles/Makefile.hpux,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.hpux
*** src/makefiles/Makefile.hpux	23 Aug 2004 23:12:07 -0000	1.1.1.1
--- src/makefiles/Makefile.hpux	24 Aug 2004 02:09:30 -0000
***************
*** 11,16 ****
--- 11,21 ----
     LIBS := -lBSD $(LIBS)
  endif
  
+ # Using X/Open Networking Interfaces requires to link with libxnet.
+ # Without specifying this, bind(), getpeername() and so on don't work
+ # correctly in the LP64 data model.
+ LIBS := -lxnet $(LIBS)
+ 
  # Embed 'libdir' as the shared library search path so that the executables
  # don't need SHLIB_PATH to be set.  (We do not observe the --enable-rpath
  # switch here because you'd get rather bizarre behavior if you leave this
***************
*** 28,34 ****
--- 33,43 ----
  
  AROPT = crs
  
+ ifeq ($(host_cpu), ia64)
+ DLSUFFIX = .so
+ else
  DLSUFFIX = .sl
+ endif
  ifeq ($(GCC), yes)
  CFLAGS_SL = -fpic
  else
***************
*** 37,43 ****
  
  # Rule for building shared libs (currently used only for regression test
  # shlib ... should go away, since this is not really enough knowledge)
! %.sl: %.o
  	$(LD) -b -o $@ $<
  
  sqlmansect = 5
--- 46,56 ----
  
  # Rule for building shared libs (currently used only for regression test
  # shlib ... should go away, since this is not really enough knowledge)
! %$(DLSUFFIX): %.o
! ifeq ($(GCC), yes)
! 	$(CC) $(LDFLAGS) -shared -o $@ $<
! else
  	$(LD) -b -o $@ $<
+ endif
  
  sqlmansect = 5
Index: doc/FAQ_HPUX
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/doc/FAQ_HPUX,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 FAQ_HPUX
*** doc/FAQ_HPUX	23 Aug 2004 23:12:01 -0000	1.1.1.1
--- doc/FAQ_HPUX	24 Aug 2004 02:09:30 -0000
***************
*** 33,48 ****
  
  I'd also recommend making sure you are fairly up-to-date on HP
  patches.  At a minimum, if you are building 64 bit binaries on on HPUX
! 11.11 you may need PHSS_26263 (11.11) or a successor patch otherwise
  initdb may hang:
  
!     PHSS_26263  s700_800 11.11 ld(1) and linker tools cumulative patch
  
  On general principles you should be current on libc and ld/dld
  patches, as well as compiler patches if you are using HP's C compiler.
  See HP's support sites such as http://itrc.hp.com and
  ftp://us-ffs.external.hp.com/ for free copies of their latest patches.
  
  
  1.2)	Anything special about the build/install procedure?
  
--- 33,59 ----
  
  I'd also recommend making sure you are fairly up-to-date on HP
  patches.  At a minimum, if you are building 64 bit binaries on on HPUX
! 11.11 you may need PHSS_30966 (11.11) or a successor patch otherwise
  initdb may hang:
  
!     PHSS_30966  s700_800 ld(1) and linker tools cumulative patch
  
  On general principles you should be current on libc and ld/dld
  patches, as well as compiler patches if you are using HP's C compiler.
  See HP's support sites such as http://itrc.hp.com and
  ftp://us-ffs.external.hp.com/ for free copies of their latest patches.
  
+ If you are building on a PA-RISC 2.0 machine and want to have 64-bit
+ binaries using GCC, you must use GCC 64-bit version. GCC binaries for
+ HP-UX PA-RISC and Itanium are available from http://www.hp.com/go/gcc.
+ Don't forget to get and install binutils at the same time.
+ 
+ If you are building on a HP-UX Itanium machine, you will need the
+ latest HP ANSI C compiler with its dependent patch or successor
+ patches:
+ 
+     PHSS_30848  s700_800 HP C Compiler (A.05.57)
+     PHSS_30849  s700_800 u2comp/be/plugin library Patch
  
  1.2)	Anything special about the build/install procedure?
  
***************
*** 75,84 ****
  Any other error is cause for suspicion.
  
  The parallel regression test script (gmake check) is known to lock up
! when run under HP's Bourne shells: /usr/bin/sh and /sbin/sh.  This is a
! known defect JAGad84609, the fix for which is not yet in any released
! HP-UX version or shell patches.  To work around it, use ksh to run the
! regression script:
  	gmake SHELL=/bin/ksh check
  
  If you see that the tests have stopped making progress and only a shell
--- 86,100 ----
  Any other error is cause for suspicion.
  
  The parallel regression test script (gmake check) is known to lock up
! on PA-RISC when run under HP's Bourne shells: /usr/bin/sh and
! /sbin/sh. To fix this problem, you will need PHCO_30269 with its
! dependent patch or successor patches:
! 
!     PHCO_30269  s700_800 cumulative sh-posix(1) patch
!     PHCO_29816  s700_800 rc(1M) scripts cumulative patch 
! 
! To work around this problem, use ksh to run the regression script:
! 
  	gmake SHELL=/bin/ksh check
  
  If you see that the tests have stopped making progress and only a shell
regression.diffsapplication/octet-streamDownload
*** ./expected/float8.out	Tue Aug 24 08:12:07 2004
--- ./results/float8.out	Tue Aug 24 10:48:59 2004
***************
*** 342,348 ****
  SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
  ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
! ERROR:  result is out of range
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
  ERROR:  cannot take logarithm of zero
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;
--- 342,348 ----
  SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
  ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
! ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
  ERROR:  cannot take logarithm of zero
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;

======================================================================

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Shinji Teragaito (#1)
Re: HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

The s_lock change looks good ... but ...

This patch seems likely to break many other platforms. You do not
seriously expect us to apply that change to float8.out, do you?

I'd also like to know the rationale for the Makefile.shlib changes
(which did not seem to be needed the last time I tested on HPUX 11)
and the -lxnet addition to Makefile.hpux (ditto).

regards, tom lane

#3Shinji Teragaito
shinji@kobe.hp.com
In reply to: Tom Lane (#2)
Re: HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

On Tue, 24 Aug 2004 00:39:55 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

The s_lock change looks good ... but ...

This patch seems likely to break many other platforms. You do not
seriously expect us to apply that change to float8.out, do you?

No.

I'd also like to know the rationale for the Makefile.shlib changes
(which did not seem to be needed the last time I tested on HPUX 11)
and the -lxnet addition to Makefile.hpux (ditto).

* Makefile.shlib changes are required to link libgcc.a 64-bit
version correctly on HP-UX 11.23 (Itanium). Without specifying
-mlp64 in LDFLAGS, you will get libgcc.a 32-bit version. Then
linking libpq.so.3 with ld, you will see the following error:

/usr/ccs/bin/ld +h libpq.so.3 -b +b /usr/local/pgsql/lib
fe-auth.o ..(snip).. `gcc -print-libgcc-file-name` -o libpq.so.3

ld: Mismatched Data ABI. Expected EF_IA_64_ABI64 but found None in file
/usr/local/lib/gcc/ia64-hp-hpux11.23/3.4.1/libgcc.a[__divdi3.oS]

To link 64-bit object files with libgcc.a, libgcc.a must be
64-bit.

On the other hand, the changes to SHLIB_LINK is not required for
PA-RISC HP-UX. Becase the gcc binaries are seperated for 32-bit
and 64-bit uses respectively. According to the data model, ILP32
or LP64, you will select the appropriate gcc binary. Then `$(CC)
-print-libgcc-file-name` results to be the correct libgcc.a.

* When you specify _XOPEN_SOURCE_EXTENDED in CFLAGS, X/Open
Networking Interfaces doesn't work in LP64 data model without
linking with libxnet. The third parameter type in sockets and IP
resolution interfaces such as bind() and getpeername() is defined
as socklen_t. socklen_t is typedefed as size_t, which is typedefed
as unsigned long. In LP64 data model, size_t results to be
64-bit. But inside the HP-UX X/Open Networking Interfaces
implementation, the third parameter is expected as 32-bit
length. To work around this problem in LP64 data model especially,
the -lxnet addition to Makefile.hpux is required.

Refer to man 7 xopen_networking.

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

#4Shinji Teragaito
shinji@kobe.hp.com
In reply to: Shinji Teragaito (#3)
1 attachment(s)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

On Tue, 24 Aug 2004 00:39:55 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

The s_lock change looks good ... but ...

This patch seems likely to break many other platforms. You do not
seriously expect us to apply that change to float8.out, do you?

My patch is not related to the failure of the float8 test. Because
you can see this failure when you compile the original cvs source code
using GCC 3.4.1 on HP-UX 11.23 (Itanium) and run the regression test.
Besides the failure of the float8 test, the create_function_1 and
triggers tests fail. Please refer to the attached regression.diff. The
result of float8.out diffs in this file are the same with the result I
can see under the environment my patch is applied.

The reason refint.sl has unresolved external symbol (__divdi3) is
it's linked by /usr/ccs/bin/ld without libgcc.a. This is implemented
in src/Makefile.port. Makefile.port in my patch use GCC to link
refint.so. It results to link refint.so with libgcc.a implicitly and
automatically. Anyway my patch will eliminate the failures of the
create_function_1 and triggers test when GCC on HP-UX 11.23 will be
used regardless of ILP32 or LP64.

I'd also like to know the rationale for the Makefile.shlib changes
(which did not seem to be needed the last time I tested on HPUX 11)

Note I don't see this unresolved symbol problem when I use GCC 3.4.1
on HP-UX 11.11 (PA-RISC) even if my patch is not applied. I have not
look into this deeply (I'm just wondering millicode routine on PA-RISC
is related to this).

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

Attachments:

regression.diffsapplication/octet-streamDownload
*** ./expected/float8.out	Tue Aug 24 08:12:07 2004
--- ./results/float8.out	Wed Aug 25 23:41:25 2004
***************
*** 342,348 ****
  SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
  ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
! ERROR:  result is out of range
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
  ERROR:  cannot take logarithm of zero
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;
--- 342,348 ----
  SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
  ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
! ERROR:  type "double precision" value out of range: overflow
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
  ERROR:  cannot take logarithm of zero
  SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;

======================================================================

*** ./expected/create_function_1.out	Wed Aug 25 23:41:07 2004
--- ./results/create_function_1.out	Wed Aug 25 23:41:27 2004
***************
*** 27,36 ****
--- 27,38 ----
  	RETURNS trigger
  	AS '/disk/home/shinji/test/pgsql/src/test/regress/../../../contrib/spi/refint.sl'
  	LANGUAGE 'C';
+ ERROR:  could not load library "/disk/home/shinji/test/pgsql/src/test/regress/../../../contrib/spi/refint.sl": Unresolved external
  CREATE FUNCTION check_foreign_key ()
  	RETURNS trigger
  	AS '/disk/home/shinji/test/pgsql/src/test/regress/../../../contrib/spi/refint.sl'
  	LANGUAGE 'C';
+ ERROR:  could not load library "/disk/home/shinji/test/pgsql/src/test/regress/../../../contrib/spi/refint.sl": Unresolved external
  CREATE FUNCTION autoinc ()
  	RETURNS trigger
  	AS '/disk/home/shinji/test/pgsql/src/test/regress/../../../contrib/spi/autoinc.sl'

======================================================================

*** ./expected/triggers.out	Tue Aug 24 08:12:07 2004
--- ./results/triggers.out	Wed Aug 25 23:41:31 2004
***************
*** 24,33 ****
--- 24,35 ----
  	for each row 
  	execute procedure 
  	check_primary_key ('fkey1', 'fkey2', 'pkeys', 'pkey1', 'pkey2');
+ ERROR:  function check_primary_key() does not exist
  create trigger check_fkeys_pkey2_exist 
  	before insert or update on fkeys 
  	for each row 
  	execute procedure check_primary_key ('fkey3', 'fkeys2', 'pkey23');
+ ERROR:  function check_primary_key() does not exist
  --
  -- For fkeys2:
  -- 	(fkey21, fkey22)	--> pkeys (pkey1, pkey2)
***************
*** 37,47 ****
--- 39,52 ----
  	for each row 
  	execute procedure 
  	check_primary_key ('fkey21', 'fkey22', 'pkeys', 'pkey1', 'pkey2');
+ ERROR:  function check_primary_key() does not exist
  -- Test comments
  COMMENT ON TRIGGER check_fkeys2_pkey_bad ON fkeys2 IS 'wrong';
  ERROR:  trigger "check_fkeys2_pkey_bad" for table "fkeys2" does not exist
  COMMENT ON TRIGGER check_fkeys2_pkey_exist ON fkeys2 IS 'right';
+ ERROR:  trigger "check_fkeys2_pkey_exist" for table "fkeys2" does not exist
  COMMENT ON TRIGGER check_fkeys2_pkey_exist ON fkeys2 IS NULL;
+ ERROR:  trigger "check_fkeys2_pkey_exist" for table "fkeys2" does not exist
  --
  -- For pkeys:
  -- 	ON DELETE/UPDATE (pkey1, pkey2) CASCADE:
***************
*** 53,58 ****
--- 58,64 ----
  	execute procedure 
  	check_foreign_key (2, 'cascade', 'pkey1', 'pkey2', 
  	'fkeys', 'fkey1', 'fkey2', 'fkeys2', 'fkey21', 'fkey22');
+ ERROR:  function check_foreign_key() does not exist
  --
  -- For fkeys2:
  -- 	ON DELETE/UPDATE (pkey23) RESTRICT:
***************
*** 62,67 ****
--- 68,74 ----
  	before delete or update on fkeys2
  	for each row 
  	execute procedure check_foreign_key (1, 'restrict', 'pkey23', 'fkeys', 'fkey3');
+ ERROR:  function check_foreign_key() does not exist
  insert into fkeys2 values (10, '1', 1);
  insert into fkeys2 values (30, '3', 2);
  insert into fkeys2 values (40, '4', 5);
***************
*** 68,75 ****
  insert into fkeys2 values (50, '5', 3);
  -- no key in pkeys
  insert into fkeys2 values (70, '5', 3);
- ERROR:  tuple references non-existent key
- DETAIL:  Trigger "check_fkeys2_pkey_exist" found tuple referencing non-existent key in "pkeys".
  insert into fkeys values (10, '1', 2);
  insert into fkeys values (30, '3', 3);
  insert into fkeys values (40, '4', 2);
--- 75,80 ----
***************
*** 76,101 ****
  insert into fkeys values (50, '5', 2);
  -- no key in pkeys
  insert into fkeys values (70, '5', 1);
- ERROR:  tuple references non-existent key
- DETAIL:  Trigger "check_fkeys_pkey_exist" found tuple referencing non-existent key in "pkeys".
  -- no key in fkeys2
  insert into fkeys values (60, '6', 4);
- ERROR:  tuple references non-existent key
- DETAIL:  Trigger "check_fkeys_pkey2_exist" found tuple referencing non-existent key in "fkeys2".
  delete from pkeys where pkey1 = 30 and pkey2 = '3';
- NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys are deleted
- ERROR:  "check_fkeys2_fkey_restrict": tuple is referenced in "fkeys"
- CONTEXT:  SQL query "delete from fkeys2 where fkey21 = $1 and fkey22 = $2 "
  delete from pkeys where pkey1 = 40 and pkey2 = '4';
- NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys are deleted
- NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys2 are deleted
  update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 50 and pkey2 = '5';
- NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys are deleted
- ERROR:  "check_fkeys2_fkey_restrict": tuple is referenced in "fkeys"
- CONTEXT:  SQL query "delete from fkeys2 where fkey21 = $1 and fkey22 = $2 "
  update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1';
! NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys are deleted
! NOTICE:  check_pkeys_fkey_cascade: 1 tuple(s) of fkeys2 are deleted
  DROP TABLE pkeys;
  DROP TABLE fkeys;
  DROP TABLE fkeys2;
--- 81,93 ----
  insert into fkeys values (50, '5', 2);
  -- no key in pkeys
  insert into fkeys values (70, '5', 1);
  -- no key in fkeys2
  insert into fkeys values (60, '6', 4);
  delete from pkeys where pkey1 = 30 and pkey2 = '3';
  delete from pkeys where pkey1 = 40 and pkey2 = '4';
  update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 50 and pkey2 = '5';
  update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1';
! ERROR:  duplicate key violates unique constraint "pkeys_i"
  DROP TABLE pkeys;
  DROP TABLE fkeys;
  DROP TABLE fkeys2;

======================================================================

#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Shinji Teragaito (#3)
Re: HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

This has been applied and will be in beta3.

---------------------------------------------------------------------------

Shinji Teragaito wrote:

On Tue, 24 Aug 2004 00:39:55 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

The s_lock change looks good ... but ...

This patch seems likely to break many other platforms. You do not
seriously expect us to apply that change to float8.out, do you?

No.

I'd also like to know the rationale for the Makefile.shlib changes
(which did not seem to be needed the last time I tested on HPUX 11)
and the -lxnet addition to Makefile.hpux (ditto).

* Makefile.shlib changes are required to link libgcc.a 64-bit
version correctly on HP-UX 11.23 (Itanium). Without specifying
-mlp64 in LDFLAGS, you will get libgcc.a 32-bit version. Then
linking libpq.so.3 with ld, you will see the following error:

/usr/ccs/bin/ld +h libpq.so.3 -b +b /usr/local/pgsql/lib
fe-auth.o ..(snip).. `gcc -print-libgcc-file-name` -o libpq.so.3

ld: Mismatched Data ABI. Expected EF_IA_64_ABI64 but found None in file
/usr/local/lib/gcc/ia64-hp-hpux11.23/3.4.1/libgcc.a[__divdi3.oS]

To link 64-bit object files with libgcc.a, libgcc.a must be
64-bit.

On the other hand, the changes to SHLIB_LINK is not required for
PA-RISC HP-UX. Becase the gcc binaries are seperated for 32-bit
and 64-bit uses respectively. According to the data model, ILP32
or LP64, you will select the appropriate gcc binary. Then `$(CC)
-print-libgcc-file-name` results to be the correct libgcc.a.

* When you specify _XOPEN_SOURCE_EXTENDED in CFLAGS, X/Open
Networking Interfaces doesn't work in LP64 data model without
linking with libxnet. The third parameter type in sockets and IP
resolution interfaces such as bind() and getpeername() is defined
as socklen_t. socklen_t is typedefed as size_t, which is typedefed
as unsigned long. In LP64 data model, size_t results to be
64-bit. But inside the HP-UX X/Open Networking Interfaces
implementation, the third parameter is expected as 32-bit
length. To work around this problem in LP64 data model especially,
the -lxnet addition to Makefile.hpux is required.

Refer to man 7 xopen_networking.

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Shinji Teragaito (#4)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX

Has this been resolved?

---------------------------------------------------------------------------

Shinji Teragaito wrote:

On Tue, 24 Aug 2004 00:39:55 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

The s_lock change looks good ... but ...

This patch seems likely to break many other platforms. You do not
seriously expect us to apply that change to float8.out, do you?

My patch is not related to the failure of the float8 test. Because
you can see this failure when you compile the original cvs source code
using GCC 3.4.1 on HP-UX 11.23 (Itanium) and run the regression test.
Besides the failure of the float8 test, the create_function_1 and
triggers tests fail. Please refer to the attached regression.diff. The
result of float8.out diffs in this file are the same with the result I
can see under the environment my patch is applied.

The reason refint.sl has unresolved external symbol (__divdi3) is
it's linked by /usr/ccs/bin/ld without libgcc.a. This is implemented
in src/Makefile.port. Makefile.port in my patch use GCC to link
refint.so. It results to link refint.so with libgcc.a implicitly and
automatically. Anyway my patch will eliminate the failures of the
create_function_1 and triggers test when GCC on HP-UX 11.23 will be
used regardless of ILP32 or LP64.

I'd also like to know the rationale for the Makefile.shlib changes
(which did not seem to be needed the last time I tested on HPUX 11)

Note I don't see this unresolved symbol problem when I use GCC 3.4.1
on HP-UX 11.11 (PA-RISC) even if my patch is not applied. I have not
look into this deeply (I'm just wondering millicode routine on PA-RISC
is related to this).

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#6)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Has this been resolved?

AFAIK everything is fixed. I put in Shinji's changes and some more of
my own. I did port testing on HP 11.11 and 11.23 a month or so ago and
found that we could build and pass regression on both gcc and vendor
cc on both platforms.

regards, tom lane

#8Shinji Teragaito
shinji@kobe.hp.com
In reply to: Tom Lane (#7)
1 attachment(s)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX

On Thu, 07 Oct 2004 15:32:16 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Has this been resolved?

AFAIK everything is fixed. I put in Shinji's changes and some more of
my own. I did port testing on HP 11.11 and 11.23 a month or so ago and
found that we could build and pass regression on both gcc and vendor
cc on both platforms.

As long as GNU ld is not installed and GNU gcc is used, the current
CVS head has two problems:

#1) ld: Mismatched Data ABI

In the LP64 data model, libpq.so creation fails because "-mlp64" is
missing in the back singlequote.

/usr/ccs/bin/ld +h libpq.so.3 -b +b /usr/local/pgsql/lib ..(snip)..
-L../../../src/port -lnsl `gcc -print-libgcc-file-name` -o
libpq.so.3

ld: Mismatched Data ABI. Expected EF_IA_64_ABI64 but found None in file
/usr/local/lib/gcc/ia64-hp-hpux11.23/3.4.1/libgcc.a[__divdi3.oS]
Fatal error.

#2) Two regresstion tests fail

create_function_1 and triggers tests fail because refint.so has
unresolved external symbol "__divdi3".

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

Attachments:

postgresql-8.0.0beta3-hpux.patchapplication/octet-stream; type=patchDownload
Index: src/Makefile.shlib
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/Makefile.shlib,v
retrieving revision 1.78
diff -r1.78 Makefile.shlib
152c152
<     SHLIB_LINK		+= `$(CC) -print-libgcc-file-name`
---
>     SHLIB_LINK		+= `$(CC) $(LDFLAGS) -print-libgcc-file-name`
155c155
<     LINK.shared		= $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
---
>     LINK.shared		= $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) -Wl,+b -Wl,$(libdir)
Index: src/makefiles/Makefile.hpux
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/makefiles/Makefile.hpux,v
retrieving revision 1.24
diff -r1.24 Makefile.hpux
58c58
< ifeq ($(with_gnu_ld), yes)
---
> ifeq ($(GCC), yes)
#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Shinji Teragaito (#8)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX

Shinji Teragaito <shinji@kobe.hp.com> writes:
152c152
< SHLIB_LINK += `$(CC) -print-libgcc-file-name`
---

SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name`

Okay. I'm slightly worried about odd LDFLAGS values confusing this, but
we can deal with that when we see an example.

155c155
< LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
---

LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) -Wl,+b -Wl,$(libdir)

That looks good too. I think I had seen a truncated version of this
(just the +b part) and left it off because it didn't work.

I've applied both these changes.

58c58
< ifeq ($(with_gnu_ld), yes)
---

ifeq ($(GCC), yes)

This I cannot apply; it breaks the gcc-with-HP-ld case, at least on my
personal installation (HPUX 10.20, gcc 2.95.3, HP ld). My tests on HP's
testdrive systems did not show any problem here --- what case are you
concerned about exactly?

regards, tom lane

#10Shinji Teragaito
shinji@kobe.hp.com
In reply to: Tom Lane (#9)
Re: [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX

On Fri, 08 Oct 2004 00:26:06 -0400, Tom Lane <tgl@sss.pgh.pa.us> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:
152c152
< SHLIB_LINK += `$(CC) -print-libgcc-file-name`
---

SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name`

Okay. I'm slightly worried about odd LDFLAGS values confusing this, but
we can deal with that when we see an example.

155c155
< LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
---

LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) -Wl,+b -Wl,$(libdir)

That looks good too. I think I had seen a truncated version of this
(just the +b part) and left it off because it didn't work.

I've applied both these changes.

Thank you !!

58c58
< ifeq ($(with_gnu_ld), yes)
---

ifeq ($(GCC), yes)

This I cannot apply; it breaks the gcc-with-HP-ld case, at least on my
personal installation (HPUX 10.20, gcc 2.95.3, HP ld). My tests on HP's
testdrive systems did not show any problem here --- what case are you
concerned about exactly?

gcc-with-HP-ld case on Itanium (HP-UX 11.23, gcc 3.4.1, HP ld).

Cheers,

Shinji Teragaito
Hewlett-Packard Japan, Ltd.

#11Ed L.
pgsql@bluepolka.net
In reply to: Bruce Momjian (#5)
Re: HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

I see Shinji's patch changed the library suffix from .sl to .so for ia64.
Is that is necessary? If so, why?

Thanks,
Ed

#12Shinji Teragaito
shinji@kobe.hp.com
In reply to: Ed L. (#11)
Re: HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX 11.23 Patch

On Tue, 26 Oct 2004 21:27:13 -0600, "Ed L." <pgsql@bluepolka.net> said:

Shinji Teragaito <shinji@kobe.hp.com> writes:

I made a patch to let PostgreSQL work in the LP64 data model on
HP-UX PA-RISC and HP-UX Itanium platform.

I see Shinji's patch changed the library suffix from .sl to .so for ia64.
Is that is necessary? If so, why?

HP-UX Itanium native shared library suffix is ".so", not ".sl".
My patch conforms to such a convention.

Please take a look at the directory /usr/lib/hpux{32,64}. Note ".sl"
libraries under /usr/lib and /usr/lib/pa{1.1,2.0,20_32,20_64} are PA
binaries for Aries.

Cheers,

Shinji