diff --git a/binfmt/Makefile b/binfmt/Makefile index 2050090dfb..9f8dbf8f05 100644 --- a/binfmt/Makefile +++ b/binfmt/Makefile @@ -41,6 +41,18 @@ ifeq ($(CONFIG_BUILTIN),y) CSRCS += builtin.c endif +# ELF application interfaces + +ifeq ($(CONFIG_ELF),y) +CSRCS += elf.c +endif + +# NXFLAT application interfaces + +ifeq ($(CONFIG_NXFLAT),y) +CSRCS += nxflat.c +endif + # Add configured binary modules include libnxflat/Make.defs diff --git a/binfmt/binfmt.h b/binfmt/binfmt.h index 647a34e455..a769ad93a5 100644 --- a/binfmt/binfmt.h +++ b/binfmt/binfmt.h @@ -165,6 +165,7 @@ void binfmt_freeargv(FAR char * const *argv); # define binfmt_freeenv(envp) #endif +#ifdef CONFIG_BUILTIN /**************************************************************************** * Name: builtin_initialize * @@ -179,9 +180,7 @@ void binfmt_freeargv(FAR char * const *argv); * ****************************************************************************/ -#ifdef CONFIG_BUILTIN int builtin_initialize(void); -#endif /**************************************************************************** * Name: builtin_uninitialize @@ -194,10 +193,72 @@ int builtin_initialize(void); * ****************************************************************************/ -#ifdef CONFIG_BUILTIN void builtin_uninitialize(void); #endif +#ifdef CONFIG_ELF +/**************************************************************************** + * Name: elf_initialize + * + * Description: + * In order to use the ELF binary format, this function must be called + * during system initialization to register the ELF binary format. + * + * Returned Value: + * This is a NuttX internal function so it follows the convention that + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + ****************************************************************************/ + +int elf_initialize(void); + +/**************************************************************************** + * Name: elf_uninitialize + * + * Description: + * Unregister the ELF binary loader + * + * Returned Value: + * None + * + ****************************************************************************/ + +void elf_uninitialize(void); +#endif + +#ifdef CONFIG_NXFLAT +/**************************************************************************** + * Name: nxflat_initialize + * + * Description: + * In order to use the NxFLAT binary format, this function must be called + * during system initialization to register the NXFLAT binary + * format. + * + * Returned Value: + * This is a NuttX internal function so it follows the convention that + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + ****************************************************************************/ + +int nxflat_initialize(void); + +/**************************************************************************** + * Name: nxflat_uninitialize + * + * Description: + * Unregister the NXFLAT binary loader + * + * Returned Value: + * None + * + ****************************************************************************/ + +void nxflat_uninitialize(void); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/binfmt/binfmt_initialize.c b/binfmt/binfmt_initialize.c index dd1cbd10e8..0444fc9312 100644 --- a/binfmt/binfmt_initialize.c +++ b/binfmt/binfmt_initialize.c @@ -25,9 +25,6 @@ #include #include -#include -#include -#include #include diff --git a/binfmt/libelf/Make.defs b/binfmt/libelf/Make.defs index a32f93228e..0697ec1d5d 100644 --- a/binfmt/libelf/Make.defs +++ b/binfmt/libelf/Make.defs @@ -20,10 +20,6 @@ ifeq ($(CONFIG_ELF),y) -# ELF application interfaces - -CSRCS += elf.c - # ELF library CSRCS += libelf_bind.c libelf_init.c libelf_addrenv.c libelf_iobuffer.c diff --git a/binfmt/libnxflat/Make.defs b/binfmt/libnxflat/Make.defs index ffc1d53396..245b4dab36 100644 --- a/binfmt/libnxflat/Make.defs +++ b/binfmt/libnxflat/Make.defs @@ -20,10 +20,6 @@ ifeq ($(CONFIG_NXFLAT),y) -# NXFLAT application interfaces - -CSRCS += nxflat.c - # NXFLAT library CSRCS += libnxflat_init.c libnxflat_uninit.c libnxflat_addrenv.c diff --git a/include/nuttx/binfmt/elf.h b/include/nuttx/binfmt/elf.h index 2acca1c4e2..1484f2d47f 100644 --- a/include/nuttx/binfmt/elf.h +++ b/include/nuttx/binfmt/elf.h @@ -158,35 +158,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Name: elf_initialize - * - * Description: - * In order to use the ELF binary format, this function must be called - * during system initialization to register the ELF binary format. - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int elf_initialize(void); - -/**************************************************************************** - * Name: elf_uninitialize - * - * Description: - * Unregister the ELF binary loader - * - * Returned Value: - * None - * - ****************************************************************************/ - -void elf_uninitialize(void); - /**************************************************************************** * Name: elf_init * diff --git a/include/nuttx/binfmt/nxflat.h b/include/nuttx/binfmt/nxflat.h index 222fdadc33..e51a4f1ce1 100644 --- a/include/nuttx/binfmt/nxflat.h +++ b/include/nuttx/binfmt/nxflat.h @@ -112,36 +112,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Name: nxflat_initialize - * - * Description: - * In order to use the NxFLAT binary format, this function must be called - * during system initialization to register the NXFLAT binary - * format. - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int nxflat_initialize(void); - -/**************************************************************************** - * Name: nxflat_uninitialize - * - * Description: - * Unregister the NXFLAT binary loader - * - * Returned Value: - * None - * - ****************************************************************************/ - -void nxflat_uninitialize(void); - /**************************************************************************** * Name: nxflat_verifyheader *