提交 050fdbe7 编写于 作者: H Haryslee

fix: 修复用户态内存调测模块开启时编译不过问题

背景:内存调测模块编译时依赖libunwind.a库,编译时若不显式指定-lunwind链接选项对于依赖该库的程序
会编译报错。
修复:由于对链接libc.a库的所有程序添加对应的链接选项不现实,故将libunwind.a打包进libc.a,使得依
赖libunwind.a的所有程序无需显式链接unwind库即可链接成功。

close #I42O66
Signed-off-by: NHaryslee <lihao189@huawei.com>
Change-Id: I52965869e53e09e6a2596b958c63f299a3c7c8cc
上级 eccfbfa2
......@@ -52,7 +52,10 @@ build_ext_component("build_sysroot") {
makefile = rebase_path("Makefile", exec_path)
command = "make TOPDIR=$ohos_root_path SYSROOTDIR=$sysroot_path TARGETS=$targets -f $makefile"
command += " ARCH=$arch TARGET=$target_triple ARCH_CFLAGS=\"$arch_cflags\""
command += " BUILD_DEBUG=false BUILD_ALL_MULTILIB=false CLANG=\"$ohos_current_cc_command\""
command += " BUILD_ALL_MULTILIB=false CLANG=\"$ohos_current_cc_command\""
if (ohos_build_type == "debug") {
command += " BUILD_DEBUG=true"
}
if (ohos_kernel_type == "linux") {
deps += [ "//kernel/linux/patches:linux_kernel" ]
command += " LINUXDIR=" + rebase_path("$root_out_dir/kernel/linux-4.19")
......
......@@ -125,7 +125,10 @@ musl_install_for_liteos_a_user: musl_patch_for_liteos_a_user
../configure --prefix=/usr --target=$(TARGET) --includedir=/usr/include/$(TARGET) --libdir=/usr/$(MULTILIB) \
$(if $(LDFLAGS),LDFLAGS="$(LDFLAGS)",) \
CC="$(CC)" CROSS_COMPILE="$(CROSS_COMPILE)" CFLAGS="$(CFLAGS)" >/dev/null && \
sed '/install-libs:/s/if/and/g' Makefile | make -f- -sj install-headers install-libs DESTDIR=$(SYSROOTDIR)
sed '/install-libs:/s/if/and/g' Makefile | sed 's, -DCRT, -DCRT -fno-unwind-tables -fno-asynchronous-unwind-tables,g' | make -f- -sj install-headers install-libs DESTDIR=$(SYSROOTDIR)
ifeq ($(BUILD_DEBUG),true)
$(HIDE) mkdir -p unwind && cd unwind && $(CROSS_COMPILE)ar x $(shell $(CC) -print-file-name=libunwind.a) && $(CROSS_COMPILE)ar r $(SYSROOTDIR)/usr/$(MULTILIB)/libc.a *.o
endif
ifeq ($(wildcard $(LINUXHDRDIR)),)
LINUXHDRDIR = $(shell pwd)/linux_header_install_for_linux_user/usr/include
......@@ -181,7 +184,10 @@ musl_install_for_liteos_a_user$(1): musl_install_for_liteos_a_user
../configure --prefix=/usr --target=$$(TARGET) --libdir=/usr/$$(MULTILIB) \
$$(if $$(LDFLAGS),LDFLAGS="$$(LDFLAGS)",) \
CC="$$(CC)" CROSS_COMPILE="$$(CROSS_COMPILE)" CFLAGS="$$(CFLAGS)" >/dev/null && \
sed '/install-libs:/s/if/and/g' Makefile | make -f- -sj install-libs DESTDIR=$$(SYSROOTDIR)
sed '/install-libs:/s/if/and/g' Makefile | sed 's, -DCRT, -DCRT -fno-unwind-tables -fno-asynchronous-unwind-tables,g' | make -f- -sj install-libs DESTDIR=$$(SYSROOTDIR)
ifeq ($$(BUILD_DEBUG),true)
$(HIDE) mkdir -p unwind && cd unwind && $$(CROSS_COMPILE)ar x $$(shell $$(CC) -print-file-name=libunwind.a) && $$(CROSS_COMPILE)ar r $$(SYSROOTDIR)/usr/$$(MULTILIB)/libc.a *.o
endif
endif
endef
......@@ -192,7 +198,7 @@ endif
endif
clean:
$(HIDE) rm -rf musl_copy_for_* linux_header_install_for_*
$(HIDE) rm -rf musl_copy_for_* linux_header_install_for_* unwind
distclean: clean
$(HIDE) rm -rf $(SYSROOTDIR)/lib $(SYSROOTDIR)/usr
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册