Sun inline assembler ...

Lists: pgsql-bugs
From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Sun inline assembler ...
Date: 2005-07-07 14:53:16
Message-ID: 42CD41DC.8080705@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

I have some minor troubles when using the Sun Compiler 9 on Solaris 9.
The spinlock assembler code is somehow broken for Solaris 9 and Solaris
10 (it works for Sun CC 8).

The following patch fixes this:

[hs(at)localhost postgresql-8.0.1]$ cd src/backend/storage/lmgr/
[hs(at)localhost lmgr]$ diff s_lock.c /tmp/fixed_s_lock.c
248,249c248,249
< asm(".section \"data\"");
< asm(".section \"text\"");
---
> asm(".seg \"data\"");
> asm(".seg \"text\"");

Can other folks build on Sun Studio 9? How would GCC treat that patch?
Did anybody encounter similar problems?

Best regards,

Hans


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Sun inline assembler ...
Date: 2005-07-07 15:08:36
Message-ID: 20050707150836.GA62520@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thu, Jul 07, 2005 at 04:53:16PM +0200, Hans-Jürgen Schönig wrote:
> I have some minor troubles when using the Sun Compiler 9 on Solaris 9.
> The spinlock assembler code is somehow broken for Solaris 9 and Solaris
> 10 (it works for Sun CC 8).
>
> The following patch fixes this:
>
> [hs(at)localhost postgresql-8.0.1]$ cd src/backend/storage/lmgr/
> [hs(at)localhost lmgr]$ diff s_lock.c /tmp/fixed_s_lock.c
> 248,249c248,249
> < asm(".section \"data\"");
> < asm(".section \"text\"");
> ---
> > asm(".seg \"data\"");
> > asm(".seg \"text\"");

There's already an #ifdef around that code -- is it not matching
correctly for your compiler? Here's what I see in REL8_0_STABLE
and in HEAD (s_lock.c 1.35):

244 #ifdef SUNOS4_CC
245 asm(".seg \"data\"");
246 asm(".seg \"text\"");
247 #else
248 asm(".section \"data\"");
249 asm(".section \"text\"");
250 #endif

This looks like the thread that led to the above code:

http://archives.postgresql.org/pgsql-patches/2004-12/msg00213.php

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Sun inline assembler ...
Date: 2005-07-07 15:20:54
Message-ID: 42CD4856.5080501@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

I have seen that.
The question is: Gcc seems to get it right ;).
In my little world two compiler should handle this the same but I have
learned that Sun is in many cases different world ...
1+1 is always 2 - on Sun it could also be 3 ;).

hans

Michael Fuhr wrote:
> On Thu, Jul 07, 2005 at 04:53:16PM +0200, Hans-Jürgen Schönig wrote:
>
>>I have some minor troubles when using the Sun Compiler 9 on Solaris 9.
>>The spinlock assembler code is somehow broken for Solaris 9 and Solaris
>>10 (it works for Sun CC 8).
>>
>>The following patch fixes this:
>>
>>[hs(at)localhost postgresql-8.0.1]$ cd src/backend/storage/lmgr/
>>[hs(at)localhost lmgr]$ diff s_lock.c /tmp/fixed_s_lock.c
>>248,249c248,249
>>< asm(".section \"data\"");
>>< asm(".section \"text\"");
>>---
>>
>>> asm(".seg \"data\"");
>>> asm(".seg \"text\"");
>
>
> There's already an #ifdef around that code -- is it not matching
> correctly for your compiler? Here's what I see in REL8_0_STABLE
> and in HEAD (s_lock.c 1.35):
>
> 244 #ifdef SUNOS4_CC
> 245 asm(".seg \"data\"");
> 246 asm(".seg \"text\"");
> 247 #else
> 248 asm(".section \"data\"");
> 249 asm(".section \"text\"");
> 250 #endif
>
> This looks like the thread that led to the above code:
>
> http://archives.postgresql.org/pgsql-patches/2004-12/msg00213.php
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Sun inline assembler ...
Date: 2005-07-07 15:27:44
Message-ID: 8510.1120750064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

>> Here's what I see in REL8_0_STABLE
>> and in HEAD (s_lock.c 1.35):
>>
>> 244 #ifdef SUNOS4_CC
>> 245 asm(".seg \"data\"");
>> 246 asm(".seg \"text\"");
>> 247 #else
>> 248 asm(".section \"data\"");
>> 249 asm(".section \"text\"");
>> 250 #endif

I see that template/sunos4 adds -DSUNOS4_CC to CFLAGS, but template/solaris
does not. Maybe it should too? I'm not real clear about which platforms
each of those templates gets used on.

regards, tom lane


From: John R Pierce <pierce(at)hogranch(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Sun inline assembler ...
Date: 2005-07-07 17:13:58
Message-ID: 42CD62D6.8080005@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
>>>Here's what I see in REL8_0_STABLE
>>>and in HEAD (s_lock.c 1.35):
>>>
>>>244 #ifdef SUNOS4_CC
>>>245 asm(".seg \"data\"");
>>>246 asm(".seg \"text\"");
>>>247 #else
>>>248 asm(".section \"data\"");
>>>249 asm(".section \"text\"");
>>>250 #endif
>
>
> I see that template/sunos4 adds -DSUNOS4_CC to CFLAGS, but template/solaris
> does not. Maybe it should too? I'm not real clear about which platforms
> each of those templates gets used on.

as a random reminder for those who don't deal with sun... Solaris is SunOS 5.x,
currently 5.9 and now 5.10. To get really confusing, they called it Solaris
2.x up to 2.6 (actually SunOS 5.7), then Solaris 7 was 2.7/5.7

solaris ver sunos ver
Solaris 1.3 SunOS 4.3
Solaris 2.5.1 SunOS 5.5.1
Solaris 2.6 SunOS 5.6
Solaris 7 SunOS 5.7
Solaris 8 SunOS 5.8
Solaris 9 SunOS 5.9

this is nearly as bad as Java versioning.

Java 1.x
Java 2
Java 2.1
Java 2.1.1 -> Java2 release 1.1
Java 2.1.4.2 -> Java2 1.4.2
Java 2.5 -> J2SE 5.0


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Sun inline assembler ...
Date: 2005-07-30 03:04:19
Message-ID: 200507300304.j6U34JQ03362@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


I have applied the following patch to fix this, hopefully.

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

John R Pierce wrote:
> Tom Lane wrote:
> >>>Here's what I see in REL8_0_STABLE
> >>>and in HEAD (s_lock.c 1.35):
> >>>
> >>>244 #ifdef SUNOS4_CC
> >>>245 asm(".seg \"data\"");
> >>>246 asm(".seg \"text\"");
> >>>247 #else
> >>>248 asm(".section \"data\"");
> >>>249 asm(".section \"text\"");
> >>>250 #endif
> >
> >
> > I see that template/sunos4 adds -DSUNOS4_CC to CFLAGS, but template/solaris
> > does not. Maybe it should too? I'm not real clear about which platforms
> > each of those templates gets used on.
>
> as a random reminder for those who don't deal with sun... Solaris is SunOS 5.x,
> currently 5.9 and now 5.10. To get really confusing, they called it Solaris
> 2.x up to 2.6 (actually SunOS 5.7), then Solaris 7 was 2.7/5.7
>
> solaris ver sunos ver
> Solaris 1.3 SunOS 4.3
> Solaris 2.5.1 SunOS 5.5.1
> Solaris 2.6 SunOS 5.6
> Solaris 7 SunOS 5.7
> Solaris 8 SunOS 5.8
> Solaris 9 SunOS 5.9
>
> this is nearly as bad as Java versioning.
>
> Java 1.x
> Java 2
> Java 2.1
> Java 2.1.1 -> Java2 release 1.1
> Java 2.1.4.2 -> Java2 1.4.2
> Java 2.5 -> J2SE 5.0
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
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

Attachment Content-Type Size
unknown_filename text/plain 2.2 KB