summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2010-01-25 05:18:35 +0000
committermiod <miod@openbsd.org>2010-01-25 05:18:35 +0000
commite44a76992d699479dfc34f7e7663f80e4dca15a7 (patch)
tree273e442d44006b31fa5ac8437049031542c1f0c4
parentRedraw properly when scrolling backward and the cursor is on the last (diff)
downloadwireguard-openbsd-e44a76992d699479dfc34f7e7663f80e4dca15a7.tar.xz
wireguard-openbsd-e44a76992d699479dfc34f7e7663f80e4dca15a7.zip
Provide proper ELF64_R_{SYM,TYPE,INFO} on little endian mips64, since these
do not follow the regular layout. Makes ld.so much happier on loongson. ok drahn@
-rw-r--r--sys/sys/exec_elf.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/sys/exec_elf.h b/sys/sys/exec_elf.h
index 72c4a5b2568..0f722d9e2cf 100644
--- a/sys/sys/exec_elf.h
+++ b/sys/sys/exec_elf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.h,v 1.44 2009/03/05 19:52:24 kettenis Exp $ */
+/* $OpenBSD: exec_elf.h,v 1.45 2010/01/25 05:18:35 miod Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
@@ -370,6 +370,20 @@ typedef struct {
#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
#define ELF64_R_INFO(s,t) (((s) << 32) + (__uint32_t)(t))
+#if defined(__mips64__) && defined(__MIPSEL__)
+/*
+ * The 64-bit MIPS ELF ABI uses a slightly different relocation format
+ * than the regular ELF ABI: the r_info field is split into several
+ * pieces (see gnu/usr.bin/binutils/include/elf/mips.h for details).
+ */
+#undef ELF64_R_SYM
+#undef ELF64_R_TYPE
+#undef ELF64_R_INFO
+#define ELF64_R_TYPE(info) (swap32((info) >> 32))
+#define ELF64_R_SYM(info) ((info) & 0xFFFFFFFF)
+#define ELF64_R_INFO(s,t) ((swap32(t) << 32) + (__uint32_t)(s))
+#endif /* __mips64__ && __MIPSEL__ */
+
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */