1.2 编译链接
需要通过链接选项指定需要链接的ACTS的部件编译库文件,会使用到 --whole-archive 和 --no-whole-archive这2个ld链接选项。–whole-archive 可以把 在其后面出现的静态库包含的函数和变量输出到动态库,–no-whole-archive 则关掉这个特性。在文件vendor\goodix\gr5515_sk_xts_demo\BUILD.gn中,对ACTS的编译文件进行链接。其中⑴到⑵处的链接选项为编译出的属于ACTS的组件测试库文件。
executable("${fw_img_name}.elf") {
deps = [
"tests:drivers",
"tests:fs_test",
"tests:ohosdemo",
"tests:shell_test",
"//build/lite:ohos",
]
ldflags = [
"-Wl,--whole-archive",
# "-lfs_test",
# "-ldrivers_test",
# "-lapp_hello",
"-lshell_test",
⑴ "-lhctest",
"-lmodule_ActsBootstrapTest",
"-lmodule_ActsWifiIotTest",
"-lmodule_ActsUtilsFileTest",
"-lmodule_ActsKvStoreTest",
"-lmodule_ActsParameterTest",
"-lmodule_ActsSamgrTest",
"-lhuks_test_common",
"-lmodule_ActsHuksHalFunctionTest",
"-lmodule_ActsDfxFuncTest",
"-lmodule_ActsUpdaterFuncTest",
⑵ "-lmodule_ActsHieventLiteTest",
"-Wl,--no-whole-archive",
]
}
在文件vendor\bestechnic\xts_demo\config.json中,需要链接的ACTS部件测试库文件写在了bin_list里的force_link_libs里。
"bin_list": [
{
"elf_name": "wifiiot",
"bsp_target_name": "best2600w_liteos",
"signature": "false",
"burn_name": "rtos_main",
"enable": "true",
"force_link_libs": [
"bootstrap",
"abilityms",
"bundlems",
"broadcast",
"hctest",
⑴ "module_ActsParameterTest",
"module_ActsBootstrapTest",
"module_ActsDfxFuncTest",
"module_ActsHieventLiteTest",
"module_ActsSamgrTest",
⑵ "module_ActsKvStoreTest"
]
},
.......
],
然后在文件device\soc\bestechnic\bes2600\BUILD.gn里组装编译链接选项,相关代码片段如下:
# config bin from vendor/bestechnic/<product_name>/config.json
foreach(bin_file, bin_list) {
......
if (build_enable == "true") {
......
# force link invisible function ,which ar to lib
ldflags += [ "-Wl,--whole-archive" ]
foreach(force_link_lib, bin_file.force_link_lib

最低0.47元/天 解锁文章
1225

被折叠的 条评论
为什么被折叠?



