aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2018-10-09 14:27:55 +0000
committerGlen Barber <gjb@FreeBSD.org>2018-10-09 14:27:55 +0000
commit7c32835287967b56a6bd1f0063bb359ccf1b5f94 (patch)
tree292040b96812ba24f7d09b1271f061cc7f543108 /usr.sbin
parent846803208a184badf765b187e1d164a6e2ff98de (diff)
parent1bcac4ba99c1634ae0b1433262b3d81e120150b3 (diff)
downloadsrc-7c32835287967b56a6bd1f0063bb359ccf1b5f94.tar.gz
src-7c32835287967b56a6bd1f0063bb359ccf1b5f94.zip
MFH r338661 through r339253.
Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/projects/openssl111/; revision=339255
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/mirrorselect2
-rw-r--r--usr.sbin/kldxref/ef_riscv.c78
2 files changed, 79 insertions, 1 deletions
diff --git a/usr.sbin/bsdinstall/scripts/mirrorselect b/usr.sbin/bsdinstall/scripts/mirrorselect
index af87f443653b..717584b440fd 100755
--- a/usr.sbin/bsdinstall/scripts/mirrorselect
+++ b/usr.sbin/bsdinstall/scripts/mirrorselect
@@ -161,7 +161,7 @@ _UNAME_R=`uname -r`
_UNAME_R=${_UNAME_R%-p*}
case ${_UNAME_R} in
- *-CURRENT|*-STABLE|*-PRERELEASE)
+ *-ALPHA*|*-CURRENT|*-STABLE|*-PRERELEASE)
RELDIR="snapshots"
;;
*)
diff --git a/usr.sbin/kldxref/ef_riscv.c b/usr.sbin/kldxref/ef_riscv.c
new file mode 100644
index 000000000000..e0caae3bd286
--- /dev/null
+++ b/usr.sbin/kldxref/ef_riscv.c
@@ -0,0 +1,78 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 John Baldwin <jhb@FreeBSD.org>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/elf.h>
+
+#include <err.h>
+#include <errno.h>
+
+#include "ef.h"
+
+int
+ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
+ Elf_Off dataoff, size_t len, void *dest)
+{
+ Elf_Addr *where, val;
+ const Elf_Rela *rela;
+ Elf_Addr addend, addr;
+ Elf_Size rtype;
+
+ switch (reltype) {
+ case EF_RELOC_RELA:
+ rela = (const Elf_Rela *)reldata;
+ where = (Elf_Addr *)((char *)dest + relbase + rela->r_offset -
+ dataoff);
+ addend = rela->r_addend;
+ rtype = ELF_R_TYPE(rela->r_info);
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ if ((char *)where < (char *)dest || (char *)where >= (char *)dest + len)
+ return (0);
+
+ switch (rtype) {
+ case R_RISCV_RELATIVE: /* B + A */
+ addr = addend + relbase;
+ val = addr;
+ *where = val;
+ break;
+ default:
+ warnx("unhandled relocation type %d", (int)rtype);
+ }
+ return (0);
+}