From ebcb03dce9a952429fd3233cf02ecbc6c7ec38ef Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 9 Jul 2023 05:23:32 +0800 Subject: [PATCH] libc/symtab: Don't include symtab.h in the header files to unify the inclusion of symtab.h only from the source files Signed-off-by: Xiang Xiao --- binfmt/binfmt_execsymtab.c | 2 +- include/nuttx/allsyms.h | 4 +--- include/nuttx/binfmt/elf.h | 18 ++++++++---------- include/nuttx/binfmt/symtab.h | 4 +--- include/nuttx/lib/modlib.h | 4 +--- libs/libc/dlfcn/lib_dlsym.c | 1 + libs/libc/modlib/modlib_symbols.c | 1 + libs/libc/modlib/modlib_symtab.c | 1 + libs/libc/stdio/lib_libvsprintf.c | 1 + libs/libc/symtab/symtab_allsyms.c | 1 + sched/module/mod_modsym.c | 1 + 11 files changed, 18 insertions(+), 20 deletions(-) diff --git a/binfmt/binfmt_execsymtab.c b/binfmt/binfmt_execsymtab.c index 2ecf4f29c20..ef810f7a1eb 100644 --- a/binfmt/binfmt_execsymtab.c +++ b/binfmt/binfmt_execsymtab.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include #ifdef CONFIG_LIBC_EXECFUNCS diff --git a/include/nuttx/allsyms.h b/include/nuttx/allsyms.h index 46272c04bcb..e068d3eec2e 100644 --- a/include/nuttx/allsyms.h +++ b/include/nuttx/allsyms.h @@ -25,9 +25,6 @@ * Included Files ****************************************************************************/ -#include -#include - #include /**************************************************************************** @@ -55,6 +52,7 @@ extern "C" * ****************************************************************************/ +struct symtab_s; FAR const struct symtab_s *allsyms_findbyname(FAR const char *name, FAR size_t *size); diff --git a/include/nuttx/binfmt/elf.h b/include/nuttx/binfmt/elf.h index 1484f2d47ff..3f35f609c55 100644 --- a/include/nuttx/binfmt/elf.h +++ b/include/nuttx/binfmt/elf.h @@ -28,12 +28,10 @@ #include #include - #include #include #include -#include #include /**************************************************************************** @@ -92,15 +90,15 @@ struct elf_loadinfo_s * after the ELF module has been loaded. */ - uintptr_t textalloc; /* .text memory allocated when ELF file was loaded */ - uintptr_t dataalloc; /* .bss/.data memory allocated when ELF file was loaded */ - size_t textsize; /* Size of the ELF .text memory allocation */ - size_t datasize; /* Size of the ELF .bss/.data memory allocation */ - size_t textalign; /* Necessary alignment of .text */ - size_t dataalign; /* Necessary alignment of .bss/.data */ - off_t filelen; /* Length of the entire ELF file */ + uintptr_t textalloc; /* .text memory allocated when ELF file was loaded */ + uintptr_t dataalloc; /* .bss/.data memory allocated when ELF file was loaded */ + size_t textsize; /* Size of the ELF .text memory allocation */ + size_t datasize; /* Size of the ELF .bss/.data memory allocation */ + size_t textalign; /* Necessary alignment of .text */ + size_t dataalign; /* Necessary alignment of .bss/.data */ + off_t filelen; /* Length of the entire ELF file */ - Elf_Ehdr ehdr; /* Buffered ELF file header */ + Elf_Ehdr ehdr; /* Buffered ELF file header */ FAR Elf_Shdr *shdr; /* Buffered ELF section headers */ uint8_t *iobuffer; /* File I/O buffer */ diff --git a/include/nuttx/binfmt/symtab.h b/include/nuttx/binfmt/symtab.h index ef9f3823527..9bbade8f1d0 100644 --- a/include/nuttx/binfmt/symtab.h +++ b/include/nuttx/binfmt/symtab.h @@ -25,9 +25,6 @@ * Included Files ****************************************************************************/ -#include -#include - /**************************************************************************** * Public Functions Definitions ****************************************************************************/ @@ -58,6 +55,7 @@ extern "C" * ****************************************************************************/ +struct symtab_s; void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); /**************************************************************************** diff --git a/include/nuttx/lib/modlib.h b/include/nuttx/lib/modlib.h index 505972d45ec..e60e30d2259 100644 --- a/include/nuttx/lib/modlib.h +++ b/include/nuttx/lib/modlib.h @@ -30,9 +30,6 @@ #include #include -#include -#include - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -117,6 +114,7 @@ typedef CODE int (*mod_uninitializer_t)(FAR void *arg); * nexports - The number of symbols in the exported symbol table. */ +struct symtab_s; struct mod_info_s { mod_uninitializer_t uninitializer; /* Module uninitializer */ diff --git a/libs/libc/dlfcn/lib_dlsym.c b/libs/libc/dlfcn/lib_dlsym.c index ce116b180e2..66fa6af077e 100644 --- a/libs/libc/dlfcn/lib_dlsym.c +++ b/libs/libc/dlfcn/lib_dlsym.c @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/libs/libc/modlib/modlib_symbols.c b/libs/libc/modlib/modlib_symbols.c index 21ddcd3d189..26784587bdb 100644 --- a/libs/libc/modlib/modlib_symbols.c +++ b/libs/libc/modlib/modlib_symbols.c @@ -31,6 +31,7 @@ #include #include +#include #include #include "libc.h" diff --git a/libs/libc/modlib/modlib_symtab.c b/libs/libc/modlib/modlib_symtab.c index af3292334a3..203c4e5d9b8 100644 --- a/libs/libc/modlib/modlib_symtab.c +++ b/libs/libc/modlib/modlib_symtab.c @@ -26,6 +26,7 @@ #include +#include #include /**************************************************************************** diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index efef9711940..a49fee0daaf 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -51,6 +51,7 @@ #include #include #include +#include #include "lib_dtoa_engine.h" #include "lib_ultoa_invert.h" diff --git a/libs/libc/symtab/symtab_allsyms.c b/libs/libc/symtab/symtab_allsyms.c index eb34ec1c802..436d0c5dbb0 100644 --- a/libs/libc/symtab/symtab_allsyms.c +++ b/libs/libc/symtab/symtab_allsyms.c @@ -23,6 +23,7 @@ ****************************************************************************/ #include +#include /**************************************************************************** * Public Data diff --git a/sched/module/mod_modsym.c b/sched/module/mod_modsym.c index b694d557a12..31946a1b482 100644 --- a/sched/module/mod_modsym.c +++ b/sched/module/mod_modsym.c @@ -28,6 +28,7 @@ #include #include +#include #include #include