Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2013 02:03:13 GMT
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/181126: boost-libs fails to build on ppc64
Message-ID:  <201308080203.r7823DfQ053953@oldred.freebsd.org>
Resent-Message-ID: <201308080210.r782A0E0037351@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181126
>Category:       ports
>Synopsis:       boost-libs fails to build on ppc64
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 08 02:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Justin Hibbits
>Release:        10-CURRENT
>Organization:
>Environment:
>Description:
Bugs in the assembly code in boost cause it to fail to build.  Attached patch fixes this.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- libs/context/src/asm/make_ppc64_sysv_elf_gas.S.old	2013-08-07 18:45:14.000000000 -0700
+++ libs/context/src/asm/make_ppc64_sysv_elf_gas.S	2013-08-07 18:50:41.000000000 -0700
@@ -92,26 +92,20 @@
 .type .make_fcontext,@function
 .globl .make_fcontext
 .make_fcontext:
-    mflr    %r0                 # save return address into R0
-    std     %r0, 8(%r1)         # save return address on stack, set up stack frame
-    stdu    %r1, -96(%r1)       # allocate stack space, SP % 16 == 0
-
-    std     %r5, 64(%r1)        # save 3. arg of make_fcontext, pointer to context function 
-    std     %r4, 56(%r1)        # save 2. arg of make_fcontext, context stack size 
-    std     %r3, 48(%r1)        # save 1. arg of make_fcontext, pointer to context stack (base) 
+    mflr    %r6                 # save return address into R6
 
+    mr		%r0, %r3
     subi    %r3, %r3, 352       # reserve space for fcontext_t at top of context stack
-    bl      align_stack@plt     # call align_stack, R3 contains address at 16 byte boundary after return
-                                # == pointer to fcontext_t and address of context stack
-    ld      %r4, 48(%r1)        # restore pointer to context stack (base)
-    ld      %r5, 56(%r1)        # restore context stack size
-    ld      %r6, 64(%r1)        # restore pointer to context function
 
-    std     %r4, 184(%r3)       # save address of context stack (base) in fcontext_t
+    # call align_stack, R3 contains address at 16 byte boundary after return
+    # == pointer to fcontext_t and address of context stack
+    clrrdi	%r3, %r3, 4
+
+    std     %r0, 184(%r3)       # save address of context stack (base) in fcontext_t
     std     %r5, 192(%r3)       # save context stack size in fcontext_t
     std     %r6, 176(%r3)       # save address of context function in fcontext_t
 
-    subf    %r0, %r3, 64        # 64 bytes on stack for parameter area (== 8 registers)
+    subi    %r0, %r3, 64        # 64 bytes on stack for parameter area (== 8 registers)
     std     %r0, 152(%r3)       # save the stack base
 
     mflr    %r0                 # load LR
@@ -123,9 +117,7 @@
     std     %r4, 168(%r3)            # save address of finish as return address for context function
                                      # entered after context function returns
 
-    addi    %r1, %r1, 64        # deallocate stack space
-    lwz     %r0, 8(%r1)         # load return address from stack, destroy stack frame
-    mtlr    %r0                 # restore return address
+    mtlr    %r6                 # restore return address
 
     blr
 
@@ -136,5 +128,8 @@
     stwu    %r1, -32(%r1)       # allocate stack space, SP % 16 == 0
 
     li      %r3,  0             # set return value to zero
-    bl      _exit@plt           # exit application
+    bl      _exit               # exit application
+    nop
 .size .make_fcontext, .-.make_fcontext
+
+.section .note.GNU-stack,"",%progbits


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308080203.r7823DfQ053953>