diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-11-09 06:16:38 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-11-09 06:16:38 +0000 |
commit | 3021d298beb376bab517369ca4d6418611c6192c (patch) | |
tree | 9585ef9facc3dd111151a84ecf0eb4fc19dac968 /libexec/ld.so | |
parent | e8e9c201e96062d0870dac42b96c590bf9c099e4 (diff) |
Delete superfluous libc reacharounds.
Replace magic numbers with symbolic constants in ldasm.S
Let the kernel do the cacheflush optimization.
from miod@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/m88k/Makefile.inc | 5 | ||||
-rw-r--r-- | libexec/ld.so/m88k/ldasm.S | 17 | ||||
-rw-r--r-- | libexec/ld.so/m88k/rtld_machine.c | 13 |
3 files changed, 15 insertions, 20 deletions
diff --git a/libexec/ld.so/m88k/Makefile.inc b/libexec/ld.so/m88k/Makefile.inc index fb435868c31..96ad47786b4 100644 --- a/libexec/ld.so/m88k/Makefile.inc +++ b/libexec/ld.so/m88k/Makefile.inc @@ -1,7 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.1 2013/01/20 23:01:44 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.2 2018/11/09 06:16:37 guenther Exp $ -LIBCSRCDIR=${.CURDIR}/../../lib/libc CFLAGS += -fpic -CPPFLAGS += -I${LIBCSRCDIR}/arch/m88k - SRCS+= memcpy.c diff --git a/libexec/ld.so/m88k/ldasm.S b/libexec/ld.so/m88k/ldasm.S index 946f9b48826..f28d04b0dbe 100644 --- a/libexec/ld.so/m88k/ldasm.S +++ b/libexec/ld.so/m88k/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.27 2017/09/03 00:14:07 aoyama Exp $ */ +/* $OpenBSD: ldasm.S,v 1.28 2018/11/09 06:16:37 guenther Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -44,13 +44,15 @@ #include <machine/asm.h> #include <sys/syscall.h> +#define AUX_base 7 +#define AUX_entry 9 + /* * ld.so entry point. * On entry: r31 points to the kernel argument struct (argv, argv, environ). * The environment pointers list is followed by an array of AuxInfo * structs filled by the kernel. */ -#define DL_DATA_SIZE (4 * 16) /* 16 * sizeof(ELF_Addr) */ ENTRY(_dl_start) /* * Two nop because execution may skip up to two instructions. @@ -66,7 +68,12 @@ ENTRY(_dl_start) * Get some room for the contiguous AUX pointers array. */ or %r30, %r31, 0 - subu %r31, %r31, DL_DATA_SIZE + subu %r31, %r31, (4 * (AUX_entry + 1)) + + /* + * Align the stack to a 16 byte boundary. + */ + clr %r31, %r31, 4<0> /* * Invoke _dl_boot_bind @@ -83,12 +90,12 @@ ENTRY(_dl_start) ld %r2, %r30, 0 | argc addu %r6, %r30, 4 + 4 lda %r3, %r6[%r2] | envp - ld %r4, %r31, 4 * 7 | ldoff + ld %r4, %r31, 4 * AUX_base| ldoff or %r5, %r31, 0 | array base bsr.n _dl_boot addu %r2, %r30, 4 | argv - addu %r31, %r31, DL_DATA_SIZE + or %r31, %r30, 0 bsr 1f | the following instruction is skipped bcnd eq0, %r0, _dl_dtors | but gives us the pc-relative offset 1: ld.h %r5, %r1, 2 | fetch branch offset (low 16 bits) diff --git a/libexec/ld.so/m88k/rtld_machine.c b/libexec/ld.so/m88k/rtld_machine.c index acbf6d8dce0..3579ebcc349 100644 --- a/libexec/ld.so/m88k/rtld_machine.c +++ b/libexec/ld.so/m88k/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.21 2017/09/09 02:22:48 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.22 2018/11/09 06:16:37 guenther Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -304,17 +304,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) */ if ((!lazy || object->obj_base != 0) && plt_start != 0 && plt_end != 0) { + plt_size = plt_end - plt_start; plt_start += object->obj_base; - plt_end += object->obj_base; - /* - * XXX We round to page granularity, which means - * the cacheflush trap handler will operate on - * entire pages. Maybe we should pass the true - * start+size and let the trap handler decide whether - * to do full pages or only the applicable cachelines? - */ - plt_start = ELF_TRUNC(plt_start, _dl_pagesz); - plt_size = ELF_ROUND(plt_end, _dl_pagesz) - plt_start; } else plt_size = 0; |