Skip to content

Commit 12af9cd

Browse files
committed
Add support for Solaris x86_64 using Sun's compiler.
Pierre Girard
1 parent c876d96 commit 12af9cd

File tree

4 files changed

+49
-6
lines changed

4 files changed

+49
-6
lines changed

src/Makefile.shlib

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.100 2005/12/09 21:19:34 petere Exp $
9+
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.101 2005/12/30 21:43:41 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -193,7 +193,7 @@ ifeq ($(PORTNAME), solaris)
193193
ifeq ($(GCC), yes)
194194
LINK.shared = $(CC) -shared
195195
else
196-
LINK.shared = $(CC) -G
196+
LINK.shared = $(CC) -G $(CFLAGS) # CFLAGS added for X86_64
197197
endif
198198
ifeq ($(with_gnu_ld), yes)
199199
LINK.shared += -Wl,-soname,$(soname)

src/backend/port/tas/solaris_x86_64.s

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/=============================================================================
2+
/ tas.s -- test and set lock for solaris_i386
3+
/ based on i386 ASM with modifications outlined in
4+
/ http://www.x86-64.org/documentation/assembly
5+
/=============================================================================
6+
7+
.file "tas.s"
8+
.text
9+
.align 16
10+
.L1.text:
11+
12+
.globl tas
13+
tas:
14+
pushq %rbp /save prev base pointer
15+
movq %rsp,%rbp /new base pointer
16+
pushq %rbx /save prev bx
17+
movq 8(%rbp),%rbx /load bx with address of lock
18+
movq $255,%rax /put something in ax
19+
xchgb %al,(%rbx) /swap lock value with "0"
20+
cmpb $0,%al /did we get the lock?
21+
jne .Locked
22+
subq %rax,%rax /yes, we got it -- return 0
23+
jmp .Finish
24+
.align 8
25+
.Locked:
26+
movq $1,%rax /no, we didn't get it - return 1
27+
.Finish:
28+
popq %rbx /restore prev bx
29+
movq %rbp,%rsp /restore stack state
30+
popq %rbp
31+
ret /return
32+
.align 8
33+
.type tas,@function
34+
.size tas,.-tas
35+

src/include/storage/s_lock.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
6767
* Portions Copyright (c) 1994, Regents of the University of California
6868
*
69-
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.145 2005/12/17 21:08:24 momjian Exp $
69+
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.146 2005/12/30 21:43:41 momjian Exp $
7070
*
7171
*-------------------------------------------------------------------------
7272
*/
@@ -791,7 +791,8 @@ typedef unsigned char slock_t;
791791

792792
/* out-of-line assembler from src/backend/port/tas/foo.s */
793793

794-
#if defined(__sun) && defined(__i386) /* i386 using Sun compiler */
794+
/* i386/X86_64 using Sun compiler */
795+
#if defined(__sun) && (defined(__i386) || defined(__x86_64__))
795796
/*
796797
* Solaris/386 (we only get here for non-gcc case)
797798
*/

src/template/solaris

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ case $host in
1717
;;
1818
i?86-*-solaris*)
1919
if test "$GCC" != yes ; then
20-
need_tas=yes
21-
tas_file=solaris_i386.s
20+
soarch=`isainfo`
21+
if isainfo | grep amd64
22+
then
23+
need_tas=yes
24+
tas_file=solaris_x86_64.s
25+
else
26+
need_tas=yes
27+
tas_file=solaris_i386.s
28+
fi
2229
fi
2330
;;
2431
esac

0 commit comments

Comments
 (0)