1.【需求描述】 动态库开发部分: gcc的sample code。 提供生成暴露接口生成机制,并允许产品新增需要暴露的接口。 提供可以判断库允许资源大小的能力,并提供相关工具辅助开发者确定开发的库要求的资源是否可以满足。 动态库运行部分: 提供elf load的api,可以加载指定路径下的库,并完成符号重映射等运行准备。 提供elf 暴露符号调用的api,用于调用库的api。 elf加载&链接异常时,有明确错误记录,返回明确错误类型。 提供elf 卸载的api。 2.【方案描述】 (1) 通过灌段的形式记录需要导出符号的地址信息,用于暴露内核对外的接口,在加载链接器中通过查询 对应的符号信息获取符号地址。 (2) 加载链接时,解析共享库并将共享库中可加载段通过文件系统读入内存中,并对共享库中未定义的、 需要重定位的符号进行重定位。需要调用符号时,根据符号名通过哈希表即可查询共享库提供的对应符号 的地址。 BREAKING CHANGE: 新增4个对外接口,声明在los_dynlink.h文件中,分别为: (1) LOS_DynlinkInit: 动态加载模块初始化。 (2) LOS_SoLoad: 加载指定路径的共享库。 (3) LOS_FindSym: 根据共享库句柄查找指定符号。 (4) LOS_SoUnload: 卸载共享库。 close #I418HJ Signed-off-by: Haryslee <lihao189@huawei.com> Change-Id: I7669b7ef20096294f9d1094c85ac6602fefad354
72 lines
2.7 KiB
Plaintext
72 lines
2.7 KiB
Plaintext
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without modification,
|
|
# are permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
# conditions and the following disclaimer.
|
|
#
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
|
# provided with the distribution.
|
|
#
|
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
# to endorse or promote products derived from this software without specific prior written
|
|
# permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
static_library("kernel") {
|
|
sources = [
|
|
"src/los_event.c",
|
|
"src/los_init.c",
|
|
"src/los_mux.c",
|
|
"src/los_queue.c",
|
|
"src/los_sched.c",
|
|
"src/los_sem.c",
|
|
"src/los_sortlink.c",
|
|
"src/los_swtmr.c",
|
|
"src/los_task.c",
|
|
"src/los_tick.c",
|
|
"src/mm/los_membox.c",
|
|
"src/mm/los_memory.c",
|
|
]
|
|
|
|
include_dirs = [
|
|
"include",
|
|
"arch/include",
|
|
"../components/cpup",
|
|
"../components/exchook",
|
|
"../components/backtrace",
|
|
"../components/power",
|
|
"../components/dynlink",
|
|
"../utils",
|
|
"//third_party/bounds_checking_function/include",
|
|
]
|
|
|
|
if ("$board_cpu" == "cortex-m3") {
|
|
deps = [ "arch/arm/cortex-m3/gcc/:arch" ]
|
|
} else if ("$board_cpu" == "cortex-m4") {
|
|
deps = [ "arch/arm/cortex-m4/gcc/:arch" ]
|
|
} else if ("$board_cpu" == "cortex-m7") {
|
|
deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
|
|
} else if ("$board_cpu" == "cortex-m33") {
|
|
deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
|
|
} else if ("$board_cpu" == "") {
|
|
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
|
|
deps = [ "arch/risc-v/riscv32/gcc:arch" ]
|
|
}
|
|
}
|
|
}
|