This commit moves shared builtin information out of binfmt/libbuiltin and into libs/libc/builtin where it can be shared. This should permit builtin application in the PROTECTED build where binfmt/libbuiltin is not available in user space.

Squashed commit of the following:

    Correct some additional compile-related issues.

    Move  include/nuttx/binfmt/builtin.h to include/nuttx/lib/builtin.h.  Move apps/builtin/lib_builtin_forindex.c to libs/libc/builtin/lib_builtin_forindex.c.

    Move binfmt/libbuiltin to libs/libc/builtin.  There are calls made directly from apps/nshlib into this logic and hence, must be part of a library that can be shared between the OS and applications.
This commit is contained in:
Gregory Nutt
2019-08-23 09:07:40 -06:00
parent b3d609959c
commit dd97fb991b
19 changed files with 172 additions and 85 deletions
@@ -1,5 +1,5 @@
/****************************************************************************
* include/nuttx/binfmt/builtin.h
* include/nuttx/lib/builtin.h
*
* Originally by:
*
@@ -8,7 +8,7 @@
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_BINFMT_BUILTIN_H
#define __INCLUDE_NUTTX_BINFMT_BUILTIN_H
#ifndef __INCLUDE_NUTTX_LIB_BUILTIN_H
#define __INCLUDE_NUTTX_LIB_BUILTIN_H
/****************************************************************************
* Included Files
@@ -50,6 +50,21 @@
#include <nuttx/config.h>
#include <sys/types.h>
#ifdef CONFIG_BUILTIN
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* This logic is not usable in the KERNEL build and, furthermore, it has no
* meaning in __KERNEL__ blob of a protected build.
*/
#if (defined(CONFIG_BUILD_FLAT) || \
(defined(CONFIG_BUILD_PROTECTED )&& !__KERNEL__))
# define HAVE_BUILTIN_CONTEXT
#endif
/****************************************************************************
* Public Types
****************************************************************************/
@@ -74,39 +89,15 @@ extern "C"
#define EXTERN extern
#endif
/* These must be provided the application layer */
EXTERN const struct builtin_s g_builtins[];
EXTERN const int g_builtin_count;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_initialize
*
* Description:
* In order to use the builtin binary format, this function must be called
* during system initialize to register the builtin 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 builtin_initialize(void);
/****************************************************************************
* Name: builtin_uninitialize
*
* Description:
* Unregister the builtin binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void builtin_uninitialize(void);
/****************************************************************************
* Name: builtin_isavail
*
@@ -168,4 +159,5 @@ FAR const struct builtin_s *builtin_for_index(int index);
}
#endif
#endif /* __INCLUDE_NUTTX_BINFMT_BUILTIN_H */
#endif /* CONFIG_BUILTIN */
#endif /* __INCLUDE_NUTTX_LIB_BUILTIN_H */