diff --git a/src/backend/storage/ipc/s_lock.c b/src/backend/storage/ipc/s_lock.c index 449b34d12c72cd993dc909a8bd6fef60577ac4be..de9b8689f09d61a0ab1368d67bb0aacf3e814a99 100644 --- a/src/backend/storage/ipc/s_lock.c +++ b/src/backend/storage/ipc/s_lock.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.14 1997/06/06 01:37:14 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.15 1997/07/29 14:07:48 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -521,5 +521,45 @@ S_INIT_LOCK(slock_t *lock) #endif /* NEED_NS32K_TAS_ASM */ +#if defined(linux) && defined(PPC) + +static int tas_dummy() +{ + __asm__(" +tas: /* r3 points to the location of p */ + lwarx 5,0,3 /* r5 = *p */ + cmpwi 5,0 /* r5 == 0 ? */ + bne fail /* if not 0, jump to fail */ + addi 5,5,1 /* set 1 to r5 */ + stwcx. 5,0,3 /* try update p atomically */ + beq success /* jump if scceed */ +fail: li 3,1 /* set 1 to r3 */ + blr +success: + li 3,0 /* set 0 to r3 */ + blr + "); +} + +void +S_LOCK(slock_t *lock) +{ + while (tas(lock)) + ; +} + +void +S_UNLOCK(slock_t *lock) +{ + *lock = 0; +} + +void +S_INIT_LOCK(slock_t *lock) +{ + S_UNLOCK(lock); +} + +#endif /* defined(linux) && defined(PPC) */ #endif /* HAS_TEST_AND_SET */ diff --git a/src/backend/utils/adt/dt.c b/src/backend/utils/adt/dt.c index 4c45d85753ce278e6f22113f21dc0fb4cb0f00df..bf4bb3feb8308a6186efb027df39e434f98bb3c9 100644 --- a/src/backend/utils/adt/dt.c +++ b/src/backend/utils/adt/dt.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.29 1997/07/24 20:15:53 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.30 1997/07/29 14:07:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -3758,3 +3758,30 @@ printf( "EncodeTimeSpan- result is %s\n", str); return 0; } /* EncodeTimeSpan() */ + + +#if defined(linux) && defined(PPC) +int datetime_is_epoch(double j) +{ + static union { + double epoch; + unsigned char c[8]; + } u; + + u.c[0] = 0x80; /* sign bit */ + u.c[1] = 0x10; /* DBL_MIN */ + + return(j == u.epoch); +} +int datetime_is_current(double j) +{ + static union { + double current; + unsigned char c[8]; + } u; + + u.c[1] = 0x10; /* DBL_MIN */ + + return(j == u.current); +} +#endif diff --git a/src/include/port/linux.h b/src/include/port/linux.h index 7735f3ab0fd15705db30446ee40b68a828c44015..261ce240a5f8c985924374468e2c4c461eac1148 100644 --- a/src/include/port/linux.h +++ b/src/include/port/linux.h @@ -7,11 +7,20 @@ # define JMP_BUF # define USE_POSIX_TIME # define USE_POSIX_SIGNALS -# if !defined(PPC) -# define NEED_I386_TAS_ASM -# define HAS_TEST_AND_SET +# define NEED_I386_TAS_ASM +# define HAS_TEST_AND_SET + +# if defined(PPC) + typedef unsigned int slock_t; +# else typedef unsigned char slock_t; # endif + +# if defined(PPC) +# undef NEED_I386_TAS_ASM +# undef HAVE_INT_TIMEZONE +# endif + # if defined(sparc) # undef NEED_I386_TAS_ASM # endif diff --git a/src/include/utils/dt.h b/src/include/utils/dt.h index 1de22f70df211acf26a01b1d4a14afc74a1c9e10..edf9715f9317ac192e25f04a3136834bb25d6241 100644 --- a/src/include/utils/dt.h +++ b/src/include/utils/dt.h @@ -8,7 +8,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: dt.h,v 1.13 1997/07/01 00:25:30 thomas Exp $ + * $Id: dt.h,v 1.14 1997/07/29 14:08:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -215,10 +215,20 @@ typedef struct { #define DATETIME_IS_NOEND(j) (j == DT_NOEND) #define DATETIME_CURRENT(j) {j = DT_CURRENT;} +#if defined(linux) && defined(PPC) +extern int datetime_is_current(double j); +#define DATETIME_IS_CURRENT(j) datetime_is_current(j) +#else #define DATETIME_IS_CURRENT(j) (j == DT_CURRENT) +#endif #define DATETIME_EPOCH(j) {j = DT_EPOCH;} +#if defined(linux) && defined(PPC) +extern int datetime_is_epoch(double j); +#define DATETIME_IS_EPOCH(j) datetime_is_epoch(j) +#else #define DATETIME_IS_EPOCH(j) (j == DT_EPOCH) +#endif #define DATETIME_IS_RELATIVE(j) (DATETIME_IS_CURRENT(j) || DATETIME_IS_EPOCH(j)) #define DATETIME_NOT_FINITE(j) (DATETIME_IS_INVALID(j) \ diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index c9a095de77bb09cd4b46b7d164339a52e0b5cdf5..32510ddf8833e0283b4ccc53f6e3c51c1eb5afea 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.35 1997/04/04 10:42:34 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.36 1997/07/29 14:08:34 momjian Exp $ # #------------------------------------------------------------------------- @@ -34,6 +34,7 @@ ifeq ($(PORTNAME), linux) install-shlib-dep := install-shlib shlib := libpq.so.1 LDFLAGS_SL = -shared + CFLAGS += $(CFLAGS_SL) endif endif ifeq ($(PORTNAME), BSD44_derived) diff --git a/src/makefiles/Makefile.linux b/src/makefiles/Makefile.linux index 528423701c00ae9da250b9eb7d0a9f9297df5ed6..7179f0b0ad6de35e33793a2bcf8e5c10ae3e30b0 100644 --- a/src/makefiles/Makefile.linux +++ b/src/makefiles/Makefile.linux @@ -1,5 +1,5 @@ ifdef LINUX_ELF -LDFLAGS+= -rdynamic -Wl,-rpath -Wl,$(DESTDIR)$(LIBDIR) +LDFLAGS+= -export-dynamic -Wl,-rpath -Wl,$(DESTDIR)$(LIBDIR) endif MK_NO_LORDER= true diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 9f26ab11b14a094a86cae4995d79499d775edb7b..6cab363a6e41b17276e1a97fd8d0c08724f337bd 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -7,14 +7,14 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.8 1997/06/06 01:35:57 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.9 1997/07/29 14:09:11 momjian Exp $ # #------------------------------------------------------------------------- SRCDIR= ../.. include ../../Makefile.global -CFLAGS+= -I$(LIBPQDIR) -I../../include +CFLAGS+= -I$(LIBPQDIR) -I../../include $(CFLAGS_SL) LDADD+= -L$(LIBPQDIR) -lpq