From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932239AbcFOLE2 (ORCPT ); Wed, 15 Jun 2016 07:04:28 -0400 Received: from szxga05-in.huawei.com ([119.145.14.199]:40006 "EHLO szxga05-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753391AbcFOLE0 (ORCPT ); Wed, 15 Jun 2016 07:04:26 -0400 From: He Kuang To: , , , , , , , CC: Subject: [PATCH] perf unwind: Fix compile error for static cross build Date: Wed, 15 Jun 2016 11:03:56 +0000 Message-ID: <1465988636-81502-1-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5761362A.01F8,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 132bb77c1da41c0d19982280c0b831a2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Build failure for static cross-compiling on aarch64, with libunwind-x86 provided. $ file ./libunwind_for_x86_on_aarch64/lib/libunwind-x86.so.8.0.1 libunwind-x86.so.8.0.1: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped $ make LDFLAGS=-static LIBUNWIND_DIR=./libunwind_for_x86_on_aarch64 ARCH=aarch64 CROSS_COMPILE=aarch64-buildroot-linux-gnu- ~/libperf.a(libperf-in.o): In function `find_proc_info': :(.text+0xae4ac): undefined reference to `_Ux86_dwarf_search_unwind_table' ~/libperf.a(libperf-in.o): In function `_unwind__prepare_access': :(.text+0xaedd0): undefined reference to `_Ux86_create_addr_space' :(.text+0xaee24): undefined reference to `_Ux86_set_caching_policy' ~/libperf.a(libperf-in.o): In function `_unwind__flush_access': :(.text+0xaee98): undefined reference to `_Ux86_flush_cache' ~/libperf.a(libperf-in.o): In function `_unwind__finish_access': :(.text+0xaef08): undefined reference to `_Ux86_destroy_addr_space' ~/libperf.a(libperf-in.o): In function `get_entries': :(.text+0xaf148): undefined reference to `_Ux86_init_remote' :(.text+0xaf184): undefined reference to `_Ux86_get_reg' :(.text+0xaf1a4): undefined reference to `_Ux86_step' collect2: error: ld returned 1 exit status Makefile.perf:350: recipe for target '~/perf' failed make[1]: *** [~/perf] Error 1 Makefile:68: recipe for target 'all' failed make: *** [all] Error 2 This is because the remote libunwind library detected are not appended to EXTLIBS variable, which will be included between 'start-group' and 'end-group' when linking. The existing variable LIBUNWIND_LIBS is assigned to libs for local unwind, this patch introduces a new variable EXTLIBS_LIBUNWIND for storing remote libunwind libraries instead. Signed-off-by: He Kuang --- tools/perf/config/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 098874b..80018fe 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -365,6 +365,7 @@ ifndef NO_LIBUNWIND $(call detected,CONFIG_LIBUNWIND_X86) CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT LDFLAGS += -lunwind-x86 + EXTLIBS_LIBUNWIND += -lunwind-x86 have_libunwind = 1 endif @@ -372,6 +373,7 @@ ifndef NO_LIBUNWIND $(call detected,CONFIG_LIBUNWIND_AARCH64) CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT LDFLAGS += -lunwind-aarch64 + EXTLIBS_LIBUNWIND += -lunwind-aarch64 have_libunwind = 1 $(call feature_check,libunwind-debug-frame-aarch64) ifneq ($(feature-libunwind-debug-frame-aarch64), 1) @@ -449,6 +451,7 @@ ifndef NO_LIBUNWIND CFLAGS += -DHAVE_LIBUNWIND_SUPPORT CFLAGS += $(LIBUNWIND_CFLAGS) LDFLAGS += $(LIBUNWIND_LDFLAGS) + EXTLIBS += $(EXTLIBS_LIBUNWIND) endif ifndef NO_LIBAUDIT -- 1.8.5.2