From b0714f3814901445e8efdf36b1681d09938e31a8 Mon Sep 17 00:00:00 2001 From: guenther Date: Mon, 17 Jan 2022 01:35:36 +0000 Subject: [PATCH] Nothing depends on archdep.h pulling in other #includes anymore, so delete the #includes and hide the RELOC_* functions that are only used by lib/csu behind "#ifdef RCRT0" these are the ones I tested; kettenis@ was on board with the concept --- libexec/ld.so/aarch64/archdep.h | 11 ++++------- libexec/ld.so/amd64/archdep.h | 11 ++++------- libexec/ld.so/arm/archdep.h | 11 ++++------- libexec/ld.so/i386/archdep.h | 13 +++++-------- libexec/ld.so/powerpc/archdep.h | 14 ++++++-------- libexec/ld.so/sh/archdep.h | 13 +++++-------- libexec/ld.so/sparc64/archdep.h | 13 +++++-------- 7 files changed, 33 insertions(+), 53 deletions(-) diff --git a/libexec/ld.so/aarch64/archdep.h b/libexec/ld.so/aarch64/archdep.h index 692b0da2a3f..8e6fa7d9259 100644 --- a/libexec/ld.so/aarch64/archdep.h +++ b/libexec/ld.so/aarch64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.7 2021/11/14 22:07:38 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.8 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,13 +32,9 @@ #define RELOC_TAG DT_RELA #define MACHID EM_AARCH64 /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { @@ -53,4 +49,5 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _AARCH64_ARCHDEP_H_ */ diff --git a/libexec/ld.so/amd64/archdep.h b/libexec/ld.so/amd64/archdep.h index c3bf017be7b..f717f9c7ee8 100644 --- a/libexec/ld.so/amd64/archdep.h +++ b/libexec/ld.so/amd64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.14 2021/11/14 22:07:38 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.15 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,13 +32,9 @@ #define RELOC_TAG DT_RELA #define MACHID EM_AMD64 /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { @@ -53,4 +49,5 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _X86_64_ARCHDEP_H_ */ diff --git a/libexec/ld.so/arm/archdep.h b/libexec/ld.so/arm/archdep.h index 198bc7f8661..c6adff41b85 100644 --- a/libexec/ld.so/arm/archdep.h +++ b/libexec/ld.so/arm/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.14 2021/11/14 22:07:38 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.15 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,13 +32,9 @@ #define RELOC_TAG DT_REL #define MACHID EM_ARM /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void RELOC_DYN(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { @@ -53,4 +49,5 @@ RELOC_DYN(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _ARM_ARCHDEP_H_ */ diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h index d0462ca46ad..65dcaab019b 100644 --- a/libexec/ld.so/i386/archdep.h +++ b/libexec/ld.so/i386/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.22 2021/11/14 22:07:38 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.23 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,15 +32,11 @@ #define RELOC_TAG DT_REL #define MACHID EM_386 /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void -RELOC_DYN(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) +RELOC_DYN(const Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) { @@ -54,4 +50,5 @@ RELOC_DYN(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _I386_ARCHDEP_H_ */ diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h index 5baae022038..678672bf010 100644 --- a/libexec/ld.so/powerpc/archdep.h +++ b/libexec/ld.so/powerpc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.24 2021/11/14 22:07:39 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.25 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,14 +32,9 @@ #define RELOC_TAG DT_RELA #define MACHID EM_PPC /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - static inline void -_dl_dcbf(Elf_Addr *addr) +_dl_dcbf(void *addr) { __asm__ volatile ("dcbst 0, %0\n\t" "sync\n\t" @@ -50,8 +45,10 @@ _dl_dcbf(Elf_Addr *addr) } /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void -RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) +RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) { *p = v + r->r_addend; @@ -74,4 +71,5 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _POWERPC_ARCHDEP_H_ */ diff --git a/libexec/ld.so/sh/archdep.h b/libexec/ld.so/sh/archdep.h index ba3febbdba6..d56c32bad07 100644 --- a/libexec/ld.so/sh/archdep.h +++ b/libexec/ld.so/sh/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.13 2021/11/14 22:07:39 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.14 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,15 +32,11 @@ #define RELOC_TAG DT_RELA #define MACHID EM_SH /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void -RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) +RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { if (ELF_R_TYPE(r->r_info) == R_SH_RELATIVE) { *p = v + r->r_addend; @@ -51,4 +47,5 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _SH_ARCHDEP_H_ */ diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h index 3b80044a5f9..3a7b2d58ddd 100644 --- a/libexec/ld.so/sparc64/archdep.h +++ b/libexec/ld.so/sparc64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.27 2021/11/14 22:07:39 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.28 2022/01/17 01:35:36 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -32,15 +32,11 @@ #define RELOC_TAG DT_RELA #define MACHID EM_SPARCV9 /* ELF e_machine ID value checked */ -#include -#include -#include "syscall.h" -#include "util.h" - - /* Only used in lib/csu/boot.h */ +#ifdef RCRT0 + static inline void -RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) +RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) { *p = v + r->r_addend; @@ -49,4 +45,5 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#endif /* RCRT0 */ #endif /* _SPARC64_ARCHDEP_H_ */ -- 2.20.1