You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2013/04/13 15:19:51 UTC

[Bug 54840] New: atomics/unix/ppc.c won't compile on OS X

https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

            Bug ID: 54840
           Summary: atomics/unix/ppc.c won't compile on OS X
           Product: APR
           Version: 1.4.6
          Hardware: Macintosh
                OS: Mac OS X 10.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: mattiase@acm.org
    Classification: Unclassified

The inline asm routines in atomics/unix/ppc.c won't compile on OS X 10.5:

ld: bcc out of range (83248 max is +/-64K) from _apr_atomic_add32 in
atomic/unix/.libs/ppc.o to _apr_atomic_add32$stub in .libs/libapr-1.0.dylib in
_apr_atomic_add32 from atomic/unix/.libs/ppc.o

The reason for this is that in the code

    asm volatile ("loop_%=:\n"                  /* lost reservation     */
                  "    lwarx   %0,0,%3\n"      /* load and reserve     */
                  "    add     %1,%0,%4\n"     /* add val and prev     */
                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
                  "    stwcx.  %1,0,%3\n"      /* store new value      */
                  "    bne-    loop_%=\n"      /* loop if lost         */

the label loop_%= doesn't work properly. Replacing it with traditional local
labels (1, 2, ...) works nicely. Any reason it was not done that way?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #3 from Stefan Fritsch <sf...@sfritsch.de> ---
I have no idea of ppc assembler, but:

Shouldn't atomics/unix/builtins.c be used instead of atomics/unix/ppc.c if your
compiler is gcc? Have you changed anything to use ppc.c instead, or is this a
bug in APR's configure script?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #5 from Stefan Fritsch <sf...@sfritsch.de> ---
Right, atomic builtins were added in 4.1. I thought they were older

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #7 from Mattias Engdegård <ma...@acm.org> ---
(In reply to comment #6)
> trunk: r1470186
> 1.5: r1470189
> 1.4: r1470192
> 
> will be fixed in 1.4.7 or 1.5.0, whichever comes first.

Thanks! May I suggest you have a look at bug 51851 too? It's the x86
equivalent.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

Stefan Fritsch <sf...@sfritsch.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk

--- Comment #6 from Stefan Fritsch <sf...@sfritsch.de> ---
trunk: r1470186
1.5: r1470189
1.4: r1470192

will be fixed in 1.4.7 or 1.5.0, whichever comes first.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #2 from Mattias Engdegård <ma...@acm.org> ---
For the record, %= in inline asm generates a unique number. From the gcc
sources:

        /* %= outputs a number which is unique to each insn in the entire
           compilation.  This is useful for making local labels that are
           referred to more than once in a given insn.  */

(I couldn't find it actually documented anywhere else.) The problem in this
case stems from the fact that the system compiler in OS X 10.5, gcc 4.0.1, does
not have that feature so a literal "%=" is inserted. However, there should be
no need for that since local labels work nicely.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #4 from Mattias Engdegård <ma...@acm.org> ---
(In reply to comment #3)
> I have no idea of ppc assembler, but:

PPC assembler is no different from any other in this respect.

> Shouldn't atomics/unix/builtins.c be used instead of atomics/unix/ppc.c if
> your compiler is gcc? Have you changed anything to use ppc.c instead, or is
> this a bug in APR's configure script?

The GCC builtins will only be used if the compiler has them, and this
particular GCC version (4.0.1, the standard compiler of OS X 10.5) does not.
See the detection of HAVE_ATOMIC_BUILTINS in configure.in.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Jeff Trawick <tr...@apache.org> ---
Fixed in apr 1.4.7 and later releases.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 54840] atomics/unix/ppc.c won't compile on OS X

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54840

--- Comment #1 from Mattias Engdegård <ma...@acm.org> ---
Created attachment 30188
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30188&action=edit
patch to use local labels in ppc.c

Here is a patch that corrects the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org