linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf unwind: Fix compile error for static cross build
@ 2016-06-15 11:03 He Kuang
  2016-06-16  8:34 ` [tip:perf/core] " tip-bot for He Kuang
  0 siblings, 1 reply; 2+ messages in thread
From: He Kuang @ 2016-06-15 11:03 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, hekuang,
	wangnan0, namhyung
  Cc: linux-kernel

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 <hekuang@huawei.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf unwind: Fix compile error for static cross build
  2016-06-15 11:03 [PATCH] perf unwind: Fix compile error for static cross build He Kuang
@ 2016-06-16  8:34 ` tip-bot for He Kuang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for He Kuang @ 2016-06-16  8:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, alexander.shishkin, acme, mingo, hpa, wangnan0,
	peterz, jolsa, hekuang, namhyung, tglx

Commit-ID:  906a8276429c7eb3b53676dab4e2acb632ffcc5a
Gitweb:     http://git.kernel.org/tip/906a8276429c7eb3b53676dab4e2acb632ffcc5a
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Wed, 15 Jun 2016 11:03:56 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 15 Jun 2016 10:27:11 -0300

perf unwind: Fix compile error for static cross build

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 is 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 <hekuang@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1465988636-81502-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-16  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 11:03 [PATCH] perf unwind: Fix compile error for static cross build He Kuang
2016-06-16  8:34 ` [tip:perf/core] " tip-bot for He Kuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).