Re: [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Pierre Girard <pierre(dot)girard(at)gerad(dot)ca>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native
Date: 2005-12-30 21:44:47
Message-ID: 200512302144.jBULilN15358@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


I have applied your patch with only minor comment additions. Let us
know if additional changes are required. Thanks.

Are these flags required to be supplied to configure, or just the ASM
file?

-Xa -xtarget=opteron -xarch=amd64

I am thinking the port isn't 100% fool-proof yet, but it is _much_
closer than it was, and people can now do testing to improve it.

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

Pierre Girard wrote:
> Bruce Momjian wrote:
>
> >Interesting. Seems you have a setup that uses its own assembly source
> >file in port/tas/solaris_i386.s, rather than using inline C ASM. There
> >are files for both Sparc and i386 there, and are both used only for the
> >Sun compiler. Does the Sun compiler not support ASM inlining?
> >
> >
> I don't know but i imagine that if the postgresql team decided to do it
> that way it's probably not supported.
>
> >I also modified the function alignment from 4 to 8, patch
> >attached. Please give it a try and report back any error lines.
> >
> >
> I applied the patch and now the solaris_i386.s file compiles fine with
> the command:
> cc -Xa -xtarget=opteron -xarch=amd64 -c solaris_i386.s
>
> I made a few changes and was able to compile postgresql completely but i
> don't think we'll be trying it until after the holidays. I included
> the small changes i made but i'm sure you can make a much better job
> than i did.
>
> >Seems Sun might be interested in geting this working. We don't have an
> >official Sun contact yet for this project.
> >
> >
> Given this announcement, i'm surprised that you don't have a contact
> already:
> http://www.sun.com/smi/Press/sunflash/2005-11/sunflash.20051117.1.html
>
> Happy holidays everyone.
>

> diff -Naur postgresql-8.1.1/src/Makefile.shlib postgresql-8.1.1.new/src/Makefile.shlib
> --- postgresql-8.1.1/src/Makefile.shlib Sat Dec 3 15:16:39 2005
> +++ postgresql-8.1.1.new/src/Makefile.shlib Fri Dec 23 10:04:58 2005
> @@ -193,7 +193,7 @@
> ifeq ($(GCC), yes)
> LINK.shared = $(CC) -shared
> else
> - LINK.shared = $(CC) -G
> + LINK.shared = $(CC) -G $(CFLAGS)
> endif
> ifeq ($(with_gnu_ld), yes)
> LINK.shared += -Wl,-soname,$(soname)
> diff -Naur postgresql-8.1.1/src/backend/port/tas/solaris_x86_64.s postgresql-8.1.1.new/src/backend/port/tas/solaris_x86_64.s
> --- postgresql-8.1.1/src/backend/port/tas/solaris_x86_64.s Wed Dec 31 19:00:00 1969
> +++ postgresql-8.1.1.new/src/backend/port/tas/solaris_x86_64.s Fri Dec 23 09:17:13 2005
> @@ -0,0 +1,33 @@
> +/=============================================================================
> +/ tas.s -- test and set lock for solaris_i386
> +/=============================================================================
> +
> + .file "tas.s"
> + .text
> + .align 16
> +.L1.text:
> +
> + .globl tas
> +tas:
> + pushq %rbp /save prev base pointer
> + movq %rsp,%rbp /new base pointer
> + pushq %rbx /save prev bx
> + movq 8(%rbp),%rbx /load bx with address of lock
> + movq $255,%rax /put something in ax
> + xchgb %al,(%rbx) /swap lock value with "0"
> + cmpb $0,%al /did we get the lock?
> + jne .Locked
> + subq %rax,%rax /yes, we got it -- return 0
> + jmp .Finish
> + .align 8
> +.Locked:
> + movq $1,%rax /no, we didn't get it - return 1
> +.Finish:
> + popq %rbx /restore prev bx
> + movq %rbp,%rsp /restore stack state
> + popq %rbp
> + ret /return
> + .align 8
> + .type tas,@function
> + .size tas,.-tas
> +
> diff -Naur postgresql-8.1.1/src/include/storage/s_lock.h postgresql-8.1.1.new/src/include/storage/s_lock.h
> --- postgresql-8.1.1/src/include/storage/s_lock.h Tue Oct 11 16:41:32 2005
> +++ postgresql-8.1.1.new/src/include/storage/s_lock.h Fri Dec 23 09:18:44 2005
> @@ -788,7 +788,7 @@
>
> /* out-of-line assembler from src/backend/port/tas/foo.s */
>
> -#if defined(__sun) && defined(__i386)
> +#if defined(__sun) && (defined(__i386) || defined(__x86_64__))
> /*
> * Solaris/386 (we only get here for non-gcc case)
> */
> diff -Naur postgresql-8.1.1/src/template/solaris postgresql-8.1.1.new/src/template/solaris
> --- postgresql-8.1.1/src/template/solaris Fri Jul 29 13:00:29 2005
> +++ postgresql-8.1.1.new/src/template/solaris Fri Dec 23 09:43:08 2005
> @@ -17,8 +17,15 @@
> ;;
> i?86-*-solaris*)
> if test "$GCC" != yes ; then
> - need_tas=yes
> - tas_file=solaris_i386.s
> + soarch=`isainfo`
> + if isainfo | grep amd64
> + then
> + need_tas=yes
> + tas_file=solaris_x86_64.s
> + else
> + need_tas=yes
> + tas_file=solaris_i386.s
> + fi
> fi
> ;;
> esac

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-12-30 22:55:23 Re: TODO item: list prepared queries
Previous Message Simon Riggs 2005-12-30 13:35:37 Re: [HACKERS] Online backup vs Continuous backup