Compile problems on NetBSD/alpha 1.4.2 (and partial solution)

Поиск
Список
Период
Сортировка
Искать

Compile problems on NetBSD/alpha 1.4.2 (and partial solution)

От:
Jaap Boender <jaapb@kerguelen.org>
Дата:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name		:	Jaap Boender
Your email address	:	jaapb@kerguelen.org


System Configuration
---------------------
  Architecture (example: Intel Pentium)  	: Alpha AXPpci33 (NoName)

  Operating System (example: Linux 2.0.26 ELF) 	: NetBSD/alpha 1.4.2

  PostgreSQL version (example: PostgreSQL-7.0):   PostgreSQL-7.0.2

  Compiler used (example:  gcc 2.8.0)		: egcs 1.1.1 


Please enter a FULL description of your problem:
------------------------------------------------

Postgres 7.0.2 did not compile on my Alpha with NetBSD 1.4.2 due to
a) the fact that src/backend/main/main.c included the wrong files 
b) the TAS implementation was not included.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 
----------------------------------------------------------------------

Just get an Alpha, install NetBSD 1.4.2, download source and make it.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

A patch for problem a), to be applied to src/backend/main/main.c:


*** main.c	Mon Oct  2 15:57:26 2000
--- main.c.orig	Wed Jan 26 06:56:30 2000
***************
*** 15,22 ****
  #include 
  
  #if defined(__alpha__) && !defined(linux)
! #include 
! #include 
  #define ASSEMBLER
  #include 
  #undef ASSEMBLER
--- 15,22 ----
  #include 
  
  #if defined(__alpha__) && !defined(linux)
! #include 
! #include "machine/hal_sysinfo.h"
  #define ASSEMBLER
  #include 
  #undef ASSEMBLER


For problem b), I just removed all #defines from
src/include/storage/s_lock.h until I ended up with this file:


[initial commentary]
#if !defined(S_LOCK_H)
#define S_LOCK_H

#include "storage/ipc.h"

extern void s_lock_sleep(unsigned spin);

#define TAS(lock) tas(lock)
#define S_UNLOCK(lock) do { __asm__("mb"); *(lock) = 0; } while (0)

static __inline__ int
tas(volatile slock_t *lock)
{
 register slock_t _res;

__asm__("	 ldq   $0, %0			   \n\
				 bne   $0, 3f		   \n\
				 ldq_l $0, %0			 \n\
				 bne   $0, 3f		   \n\
				 or    $31, 1, $0		   \n\
				 stq_c $0, %0				   \n\
				 beq   $0, 2f			   \n\
				 bis   $31, $31, %1 	   \n\
				 mb 							   \n\
				 jmp   $31, 4f			   \n\
			  2: or    $31, 1, $0			   \n\
			  3: bis   $0, $0, %1		   \n\
			  4: nop	  ": "=m"(*lock), "=r"(_res): :"0");

	return (int) _res;
}

#endif	 /* S_LOCK_H */


This worked. I don't exactly know what is defined and what isn't (I tried
gcc -E, but it didn't quite work the way I expected it to), but my guess is that
HAS_TEST_AND_SET is not defined.
---
Locutiones in Latinum conversae multo sapientes videntur.
FAQ