From e6b13790faff8d1f8118628b4242f9c69503092d Mon Sep 17 00:00:00 2001 From: scw Date: Wed, 26 Mar 2003 14:46:32 +0000 Subject: [PATCH] SH5 needs __HAVE_FUNCTION_DESCRIPTORS defined in order for ld.elf_so to resolve SHmedia function pointers correctly. --- libexec/ld.elf_so/arch/sh5/mdreloc.c | 26 +++++++++++++++++++++++++- sys/arch/sh5/include/types.h | 3 ++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/libexec/ld.elf_so/arch/sh5/mdreloc.c b/libexec/ld.elf_so/arch/sh5/mdreloc.c index 13558579e1d0..f74186d625f7 100644 --- a/libexec/ld.elf_so/arch/sh5/mdreloc.c +++ b/libexec/ld.elf_so/arch/sh5/mdreloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.1 2003/03/25 13:11:54 scw Exp $ */ +/* $NetBSD: mdreloc.c,v 1.2 2003/03/26 14:46:32 scw Exp $ */ #include #include @@ -166,3 +166,27 @@ _rtld_bind(const Obj_Entry *obj, Elf_Word reloff) return (caddr_t)new_value; } + +Elf_Addr +_rtld_function_descriptor_alloc(const Obj_Entry *obj, const Elf_Sym *def, + Elf_Addr addend) +{ + Elf_Addr pc; + + pc = (Elf_Addr)(obj->relocbase + addend); + + if (def) { + pc += def->st_value; + if (def->st_other & STO_SH5_ISA32) + pc |= 1; + } + + return (pc); +} + +const void * +_rtld_function_descriptor_function(const void *addr) +{ + + return (addr); +} diff --git a/sys/arch/sh5/include/types.h b/sys/arch/sh5/include/types.h index f2732df10bb8..e86d07dc0fd2 100644 --- a/sys/arch/sh5/include/types.h +++ b/sys/arch/sh5/include/types.h @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.5 2002/10/12 11:39:53 scw Exp $ */ +/* $NetBSD: types.h,v 1.6 2003/03/26 14:46:33 scw Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -78,6 +78,7 @@ typedef struct label_t { #define __HAVE_GENERIC_SOFT_INTERRUPTS #define __HAVE_SYSCALL_INTERN #define __HAVE_RAS +#define __HAVE_FUNCTION_DESCRIPTORS #ifdef notyet #define __HAVE_AST_PERPROC /* Not reqd. until we support SMP */