Bring us into the i386/ELF world. From Kurt Miller <truk@optonline.net>.

This commit is contained in:
naddy 2003-08-17 01:06:57 +00:00
parent 6637f37428
commit cdef03c574
5 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-build_bsd_sun_audio_GNUmakefile,v 1.1 2003/08/17 01:06:57 naddy Exp $
--- build/bsd/sun/audio/GNUmakefile.orig Fri Jul 11 07:50:22 2003
+++ build/bsd/sun/audio/GNUmakefile Fri Jul 11 07:51:01 2003
@@ -51,7 +51,7 @@ include $(BUILDDIR)/makefiles/Defs.gmk
# make sure we link the math.h with the floor() funciton
#
ifdef LIBRARY
- LDLIBS_COMMON += -lc
+ LDLIBS_COMMON += -lc -lossaudio
endif
# These are used below by the AudioEnvironment class.

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_bsd_hpi_green_threads_src_synch_c,v 1.1 2003/08/17 01:06:57 naddy Exp $
--- src/bsd/hpi/green_threads/src/synch.c.orig Mon Jul 7 21:13:24 2003
+++ src/bsd/hpi/green_threads/src/synch.c Mon Jul 7 21:14:01 2003
@@ -38,7 +38,7 @@ typedef struct memcall {
memfunc_t addr;
} memcall_t;
-#if (defined(__FreeBSD__) && (__FreeBSD__ < 3)) || defined(__OpenBSD__)
+#if (defined(__FreeBSD__) && (__FreeBSD__ < 3)) || (defined(__OpenBSD__) && !defined (__ELF__))
#define UNDERS "_"
#else
#define UNDERS ""

View File

@ -0,0 +1,54 @@
$OpenBSD: patch-src_bsd_hpi_src_linker_md_c,v 1.1 2003/08/17 01:06:57 naddy Exp $
--- src/bsd/hpi/src/linker_md.c.orig Sun Jun 8 10:43:23 2003
+++ src/bsd/hpi/src/linker_md.c Sun Jun 8 10:50:44 2003
@@ -251,6 +251,42 @@ char *
dlfname(const void *addr)
{
#if defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD__ < 3))
+#ifdef __ELF__
+ int tag;
+ Elf_Dyn *dp;
+ struct link_map *lm;
+ Elf_Ehdr *ehdr;
+ Elf_Phdr *phdr;
+ char *s;
+ int i;
+
+ for (dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++) {
+ if (tag == DT_DEBUG) {
+ lm = ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
+ }
+ }
+
+ for (; lm != NULL; lm = lm->l_next) {
+ ehdr = (Elf_Ehdr *)lm->l_addr;
+ if (ehdr == NULL)
+ continue;
+
+ phdr = (Elf_Phdr *)((char *)lm->l_addr + ehdr->e_phoff);
+
+ for (i = 0; i < ehdr->e_phnum; i++) {
+ switch (phdr[i].p_type) {
+ case PT_LOAD:
+ s = (char *)phdr[i].p_vaddr + (int)lm->l_addr;
+ if (addr >= s && addr < s + phdr[i].p_memsz)
+ return lm->l_name;
+ break;
+ default:
+ }
+ }
+ }
+
+ return NULL;
+#else
struct so_map *so_map;
so_map = (struct so_map *)dlopen(0, RTLD_LAZY);
@@ -262,6 +298,7 @@ dlfname(const void *addr)
}
}
return so_map ? so_map->som_path : NULL;
+#endif
#else
Obj_Entry * so_map;

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-src_bsd_javavm_runtime_javai_md_c,v 1.1 2003/08/17 01:06:57 naddy Exp $
--- src/bsd/javavm/runtime/javai_md.c.orig Tue Jul 8 13:04:37 2003
+++ src/bsd/javavm/runtime/javai_md.c Thu Jul 10 10:47:31 2003
@@ -28,6 +28,12 @@
#define HPI_DLL "libhpi.so"
#endif
+#if defined(__OpenBSD__) && !defined(__ELF__)
+#define BSD_C_SYM(x) ("_" ## x)
+#else
+#define BSD_C_SYM(x) x
+#endif
+
void *
InitializeHPI(void *args)
{
@@ -71,11 +77,7 @@ InitializeHPI(void *args)
goto bail;
}
DLL_Initialize = (jint (JNICALL *)(GetInterfaceFunc *, void *))
-#if defined(__OpenBSD__)
- dlsym(hpi_handle, "_DLL_Initialize");
-#else
- dlsym(hpi_handle, "DLL_Initialize");
-#endif
+ dlsym(hpi_handle, BSD_C_SYM("DLL_Initialize"));
if (DLL_Initialize == NULL ||
(*DLL_Initialize)(&getintf, args) < 0) {
goto bail;
@@ -104,7 +106,7 @@ GetPropertiesMD()
#if defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD__ < 3))
#ifdef __OpenBSD__
strcpy(buf, dlfname(dlsym(dlopen(JVM_DLL, RTLD_LAZY),
- "_GetPropertiesMD")));
+ BSD_C_SYM("GetPropertiesMD"))));
#else
strcpy(buf, dlfname(dlsym(0, "_GetPropertiesMD")));
#endif

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-src_bsd_tools_hprof_hprof_md_c,v 1.1 2003/08/17 01:06:57 naddy Exp $
--- src/bsd/tools/hprof/hprof_md.c.orig Tue Jul 8 13:04:39 2003
+++ src/bsd/tools/hprof/hprof_md.c Thu Jul 10 10:52:20 2003
@@ -25,6 +25,12 @@
#include "jlong.h"
#include "hprof.h"
+#if defined(__OpenBSD__) && !defined(__ELF__)
+#define BSD_C_SYM(x) ("_" ## x)
+#else
+#define BSD_C_SYM(x) x
+#endif
+
int hprof_send(int s, const char *msg, int len, int flags)
{
int res;
@@ -71,7 +77,7 @@ void hprof_get_prelude_path(char *path)
dladdr((void *)hprof_get_prelude_path, &dlinfo);
strcpy(home_dir, (char *)dlinfo.dli_fname);
#else
- strcpy(home_dir, dlsym(0, "_hprof_get_prelude_path"));
+ strcpy(home_dir, dlsym(0, BSD_C_SYM("hprof_get_prelude_path")));
#endif
*(strrchr(home_dir, '/')) = '\0';
*(strrchr(home_dir, '/')) = '\0';