From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 6209 invoked from network); 8 Nov 1999 13:33:46 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 8 Nov 1999 13:33:46 -0000 Received: from mailext02.compaq.com (mailext02.compaq.com [207.18.199.33]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA04108 for ; Mon, 8 Nov 1999 08:33:46 -0500 Received: from mailint12.im.hou.compaq.com (mailint12.compaq.com [207.18.199.190]) by mailext02.compaq.com (Postfix) with ESMTP id E7D319A96F for ; Mon, 8 Nov 1999 07:33:45 -0600 (CST) Received: by mailint12.im.hou.compaq.com (Postfix, from userid 12345) id 2F8784FB23; Mon, 8 Nov 1999 07:33:30 -0600 (CST) Received: from quarry.zk3.dec.com (bryquarry.zk3.dec.com [16.141.40.15]) by mailint12.im.hou.compaq.com (Postfix) with ESMTP id DF4F74C901 for ; Mon, 8 Nov 1999 07:33:29 -0600 (CST) Received: from wavy.zk3.dec.com by quarry.zk3.dec.com (8.8.8/1.1.8.2/16Jan95-0946AM) id IAA0000022275; Mon, 8 Nov 1999 08:33:45 -0500 (EST) Received: from zk3.dec.com by wavy.zk3.dec.com (8.8.8/1.1.20.8/09Sep99-1228PM) id IAA0000771426; Mon, 8 Nov 1999 08:33:44 -0500 (EST) Sender: frival@wavy.zk3.dec.com Message-ID: <3826D83F.7B73A97@zk3.dec.com> Date: Mon, 08 Nov 1999 09:03:46 -0500 From: Peter Rival X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-29 alpha) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: Assembly errors with lockmeter References: <381F3A59.B110991E@zk3.dec.com> <19991102121947.A29750@twiddle.net> <381F4C6B.E64E925D@zk3.dec.com> <19991107164713.A7248@twiddle.net> Content-Type: multipart/alternative; boundary="------------7733C59F37D34C45AD4A4F5B" --------------7733C59F37D34C45AD4A4F5B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Richard Henderson wrote: > On Tue, Nov 02, 1999 at 08:41:15PM +0000, Peter Rival wrote: > > mb > > .section .text2,"ax" > > 6: > > .previous > > addl $1,$31,$1 <-- Line 655 > > This fixes it. I do wonder what exactly you're doing with > labels in sections with no code attached to them... > I wonder myself sometimes...;) Basically I was trying to do something like "try to grab the read lock once, and if you fail, bail out". I was just trying to modify read_lock to do something like that. I suppose it would have been better to write it more like this: static __inline__ int _read_try_lock_(void *lock) { long temp,result=0; __asm__ __volatile__( "1: ldl_l %1,%0\n" " blbs %1,6f\n" " subl %1,2,%1\n" " stl_c %1,%0\n" " beq %1,6f\n" " mb\n" ".section .text2,\"ax\"\n" "6: mov %1,%2\n" ".previous" : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result) : "m" (__dummy_lock(lock)) ); return (result != 1); /* Was the lock grabbed? */ } But that looks kinda ugly. I really don't want to unconditionally copy lock into the result, as I've already set the result to zero. Hmmm...any assembly experts have a better take on it? BTW, which tree is this against - 2.95.2 or egcs 1.1.2? Thanks for looking into it! - Pete > > * config/tc-alpha.c (alpha_align): Check, don't assert, that > the previous label was in the current section before playing > with auto-alignment. > > Index: gas/config/tc-alpha.c > =================================================================== > RCS file: /cvs/binutils/binutils/gas/config/tc-alpha.c,v > retrieving revision 1.6 > diff -c -p -d -r1.6 tc-alpha.c > *** tc-alpha.c 1999/10/18 22:29:14 1.6 > --- tc-alpha.c 1999/11/08 00:42:40 > *************** alpha_align (n, pfill, label, force) > *** 4756,4769 **** > > alpha_current_align = n; > > ! if (label != NULL) > { > - assert (S_GET_SEGMENT (label) == now_seg); > symbol_set_frag (label, frag_now); > S_SET_VALUE (label, (valueT) frag_now_fix ()); > } > > ! record_alignment(now_seg, n); > > /* ??? if alpha_flag_relax && force && elf, record the requested alignment > in a reloc for the linker to see. */ > --- 4756,4768 ---- > > alpha_current_align = n; > > ! if (label != NULL && S_GET_SEGMENT (label) == now_seg) > { > symbol_set_frag (label, frag_now); > S_SET_VALUE (label, (valueT) frag_now_fix ()); > } > > ! record_alignment (now_seg, n); > > /* ??? if alpha_flag_relax && force && elf, record the requested alignment > in a reloc for the linker to see. */ > > -- > To unsubscribe: send e-mail to axp-list-request@redhat.com with > 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com --------------7733C59F37D34C45AD4A4F5B Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Richard Henderson wrote:
On Tue, Nov 02, 1999 at 08:41:15PM +0000, Peter Rival wrote:
>         mb
> .section .text2,"ax"
> 6:
> .previous
>         addl $1,$31,$1    <-- Line 655

This fixes it.  I do wonder what exactly you're doing with
labels in sections with no code attached to them...
 

I wonder myself sometimes...;)  Basically I was trying to do something like "try to grab the read lock once, and if you fail, bail out".  I was just trying to modify read_lock to do something like that.  I suppose it would have been better to write it more like this:

static __inline__ int _read_try_lock_(void *lock)
{
        long temp,result=0;
        __asm__ __volatile__(
        "1:     ldl_l %1,%0\n"
        "       blbs %1,6f\n"
        "       subl %1,2,%1\n"
        "       stl_c %1,%0\n"
        "       beq %1,6f\n"
        "       mb\n"
        ".section .text2,\"ax\"\n"
        "6:     mov %1,%2\n"
        ".previous"
        : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result)
        : "m" (__dummy_lock(lock))
        );
        return (result != 1);  /* Was the lock grabbed? */
}

But that looks kinda ugly.  I really don't want to unconditionally copy lock into the result, as I've already set the result to zero.  Hmmm...any assembly experts have a better take on it?  BTW, which tree is this against - 2.95.2 or egcs 1.1.2?  Thanks for looking into it!

 - Pete

 
        * config/tc-alpha.c (alpha_align): Check, don't assert, that
        the previous label was in the current section before playing
        with auto-alignment.

Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-alpha.c,v
retrieving revision 1.6
diff -c -p -d -r1.6 tc-alpha.c
*** tc-alpha.c  1999/10/18 22:29:14     1.6
--- tc-alpha.c  1999/11/08 00:42:40
*************** alpha_align (n, pfill, label, force)
*** 4756,4769 ****

    alpha_current_align = n;

!   if (label != NULL)
      {
-       assert (S_GET_SEGMENT (label) == now_seg);
        symbol_set_frag (label, frag_now);
        S_SET_VALUE (label, (valueT) frag_now_fix ());
      }

!   record_alignment(now_seg, n);

    /* ??? if alpha_flag_relax && force && elf, record the requested alignment
       in a reloc for the linker to see.  */
--- 4756,4768 ----

    alpha_current_align = n;

!   if (label != NULL && S_GET_SEGMENT (label) == now_seg)
      {
        symbol_set_frag (label, frag_now);
        S_SET_VALUE (label, (valueT) frag_now_fix ());
      }

!   record_alignment (now_seg, n);

    /* ??? if alpha_flag_relax && force && elf, record the requested alignment
       in a reloc for the linker to see.  */

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

--------------7733C59F37D34C45AD4A4F5B--