Re: [HACKERS] configure on linux

From: Tom I Helbekkmo <tih(at)Hamartun(dot)Priv(dot)NO>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] configure on linux
Date: 1998-02-06 21:19:00
Message-ID: 980206220049.29283A@barsoom.Hamartun.Priv.NO
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 4 Feb 1998, Bruce Momjian wrote:

> I certainly think we want those changes. 6.3 beta is the place we
> expect to be making platform-specific patches.

...and here they are. There are only small modifications, but there
is one that requires a decision to be made: NetBSD/vax does not have
shared libraries, and it thus introduces a situation where a single
"port" has internal differences in this regard. What I've chosen to
do is to add a kludge to Makefile.global, identical in function to the
LINUX_ELF kludge. I think this acceptable -- you may disagree.

Apart from this Makefile hack, all I've done is to make dynamically
loaded code modules fail properly (as was already done for __mips__,
although I think this is too loose: I believe NetBSD for the pmax can
do dynamic linking), and to add test-and-set lock handling. As Bruce
suggested, this is done in a maximally efficient inlined way: I was
not aware that this code was so important, speed-wise.

Oh, and Bruce: I figured out why we talked past each other about the
lock code and inlining: I was looking at the Sparc assembly code in
s_lock.h, since my main platform is NetBSD/sparc, and if you take a
look at that, you'll see that it's _not_ inlined, and not pretty. In
fact, it breaks at -O3 and up by causing linking to fail, when GCC
eliminates the whole tas_dummy() function, since it's static and not
called by anything else. I've tried to figure out how to inline it,
but I don't know enough about the Sparc. Besides, RISC machines were
never meant to be programmed by anything but a computer. :-)

Anyway, this is all it takes to make things work on NetBSD/vax (note
the _single_ instruction used to implement the test-and-set -- it's
only one of _six_ such instructions in this powerful architecture):

*** ./Makefile.global.in.orig Tue Jan 27 09:00:13 1998
--- ./Makefile.global.in Wed Feb 4 11:58:40 1998
***************
*** 48,53 ****
--- 48,58 ----
# compiling to a.out (which means you're using the dld dynamic loading
# library), set LINUX_ELF to null in Makefile.custom.
LINUX_ELF= true
+ #
+ # Ignore BSD_SHLIB if you're not using one of the BSD ports. But if you
+ # are, and it's one that doesn't have shared libraries (NetBSD/vax is an
+ # example of this), set BSD_SHLIB to null in Makefile.custom.
+ BSD_SHLIB= true

LIBPQDIR:= $(SRCDIR)/interfaces/libpq

*** ./backend/port/dynloader/bsd.c.orig Sat Dec 20 01:10:17 1997
--- ./backend/port/dynloader/bsd.c Wed Feb 4 11:58:39 1998
***************
*** 61,67 ****
void *
BSD44_derived_dlopen(const char *file, int num)
{
! #ifdef __mips__
sprintf(error_message, "dlopen (%s) not supported", file);
return NULL;
#else
--- 61,67 ----
void *
BSD44_derived_dlopen(const char *file, int num)
{
! #if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
sprintf(error_message, "dlopen (%s) not supported", file);
return NULL;
#else
***************
*** 78,84 ****
void *
BSD44_derived_dlsym(void *handle, const char *name)
{
! #ifdef __mips__
sprintf(error_message, "dlsym (%s) failed", name);
return NULL;
#else
--- 78,84 ----
void *
BSD44_derived_dlsym(void *handle, const char *name)
{
! #if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
sprintf(error_message, "dlsym (%s) failed", name);
return NULL;
#else
***************
*** 101,107 ****
void
BSD44_derived_dlclose(void *handle)
{
! #ifndef __mips__
dlclose(handle);
#endif
}
--- 101,108 ----
void
BSD44_derived_dlclose(void *handle)
{
! #if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
! #else
dlclose(handle);
#endif
}
*** ./include/port/bsd.h.orig Sat Dec 20 01:11:00 1997
--- ./include/port/bsd.h Wed Feb 4 11:58:39 1998
***************
*** 10,15 ****
--- 10,20 ----
#define HAS_TEST_AND_SET
#endif

+ #if defined(vax)
+ #define NEED_VAX_TAS_ASM
+ #define HAS_TEST_AND_SET
+ #endif
+
#if defined(ns32k)
#define NEED_NS32k_TAS_ASM
#define HAS_TEST_AND_SET
*** ./include/storage/s_lock.h.orig Wed Feb 4 09:00:41 1998
--- ./include/storage/s_lock.h Thu Feb 5 05:37:12 1998
***************
*** 288,293 ****
--- 288,305 ----
#endif /* NEED_SPARC_TAS_ASM */

/*
+ * VAXen -- even multiprocessor ones
+ */
+
+ #if defined(NEED_VAX_TAS_ASM)
+
+ #define S_LOCK(addr) __asm__("1: bbssi $0,(%0),1b": :"r"(addr))
+ #define S_UNLOCK(addr) (*(addr) = 0)
+ #define S_INIT_LOCK(addr) (*(addr) = 0)
+
+ #endif /* NEED_VAX_TAS_ASM */
+
+ /*
* i386 based things
*/

*** ./interfaces/libpgtcl/Makefile.in.orig Fri Jan 23 09:01:01 1998
--- ./interfaces/libpgtcl/Makefile.in Wed Feb 4 11:58:40 1998
***************
*** 42,51 ****
endif

ifeq ($(PORTNAME), bsd)
! install-shlib-dep := install-shlib
! shlib := libpgtcl.so.1.0
! LDFLAGS_SL = -x -Bshareable -Bforcearchive
! CFLAGS += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), i386_solaris)
--- 42,53 ----
endif

ifeq ($(PORTNAME), bsd)
! ifdef BSD_SHLIB
! install-shlib-dep := install-shlib
! shlib := libpgtcl.so.1.0
! LDFLAGS_SL = -x -Bshareable -Bforcearchive
! CFLAGS += $(CFLAGS_SL)
! endif
endif

ifeq ($(PORTNAME), i386_solaris)
*** ./interfaces/libpq/Makefile.in.orig Mon Jan 26 09:01:30 1998
--- ./interfaces/libpq/Makefile.in Wed Feb 4 11:58:40 1998
***************
*** 43,52 ****
endif
endif
ifeq ($(PORTNAME), bsd)
! install-shlib-dep := install-shlib
! shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
! LDFLAGS_SL = -x -Bshareable -Bforcearchive
! CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), i386_solaris)
install-shlib-dep := install-shlib
--- 43,54 ----
endif
endif
ifeq ($(PORTNAME), bsd)
! ifdef BSD_SHLIB
! install-shlib-dep := install-shlib
! shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
! LDFLAGS_SL = -x -Bshareable -Bforcearchive
! CFLAGS += $(CFLAGS_SL)
! endif
endif
ifeq ($(PORTNAME), i386_solaris)
install-shlib-dep := install-shlib

-tih
--
Popularity is the hallmark of mediocrity. --Niles Crane, "Frasier"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-02-06 23:13:29 Re: [HACKERS] configure on linux
Previous Message Peter T Mount 1998-02-06 21:02:41 Re: [QUESTIONS] LArge object functions in the backend