Re: solaris build problem with Sun compilers - Mailing list pgsql-ports
| From | Bruce Momjian |
|---|---|
| Subject | Re: solaris build problem with Sun compilers |
| Date | |
| Msg-id | 200605180004.k4I04Hj09317@candle.pha.pa.us Whole thread Raw |
| In response to | Re: solaris build problem with Sun compilers (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Responses |
Re: solaris build problem with Sun compilers
|
| List | pgsql-ports |
Bruce Momjian wrote:
> Tom Lane wrote:
> > Alan Stange <stange@rentec.com> writes:
> > > I believe the trick here is that Solaris 10 will only run on v9 hardware
> > > (or the sun4u systems), which all have the instruction. But the v8 ABI
> > > "model" doesn't have it. So, in some sense the ABI doesn't "allow"
> > > this instruction, but the hardware does, so they can just slam it in
> > > knowing that it'll work.
> >
> > Well, that might be OK for Sun's compiler since they know what a given
> > version of Solaris will run on. But I don't think we can adopt the same
> > attitude for our gcc code path; that has to work on Sparc-based Linuxen
> > and BSDen. I don't think it's appropriate to kiss off support for v8
> > chips when we haven't seen any proof at all of a performance boost in
> > return.
> >
> > Maybe the right answer is to leave the code as-is, ie, deliberately not
> > the same for Sun and gcc compilers.
>
> OK, I have applied the following patch which documents that the Solaris
> CC TAS ASM only works for sparc9. Hopefully either sparc8 is not needed
> (unlikely) or someone will fix it. I have CC'ed the original
> contributor who added "cas".
Oh, I just found this email that has a simplified sparc8 asm:
http://archives.postgresql.org/pgsql-ports/2006-05/msg00025.php
Attached is the new solaris_sparc.s file with the #ifdef sparc8 test;
applied.
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
!=======================================================================
! solaris_sparc.s -- compare and swap for solaris_sparc
!=======================================================================
! Fortunately the Sun compiler can process cpp conditionals with -P
! '/' is the comment for x86, while '!' is the comment for Sparc
#if defined(__sparcv9) || defined(__sparc)
.section ".text"
.align 8
.skip 24
.align 4
.global pg_atomic_cas
pg_atomic_cas:
! "cas" only works on sparcv9 chips, and requies a compiler
! that is targeting sparcv9. It will fail on a compiler
! targeting sparcv8, and of course will not be understood
! by a sparcv8 CPU. gcc continues to use "ldstub" because
! there is no indication which sparc version it is targeting.
!
! There actually is a trick for embedding "cas" for a compiler
! that is targeting sparcv8:
!
! http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/sparc/threads/sparc.il
#ifdef __sparcv9
cas [%o0],%o2,%o1
#else
ldstub [%o0],%o1
#endif
mov %o1,%o0
retl
nop
.type pg_atomic_cas,2
.size pg_atomic_cas,(.-pg_atomic_cas)
#endif
pgsql-ports by date: