From cc13fe98cb400f339a309432d9e83070905fdecc Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 31 Jul 1996 06:22:41 +0000 Subject: [PATCH] Fix for dynamically linked functions returning structs. PR#2586/Pfaller --- gnu/usr.bin/ld/arch/ns32k/mdprologue.S | 18 ++++++++++-------- gnu/usr.bin/ld/ns32k/mdprologue.S | 18 ++++++++++-------- libexec/ld.aout_so/arch/ns32k/mdprologue.S | 18 ++++++++++-------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/gnu/usr.bin/ld/arch/ns32k/mdprologue.S b/gnu/usr.bin/ld/arch/ns32k/mdprologue.S index 4b4a4a4aeaa0..3af63242c149 100644 --- a/gnu/usr.bin/ld/arch/ns32k/mdprologue.S +++ b/gnu/usr.bin/ld/arch/ns32k/mdprologue.S @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mdprologue.S,v 1.3 1995/05/29 18:11:35 phil Exp $ + * $Id: mdprologue.S,v 1.4 1996/07/31 06:22:41 phil Exp $ */ /* @@ -64,11 +64,13 @@ _rtl_entry: */ _binder_entry: - movd tos,r1 /* grab return address (within PLT) */ - movd r0,tos /* save r0 (for cerror) */ - movzwd 0(r1),tos /* get function index */ - addr -6(r1),tos /* point to PLT slot */ + save [r0,r1,r2] /* preserve scratch registers */ + /* save r0 (for cerror) */ + /* save r1 (maybe static chain) */ + /* save r2 (maybe struct addr) */ + addr -6(12(sp)),tos /* push address of PLT slot */ bsr _binder /* relocate function address */ - movd r0,tos /* prepare for jump */ - movd 12(sp),r0 /* restore r0 */ - ret 12 /* jump into function */ + cmpqd 0,tos + movd r0,12(sp) /* prepare for jump */ + restore [r0,r1,r2] /* restore scratch registers */ + ret 0 /* jump into function */ diff --git a/gnu/usr.bin/ld/ns32k/mdprologue.S b/gnu/usr.bin/ld/ns32k/mdprologue.S index 4b4a4a4aeaa0..3af63242c149 100644 --- a/gnu/usr.bin/ld/ns32k/mdprologue.S +++ b/gnu/usr.bin/ld/ns32k/mdprologue.S @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mdprologue.S,v 1.3 1995/05/29 18:11:35 phil Exp $ + * $Id: mdprologue.S,v 1.4 1996/07/31 06:22:41 phil Exp $ */ /* @@ -64,11 +64,13 @@ _rtl_entry: */ _binder_entry: - movd tos,r1 /* grab return address (within PLT) */ - movd r0,tos /* save r0 (for cerror) */ - movzwd 0(r1),tos /* get function index */ - addr -6(r1),tos /* point to PLT slot */ + save [r0,r1,r2] /* preserve scratch registers */ + /* save r0 (for cerror) */ + /* save r1 (maybe static chain) */ + /* save r2 (maybe struct addr) */ + addr -6(12(sp)),tos /* push address of PLT slot */ bsr _binder /* relocate function address */ - movd r0,tos /* prepare for jump */ - movd 12(sp),r0 /* restore r0 */ - ret 12 /* jump into function */ + cmpqd 0,tos + movd r0,12(sp) /* prepare for jump */ + restore [r0,r1,r2] /* restore scratch registers */ + ret 0 /* jump into function */ diff --git a/libexec/ld.aout_so/arch/ns32k/mdprologue.S b/libexec/ld.aout_so/arch/ns32k/mdprologue.S index 4b4a4a4aeaa0..3af63242c149 100644 --- a/libexec/ld.aout_so/arch/ns32k/mdprologue.S +++ b/libexec/ld.aout_so/arch/ns32k/mdprologue.S @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mdprologue.S,v 1.3 1995/05/29 18:11:35 phil Exp $ + * $Id: mdprologue.S,v 1.4 1996/07/31 06:22:41 phil Exp $ */ /* @@ -64,11 +64,13 @@ _rtl_entry: */ _binder_entry: - movd tos,r1 /* grab return address (within PLT) */ - movd r0,tos /* save r0 (for cerror) */ - movzwd 0(r1),tos /* get function index */ - addr -6(r1),tos /* point to PLT slot */ + save [r0,r1,r2] /* preserve scratch registers */ + /* save r0 (for cerror) */ + /* save r1 (maybe static chain) */ + /* save r2 (maybe struct addr) */ + addr -6(12(sp)),tos /* push address of PLT slot */ bsr _binder /* relocate function address */ - movd r0,tos /* prepare for jump */ - movd 12(sp),r0 /* restore r0 */ - ret 12 /* jump into function */ + cmpqd 0,tos + movd r0,12(sp) /* prepare for jump */ + restore [r0,r1,r2] /* restore scratch registers */ + ret 0 /* jump into function */