From b722ba42570161220f25c5d789b5bec8a0166743 Mon Sep 17 00:00:00 2001 From: guenther Date: Sat, 8 Jan 2022 06:49:41 +0000 Subject: [PATCH] Prep .c files for removing the #includes from */archdep.h * replace #include "archdep.h" with #includes of what is used, pulling in "syscall.h", "util.h", and "archdep.h" as needed * delete #include from syscall.h * only pull in to the three files that use _dl_fstat(), forward declare struct stat in syscall.h for the others * NBBY is for macros; just use '8' in dl_printf.c * is only needed on i386; conditionalize it * stop using __LDPGSZ: use _MAX_PAGE_SHIFT (already used by malloc.c) where necessary * delete other bogus #includes, order legit per style: then <*/*>, then <*>, then "*" dir.c improvement from jsg@ ok and testing assistance deraadt@ --- libexec/ld.so/aarch64/rtld_machine.c | 10 ++++------ libexec/ld.so/alpha/rtld_machine.c | 13 +++++-------- libexec/ld.so/amd64/rtld_machine.c | 10 ++++------ libexec/ld.so/arm/rtld_machine.c | 10 ++++------ libexec/ld.so/boot.c | 6 +++--- libexec/ld.so/dir.c | 6 +----- libexec/ld.so/dl_dirname.c | 5 +++-- libexec/ld.so/dl_printf.c | 4 ++-- libexec/ld.so/dl_uname.c | 5 +++-- libexec/ld.so/dlfcn.c | 6 ++---- libexec/ld.so/hppa/rtld_machine.c | 14 +++++--------- libexec/ld.so/i386/rtld_machine.c | 10 ++++------ libexec/ld.so/ldconfig/ld.h | 4 +--- libexec/ld.so/library.c | 6 ++++-- libexec/ld.so/library_mquery.c | 6 ++++-- libexec/ld.so/library_subr.c | 4 ++-- libexec/ld.so/loader.c | 13 ++++++------- libexec/ld.so/m88k/rtld_machine.c | 10 ++++------ libexec/ld.so/malloc.c | 11 +++++------ libexec/ld.so/mips64/rtld_machine.c | 9 ++++----- libexec/ld.so/powerpc/rtld_machine.c | 10 ++++------ libexec/ld.so/powerpc64/rtld_machine.c | 10 ++++------ libexec/ld.so/reallocarray.c | 7 +++---- libexec/ld.so/resolve.c | 7 +++---- libexec/ld.so/riscv64/rtld_machine.c | 10 ++++------ libexec/ld.so/sh/rtld_machine.c | 10 ++++------ libexec/ld.so/sod.c | 12 ++++-------- libexec/ld.so/sparc64/rtld_machine.c | 12 +++++------- libexec/ld.so/strtol.c | 3 ++- libexec/ld.so/syscall.h | 6 ++---- libexec/ld.so/tib.c | 8 ++------ libexec/ld.so/trace.c | 4 ++-- libexec/ld.so/util.c | 6 ++++-- libexec/ld.so/util.h | 5 +++-- 34 files changed, 116 insertions(+), 156 deletions(-) diff --git a/libexec/ld.so/aarch64/rtld_machine.c b/libexec/ld.so/aarch64/rtld_machine.c index eac2a0cd124..9411f3208e8 100644 --- a/libexec/ld.so/aarch64/rtld_machine.c +++ b/libexec/ld.so/aarch64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.20 2020/02/18 12:19:11 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.21 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c index 24029fcad4e..961e142daaf 100644 --- a/libexec/ld.so/alpha/rtld_machine.c +++ b/libexec/ld.so/alpha/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.70 2019/12/07 22:57:47 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.71 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -31,17 +31,14 @@ #define _DYN_LOADER #include -#include -#include +#include #include #include -#include -#include -#include +#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" #define DT_PROC(n) ((n) - DT_LOPROC + DT_NUM) diff --git a/libexec/ld.so/amd64/rtld_machine.c b/libexec/ld.so/amd64/rtld_machine.c index e36b29d2f6b..6c8e9da1cb3 100644 --- a/libexec/ld.so/amd64/rtld_machine.c +++ b/libexec/ld.so/amd64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.39 2019/12/07 22:57:47 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.40 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2002,2004 Dale Rahn @@ -66,15 +66,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c index 6df418b20ea..8a3ee5a9af8 100644 --- a/libexec/ld.so/arm/rtld_machine.c +++ b/libexec/ld.so/arm/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.41 2020/03/13 09:31:26 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.42 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/boot.c b/libexec/ld.so/boot.c index 9bc6986d0aa..d53558bedb2 100644 --- a/libexec/ld.so/boot.c +++ b/libexec/ld.so/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.18 2019/10/20 03:44:49 guenther Exp $ */ +/* $OpenBSD: boot.c,v 1.19 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -36,8 +36,8 @@ #include -#include "syscall.h" -#include "archdep.h" +#include "util.h" +#include "archdep.h" /* for RELOC_TAG */ #include "../../lib/csu/os-note-elf.h" diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c index 574386affda..8f45c62ffc8 100644 --- a/libexec/ld.so/dir.c +++ b/libexec/ld.so/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.24 2017/12/12 07:47:58 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.25 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,16 +28,12 @@ * SUCH DAMAGE. */ -#include #include #include #include -#include -#include #include "syscall.h" -#include "archdep.h" #include "util.h" #include "dir.h" diff --git a/libexec/ld.so/dl_dirname.c b/libexec/ld.so/dl_dirname.c index 2a1b2d6999b..bd8cff3e4b4 100644 --- a/libexec/ld.so/dl_dirname.c +++ b/libexec/ld.so/dl_dirname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_dirname.c,v 1.3 2019/01/25 00:19:26 millert Exp $ */ +/* $OpenBSD: dl_dirname.c,v 1.4 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1997, 2004 Todd C. Miller @@ -18,7 +18,8 @@ #include #include -#include "archdep.h" + +#include "util.h" /* * This file was copied from libc/stdlib/realpath.c and modified for ld.so's diff --git a/libexec/ld.so/dl_printf.c b/libexec/ld.so/dl_printf.c index 2bd20571f3d..330462cbc8a 100644 --- a/libexec/ld.so/dl_printf.c +++ b/libexec/ld.so/dl_printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_printf.c,v 1.21 2017/08/29 15:25:51 deraadt Exp $ */ +/* $OpenBSD: dl_printf.c,v 1.22 2022/01/08 06:49:41 guenther Exp $ */ /*- * Copyright (c) 1993 @@ -230,7 +230,7 @@ static void kprintn(int fd, unsigned long ul, int base) { /* hold a long in base 8 */ - char *p, buf[(sizeof(long) * NBBY / 3) + 1]; + char *p, buf[(sizeof(long) * 8 / 3) + 1]; p = buf; do { diff --git a/libexec/ld.so/dl_uname.c b/libexec/ld.so/dl_uname.c index dd12f50abcd..db5a524d702 100644 --- a/libexec/ld.so/dl_uname.c +++ b/libexec/ld.so/dl_uname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_uname.c,v 1.3 2020/10/15 04:12:43 deraadt Exp $ */ +/* $OpenBSD: dl_uname.c,v 1.4 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. @@ -32,7 +32,8 @@ #include #include -#include "archdep.h" +#include "syscall.h" +#include "util.h" /* * This file was copied from libc/gen/uname.c and modified for ld.so's diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index d0aea8047b8..b3e9862347d 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.108 2021/10/07 14:47:32 jcs Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.109 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include #include #include #include #include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" -#include "sod.h" int _dl_errno; static int _dl_tracelib; diff --git a/libexec/ld.so/hppa/rtld_machine.c b/libexec/ld.so/hppa/rtld_machine.c index 89dd9628370..82c7220725c 100644 --- a/libexec/ld.so/hppa/rtld_machine.c +++ b/libexec/ld.so/hppa/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.42 2019/12/07 22:57:47 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.43 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -32,19 +32,15 @@ #define _DYN_LOADER #include -#include -#include +#include #include +#include #include +#include #include /* SYSCALLGATE */ -#include -#include -#include - -#include "syscall.h" -#include "archdep.h" +#include "util.h" #define _dl_bind XXX_dl_bind #include "resolve.h" #undef _dl_bind diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c index a23a188f3f4..9223d153f83 100644 --- a/libexec/ld.so/i386/rtld_machine.c +++ b/libexec/ld.so/i386/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.48 2019/12/07 22:57:48 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.49 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -66,15 +66,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/ldconfig/ld.h b/libexec/ld.so/ldconfig/ld.h index 868d86ec260..83e00ef5da4 100644 --- a/libexec/ld.so/ldconfig/ld.h +++ b/libexec/ld.so/ldconfig/ld.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.h,v 1.7 2006/05/13 05:59:28 deraadt Exp $ */ +/* $OpenBSD: ld.h,v 1.8 2022/01/08 06:49:42 guenther Exp $ */ /* * Header file to make code compatible with ELF version * ldconfig was taken from the a.out ld. @@ -20,5 +20,3 @@ void add_search_path(char *path); void remove_search_dir(char *name); int getdewey(int dewey[], char *cp); int cmpndewey(int d1[], int n1, int d2[], int n2); - -#define PAGSIZ __LDPGSZ diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index 8e29f4d5280..001c5764162 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.85 2019/12/09 22:15:15 deraadt Exp $ */ +/* $OpenBSD: library.c,v 1.86 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -30,10 +30,12 @@ #define _DYN_LOADER #include -#include #include +#include +#include #include "syscall.h" +#include "util.h" #include "archdep.h" #include "resolve.h" #include "sod.h" diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index c6b1f153c4b..714816e9839 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.65 2021/03/16 18:03:06 kurt Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.66 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -30,10 +30,12 @@ #define _DYN_LOADER #include -#include #include +#include +#include #include "syscall.h" +#include "util.h" #include "archdep.h" #include "resolve.h" #include "sod.h" diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c index 4ffcf44ec1c..206255d8fc8 100644 --- a/libexec/ld.so/library_subr.c +++ b/libexec/ld.so/library_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_subr.c,v 1.50 2019/10/04 17:42:16 guenther Exp $ */ +/* $OpenBSD: library_subr.c,v 1.51 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -34,7 +34,7 @@ #include #include -#include "archdep.h" +#include "util.h" #include "resolve.h" #include "dir.h" #include "sod.h" diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 7fabcf7b3e3..37aee92e602 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.194 2021/12/23 18:50:32 guenther Exp $ */ +/* $OpenBSD: loader.c,v 1.195 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -31,9 +31,9 @@ #include #include #include -#include -#include -#include +#ifdef __i386__ +# include +#endif #include #include #include /* NAME_MAX */ @@ -41,11 +41,10 @@ #include #include "syscall.h" -#include "archdep.h" -#include "path.h" +#include "util.h" #include "resolve.h" +#include "path.h" #include "sod.h" -#include "stdlib.h" /* * Local decls. diff --git a/libexec/ld.so/m88k/rtld_machine.c b/libexec/ld.so/m88k/rtld_machine.c index ca37e5eb2ca..bff0d60c9fd 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.30 2021/12/23 18:50:32 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.31 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -44,15 +44,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int _dl_cacheflush(unsigned long, size_t); diff --git a/libexec/ld.so/malloc.c b/libexec/ld.so/malloc.c index 8c5f9aea4fa..67d90adc206 100644 --- a/libexec/ld.so/malloc.c +++ b/libexec/ld.so/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.33 2021/12/30 08:39:19 guenther Exp $ */ +/* $OpenBSD: malloc.c,v 1.34 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -23,15 +23,14 @@ * can buy me a beer in return. Poul-Henning Kamp */ -#include /* PAGE_SHIFT ALIGN */ +#include /* ALIGN */ #include #include -#include #include -#include -#include "archdep.h" -#include "resolve.h" +#include "syscall.h" +#include "util.h" +#include "resolve.h" /* for lock_cb */ #define MALLOC_PAGESHIFT _MAX_PAGE_SHIFT #define MALLOC_MINSHIFT 4 diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c index 39018e7352c..f43ca85eb81 100644 --- a/libexec/ld.so/mips64/rtld_machine.c +++ b/libexec/ld.so/mips64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.34 2021/11/27 15:13:09 visa Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.35 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 1998-2004 Opsycon AB, Sweden. @@ -29,15 +29,14 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include +#include +#include "util.h" #include "resolve.h" -#include "syscall.h" -#include "archdep.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/powerpc/rtld_machine.c b/libexec/ld.so/powerpc/rtld_machine.c index 3bc6cd2ed2b..4e5a99a8fc7 100644 --- a/libexec/ld.so/powerpc/rtld_machine.c +++ b/libexec/ld.so/powerpc/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.70 2019/12/07 22:57:48 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.71 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" #define DT_PROC(n) ((n) - DT_LOPROC + DT_NUM) diff --git a/libexec/ld.so/powerpc64/rtld_machine.c b/libexec/ld.so/powerpc64/rtld_machine.c index ed798c0f7ce..8100be827ea 100644 --- a/libexec/ld.so/powerpc64/rtld_machine.c +++ b/libexec/ld.so/powerpc64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.6 2021/12/30 04:48:13 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.7 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" #define DT_PROC(n) ((n) - DT_LOPROC + DT_NUM) diff --git a/libexec/ld.so/reallocarray.c b/libexec/ld.so/reallocarray.c index 867dc0dc349..4ef63fbee47 100644 --- a/libexec/ld.so/reallocarray.c +++ b/libexec/ld.so/reallocarray.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reallocarray.c,v 1.2 2017/01/24 07:48:37 guenther Exp $ */ +/* $OpenBSD: reallocarray.c,v 1.3 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * @@ -17,9 +17,8 @@ #include #include -#include -#include -#include "archdep.h" + +#include "util.h" /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index 2879c331c3a..272722c1138 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.96 2021/11/12 22:28:13 guenther Exp $ */ +/* $OpenBSD: resolve.c,v 1.97 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -31,10 +31,9 @@ #include #include -#include #include -#include "syscall.h" -#include "archdep.h" + +#include "util.h" #include "path.h" #include "resolve.h" diff --git a/libexec/ld.so/riscv64/rtld_machine.c b/libexec/ld.so/riscv64/rtld_machine.c index 39ec91bea41..82a47ccf9fb 100644 --- a/libexec/ld.so/riscv64/rtld_machine.c +++ b/libexec/ld.so/riscv64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.2 2021/06/26 14:50:25 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.3 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 2004,2021 Dale Rahn @@ -29,15 +29,13 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/sh/rtld_machine.c b/libexec/ld.so/sh/rtld_machine.c index 7f5c679740f..55ff8e8727f 100644 --- a/libexec/ld.so/sh/rtld_machine.c +++ b/libexec/ld.so/sh/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.33 2019/12/07 22:57:48 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.34 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -30,15 +30,13 @@ #define LDSO_ARCH_IS_RELA_ #include -#include +#include #include #include -#include -#include +#include -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/sod.c b/libexec/ld.so/sod.c index 06ec49bf3aa..6774e9e2340 100644 --- a/libexec/ld.so/sod.c +++ b/libexec/ld.so/sod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sod.c,v 1.35 2017/12/12 15:33:34 deraadt Exp $ */ +/* $OpenBSD: sod.c,v 1.36 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -33,18 +33,14 @@ #include #include -#include +#include + #include -#include #include -#include -#include +#include /* for _PATH_LD_HINTS */ #include -#include -#include #include "syscall.h" -#include "archdep.h" #include "path.h" #include "util.h" #include "sod.h" diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c index a83a99593a8..144c0479451 100644 --- a/libexec/ld.so/sparc64/rtld_machine.c +++ b/libexec/ld.so/sparc64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.68 2019/12/07 22:57:48 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.69 2022/01/08 06:49:42 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -66,16 +66,14 @@ #define _DYN_LOADER #include -#include +#include #include #include -#include -#include -#include +#include +#include /* for ST_SYSCALL */ -#include "syscall.h" -#include "archdep.h" +#include "util.h" #include "resolve.h" int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; diff --git a/libexec/ld.so/strtol.c b/libexec/ld.so/strtol.c index 676c2db6421..ab19489dbad 100644 --- a/libexec/ld.so/strtol.c +++ b/libexec/ld.so/strtol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtol.c,v 1.3 2017/08/16 18:52:01 millert Exp $ */ +/* $OpenBSD: strtol.c,v 1.4 2022/01/08 06:49:41 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -31,6 +31,7 @@ #include #include + #include "util.h" /* diff --git a/libexec/ld.so/syscall.h b/libexec/ld.so/syscall.h index b59540ae945..d23b01d68c1 100644 --- a/libexec/ld.so/syscall.h +++ b/libexec/ld.so/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.1 2021/12/23 18:50:32 guenther Exp $ */ +/* $OpenBSD: syscall.h,v 1.2 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -29,9 +29,6 @@ #ifndef __DL_SYSCALL_H__ #define __DL_SYSCALL_H__ -#include -#include - #ifndef _dl_MAX_ERRNO #define _dl_MAX_ERRNO 512L #endif @@ -39,6 +36,7 @@ ((long)__res < 0 && (long)__res >= -_dl_MAX_ERRNO) struct __kbind; +struct stat; int _dl_close(int); __dead diff --git a/libexec/ld.so/tib.c b/libexec/ld.so/tib.c index 41aafce732d..bb27fb05aff 100644 --- a/libexec/ld.so/tib.c +++ b/libexec/ld.so/tib.c @@ -23,13 +23,9 @@ #include -#include -#include - -#include "archdep.h" -#include "resolve.h" -#include "util.h" #include "syscall.h" +#include "util.h" +#include "resolve.h" /* If we need the syscall, use our local syscall definition */ #define __set_tcb(tcb) _dl___set_tcb(tcb) diff --git a/libexec/ld.so/trace.c b/libexec/ld.so/trace.c index d3f4276cdb8..74f1aee9da5 100644 --- a/libexec/ld.so/trace.c +++ b/libexec/ld.so/trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trace.c,v 1.4 2017/01/24 07:48:37 guenther Exp $ */ +/* $OpenBSD: trace.c,v 1.5 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -19,8 +19,8 @@ #include #include "syscall.h" -#include "resolve.h" #include "util.h" +#include "resolve.h" /* * Library call tracing routines. diff --git a/libexec/ld.so/util.c b/libexec/ld.so/util.c index 08b0490859d..6efcc4bb04a 100644 --- a/libexec/ld.so/util.c +++ b/libexec/ld.so/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.48 2020/10/15 04:12:43 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.49 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -28,7 +28,9 @@ #include #include -#include "archdep.h" + +#include "syscall.h" +#include "util.h" #include "resolve.h" #define KEYSTREAM_ONLY #include "chacha_private.h" diff --git a/libexec/ld.so/util.h b/libexec/ld.so/util.h index 9ba91bdcf78..e4e749a0c83 100644 --- a/libexec/ld.so/util.h +++ b/libexec/ld.so/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.36 2019/07/14 03:23:12 guenther Exp $ */ +/* $OpenBSD: util.h,v 1.37 2022/01/08 06:49:41 guenther Exp $ */ /* * Copyright (c) 1998 Todd C. Miller @@ -74,7 +74,8 @@ __dead void _dl_die(const char *, ...) __attribute__((format (printf, 1, 2))); #define _dl_diedie() _dl_thrkill(0, 9, NULL) __END_HIDDEN_DECLS -#define _dl_round_page(x) (((x) + (__LDPGSZ - 1)) & ~(__LDPGSZ - 1)) +#define _dl_round_page(x) \ + (((x) + ((1 << _MAX_PAGE_SHIFT) - 1)) & ~((1 << _MAX_PAGE_SHIFT) - 1)) /* * The following functions are declared inline so they can -- 2.20.1