perf: unwind: fix unw_word_t pointer casts
PATCH 1/5 perf: unwind: fix unw_word_t pointer casts
unw_word_t is uint64_t even on 32-bit MIPS. Cast it to uintptr_t before the cast to void *p to get rid of the following errors:
util/unwind-libunwind.c: In function 'access_mem':util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [util/unwind-libunwind.o] Error 1
--- tools/perf/util/unwind-libunwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/unwind-libunwind.c +2 -2
@@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,if (ret) {pr_debug ("unwind: access_mem %p not inside range" " 0x%" PRIx64"-0x%" PRIx64"\n" , - (void *) addr, start, end); + (void *) (uintptr_t ) addr, start, end); *valp =0 ;return ret; }
@@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as, offset = addr - start; *valp = *(unw_word_t *)&stack->data[offset];pr_debug ("unwind: access_mem addr %p val %lx, offset %d\n" , - (void *) addr, (unsigned long )*valp, offset); + (void *) (uintptr_t ) addr, (unsigned long )*valp, offset);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH 2/5 perf: unwind: pass symbol source to libunwind
Even if --symfs is used to point to the debug binaries, we send in the non-debug filenames to libunwind, which leads to libunwind not finding the debug frame. Fix this.
--- tools/perf/util/unwind-libunwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/unwind-libunwind.c +1 -1
@@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,dso__data_put_fd (map->dso);memset (&di,0 ,sizeof (di)); -if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->name, +if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->symsrc_filename, map->start, map->end))return dwarf_search_unwind_table (as, ip, &di, pi, need_unwind_info, arg);
Signature · 1 line
1.7.10.4
Re: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
Quoted 5 lines · Rabin Vincent
Even if --symfs is used to point to the debug binaries, we send in the non-debug filenames to libunwind, which leads to libunwind not finding the debug frame. Fix this.
Signed-off-by Rabin Vincent <[email protected]>
cc-ing Namhyung on this one
jirka
Quoted 25 lines
--- tools/perf/util/unwind-libunwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/unwind-libunwind.c +1
-1@@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,dso__data_put_fd (map->dso);memset (&di,0 ,sizeof (di)); -if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->name, +if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->symsrc_filename, map->start, map->end))return dwarf_search_unwind_table (as, ip, &di, pi, need_unwind_info, arg);Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Namhyung Kim
maintainerRe: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
Hi Jiri,
Quoted 8 lines · Jiri Olsa
Quoted 5 lines · Rabin Vincent
Even if --symfs is used to point to the debug binaries, we send in the non-debug filenames to libunwind, which leads to libunwind not finding the debug frame. Fix this.
Signed-off-by Rabin Vincent <[email protected]>cc-ing Namhyung on this one
It seems that the dso->symsrc_filename can be NULL and it's unsafe to call dwarf_find_debug_frame() with the NULL pointer. Other than that looks good to me.
Thanks,
Namhyung
Quoted 25 lines
Quoted 25 lines
--- tools/perf/util/unwind-libunwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/unwind-libunwind.c +1
-2@@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,dso__data_put_fd (map->dso);memset (&di,0 ,sizeof (di)); -if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->name, +if (dwarf_find_debug_frame (0 , &di, ip, base, map->dso->symsrc_filename, map->start, map->end))return dwarf_search_unwind_table (as, ip, &di, pi, need_unwind_info, arg); --1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Thanks, Namhyung
Re: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
Quoted 6 lines · Namhyung Kim
Quoted 5 lines · Jiri Olsa
Quoted 4 lines · Rabin Vincent
Even if --symfs is used to point to the debug binaries, we send in the non-debug filenames to libunwind, which leads to libunwind not finding the debug frame. Fix this.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Rabin Vincent <[email protected]>cc-ing Namhyung on this one
It seems that the
dso->symsrc_filenamecan be NULL and it's unsafe to calldwarf_find_debug_frame()with the NULL pointer. Other than that looks good to me.
Thanks, I will change it to fallback to dso->name if dso->symsrc_filename is NULL.
PATCH 3/5 perf: unwind: use debug_frame if eh_frame is unusable
In reply to Rabin VincentWhen NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame doesn't contain the approprate unwind tables.
--- tools/perf/util/unwind-libunwind.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/perf/util/unwind-libunwind.c +6 -4
@@ -330,6 +330,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,struct map *map;unw_dyn_info_t di;u64 table_data, segbase, fde_count; +int ret = -EINVAL ; map =find_map (ip, ui);if (!map || !map->dso)
@@ -348,13 +349,14 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, di.u.rti.table_data = map->start + table_data; di.u.rti.table_len = fde_count *sizeof (struct table_entry ) /sizeof (unw_word_t); -return dwarf_search_unwind_table (as, ip, &di, pi, - need_unwind_info, arg); + ret =dwarf_search_unwind_table (as, ip, &di, pi, + need_unwind_info, arg); }#ifndef NO_LIBUNWIND_DEBUG_FRAME /* Check the .debug_frame section for unwinding info */ -if (!read_unwind_spec_debug_frame (map->dso, ui->machine, &segbase)) { +if (ret <0 && + !read_unwind_spec_debug_frame (map->dso, ui->machine, &segbase)) {int fd =dso__data_get_fd (map->dso, ui->machine);int is_exec =elf_is_exec (fd, map->dso->name);unw_word_t base = is_exec ?0 : map->start;
@@ -370,7 +372,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, }#endif -return -EINVAL ; +return ret; } static int access_fpreg(unw_addr_space_t __maybe_unused as,
Signature · 1 line
1.7.10.4
Re: [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable
Quoted 3 lines · Rabin Vincent
When NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame doesn't contain the approprate unwind tables.
thanks,
jirka
tip-bot for Rabin Vincent
merge bot[tip:perf/core] perf callchain: Use debug_frame if eh_frame is unusable
In reply to Rabin Vincentperf callchain: Use debug_frame if eh_frame is unusable
Commit-ID: 8eac1d5e9256260b9cc3bfcdd9b8b995990950f5 Gitweb: http://git.kernel.org/tip/8eac1d5e9256260b9cc3bfcdd9b8b995990950f5 Author: Rabin Vincent <[email protected]> AuthorDate: Sun, 27 Sep 2015 20:37:57 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 12 Oct 2015 23:25:25 -0300
perf callchain: Use debug_frame if eh_frame is unusable
When NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame doesn't contain the approprate unwind tables.
--- tools/perf/util/unwind-libunwind.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/perf/util/unwind-libunwind.c +6 -4
@@ -330,6 +330,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,struct map *map;unw_dyn_info_t di;u64 table_data, segbase, fde_count; +int ret = -EINVAL ; map =find_map (ip, ui);if (!map || !map->dso)
@@ -348,13 +349,14 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, di.u.rti.table_data = map->start + table_data; di.u.rti.table_len = fde_count *sizeof (struct table_entry ) /sizeof (unw_word_t); -return dwarf_search_unwind_table (as, ip, &di, pi, - need_unwind_info, arg); + ret =dwarf_search_unwind_table (as, ip, &di, pi, + need_unwind_info, arg); }#ifndef NO_LIBUNWIND_DEBUG_FRAME /* Check the .debug_frame section for unwinding info */ -if (!read_unwind_spec_debug_frame (map->dso, ui->machine, &segbase)) { +if (ret <0 && + !read_unwind_spec_debug_frame (map->dso, ui->machine, &segbase)) {int fd =dso__data_get_fd (map->dso, ui->machine);int is_exec =elf_is_exec (fd, map->dso->name);unw_word_t base = is_exec ?0 : map->start;
@@ -370,7 +372,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, }#endif -return -EINVAL ; +return ret; } static int access_fpreg(unw_addr_space_t __maybe_unused as,
PATCH 4/5 tools: build: fix libiberty feature detection
In reply to Rabin VincentPass CFLAGS and LDFLAGS to the libiberty compile line to make the detection work when using a cross compiler.
Otherwise perf fails to link even though BFD is detected.
... libbfd: [ on ]
LINK perflibbfd.a(bfd.o): In function `bfd_errmsg':
bfd.c:(.text+0x168): undefined reference to xstrerror' bbfd.a(opncls.o): In function _bfd_new_bfd':
opncls.c:(.text+0xe8): undefined reference to `objalloc_create'
...
--- tools/build/feature/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/build/feature/Makefile +2 -2
@@ -132,10 +132,10 @@ test-libbfd.bin: $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl test-liberty.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty test-liberty-z.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz test-cplus-demangle.bin: $(BUILD) -liberty
Signature · 1 line
1.7.10.4
Re: [PATCH 4/5] tools: build: fix libiberty feature detection
Quoted 5 lines · Rabin Vincent
Pass CFLAGS and LDFLAGS to the libiberty compile line to make the detection work when using a cross compiler.
Otherwise perf fails to link even though BFD is detected.
Quoted 7 lines
... libbfd: [ on ]
LINK perf
libbfd.a(bfd.o): In function `bfd_errmsg':
bfd.c:(.text+0x168): undefined reference toxstrerror' bbfd.a(opncls.o): In function_bfd_new_bfd':
opncls.c:(.text+0xe8): undefined reference to `objalloc_create'
We have FEATURE_CHECK_CFLAGS/FEATURE_CHECK_LDFLAGS variables to pass CFLAGS/LDFLAGS to feature detection build
Could you also be more specific on what is missing to make the libiberty check compile?
thanks,
jirka
Quoted 32 lines
...
Signed-off-by Rabin Vincent <[email protected]>--- tools/build/feature/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/build/feature/Makefile +2
-2@@ -132,10 +132,10 @@ test-libbfd.bin: $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl test-liberty.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty test-liberty-z.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz test-cplus-demangle.bin: $(BUILD) -libertySignature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] tools: build: fix libiberty feature detection
Quoted 5 lines · Jiri Olsa
We have FEATURE_CHECK_CFLAGS/FEATURE_CHECK_LDFLAGS variables to pass CFLAGS/LDFLAGS to feature detection build
Could you also be more specific on what is missing to make the libiberty check compile?
We don't need any special CFLAGS/LDFLAGS for libiberty. What we do need is any CFLAGS or LDFLAGS set by the user, for example -I or -L to point to libraries and include files in custom paths. In all the other test-*.bin rules in build/feature/Makefile, we use the BUILD macro which always sends in CFLAGS and LDFLAGS. The libiberty build line doesn't use the BUILD macro and thus needs to send in CFLAGS and LDFLAGS explicitly.
So FEATURE_CHECK_CFLAGS_libiberty doesn't seem like the correct thing to use, since that would imply that libiberty needs some special flags?
PATCH 5/5 perf: add Makefile.deps for easier cross compiling
In reply to Rabin VincentIt's easy to cross-compile a minimal perf binary without any external libraries (other than a C library of course) but if you want more of the juicy features it quickly becomes harder. You need to either cross-compile a bunch of libraries manually and send in the correct paths or integrate the perf build into some external build system.
In order to make it easier for people to qucikly get up and running with a fairly full featured cross-compiled mainline perf, provide a Makefile.deps which will download and build the required libraries, which can then be used in a static build of perf:
$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps $ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static"
Auto-detecting system features:
... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ OFF ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ OFF ] ... libperl: [ OFF ] ... libpython: [ OFF ] ... libslang: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ OFF ] ... zlib: [ on ] ... lzma: [ on ]
--- tools/perf/Makefile.deps | 140 ++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/Makefile.perf | 7 +++ 2 files changed, 147 insertions(+) create mode 100644 tools/perf/Makefile.deps
tools/perf/Makefile.deps new file +140 -0
@@ -0,0 +1,140 @@ +LIBS += audit +audit_BASENAME=audit-2.4.4 +audit_ARCHIVE=$(audit_BASENAME).tar.gz +audit_URL=https://people.redhat.com/sgrubb/audit/$(audit_ARCHIVE) + +LIBS += bfd +bfd_BASENAME=binutils-2.25.1 +bfd_ARCHIVE=$(bfd_BASENAME).tar.bz2 +bfd_URL=http://ftp.gnu.org/gnu/binutils/$(bfd_ARCHIVE) + +LIBS += bzip2 +bzip2_BASENAME=bzip2-1.0.6 +bzip2_ARCHIVE=$(bzip2_BASENAME).tar.gz +bzip2_URL=http://www.bzip.org/1.0.6/$(bzip2_ARCHIVE) + +LIBS += elfutils +elfutils_BASENAME=elfutils-0.163 +elfutils_ARCHIVE=$(elfutils_BASENAME).tar.bz2 +elfutils_URL=https://fedorahosted.org/releases/e/l/elfutils/0.163/$(elfutils_ARCHIVE) + +LIBS += lzma +lzma_BASENAME=xz-5.2.1 +lzma_ARCHIVE=$(lzma_BASENAME).tar.gz +lzma_URL=http://tukaani.org/xz/$(lzma_ARCHIVE) + +LIBS += slang +slang_BASENAME=slang-2.1.4 +slang_ARCHIVE=$(slang_BASENAME).tar.bz2 +slang_URL=http://ftp.ntua.gr/pub/lang/slang/slang/v2.1/$(slang_ARCHIVE) + +LIBS += unwind +unwind_BASENAME=libunwind-1.1 +unwind_ARCHIVE=$(unwind_BASENAME).tar.gz +unwind_URL=http://download.savannah.gnu.org/releases/libunwind/$(unwind_ARCHIVE) + +LIBS += zlib +zlib_BASENAME=zlib-1.2.8 +zlib_ARCHIVE=$(zlib_BASENAME).tar.gz +zlib_URL=http://zlib.net/$(zlib_ARCHIVE) + +DLDIR=dl +DEPSDIR=deps-$(ARCH) +BUILDDIR=build-$(ARCH) +HOST=$(shell echo $(CROSS_COMPILE) | sed 's/.$$//') +PREFIX=$(realpath $(shell pwd))/$(DEPSDIR) +MAKE1=$(MAKE) -j1 + +CC=$(CROSS_COMPILE)gcc + +export CC + +.PHONY: all clean $(LIBS) + +all: $(LIBS) + +define LIB_template +$1_DIR=$$(BUILDDIR)/$$($1_BASENAME) +$1_EXTRACT=$$($1_DIR)/.extract +$1_INSTALL=$$(DEPSDIR)/lib/.$1.install + +$$(DLDIR)/$$($1_ARCHIVE): + mkdir -p $$(DLDIR) && cd $$(DLDIR) && wget -N $$($1_URL) + +$$($1_EXTRACT): $$(DLDIR)/$$($1_ARCHIVE) + mkdir -p $$(BUILDDIR) && tar xf $$< -C $$(BUILDDIR) + touch $$@ + +$1: $$($1_INSTALL) + +$1-clean: + rm -rf $$($1_DIR) +endef + +$(foreach lib,$(LIBS),$(eval $(call LIB_template,$(lib)))) + +$(audit_INSTALL): $(audit_EXTRACT) + cd $(audit_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX) + $(MAKE) -C $(audit_DIR)/lib + $(MAKE) -C $(audit_DIR)/lib install + touch $@ + +CFLAGS=-I$(PREFIX)/include +LDFLAGS=-L$(PREFIX)/lib + +$(bfd_INSTALL): $(zlib_INSTALL) $(bfd_EXTRACT) + cd $(bfd_DIR)/libiberty && ./configure --host=$(HOST) --prefix=$(PREFIX) --enable-install-libiberty + $(MAKE) -C $(bfd_DIR)/libiberty + $(MAKE) -C $(bfd_DIR)/libiberty install + cd $(bfd_DIR)/bfd && CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(HOST) --prefix=$(PREFIX) --with-zlib + $(MAKE) -C $(bfd_DIR)/bfd + $(MAKE) -C $(bfd_DIR)/bfd install + touch $@ + +$(bzip2_INSTALL): $(bzip2_EXTRACT) + $(MAKE) -C $(bzip2_DIR) clean + $(MAKE) CC="$(CC)" PREFIX=$(PREFIX) -C $(bzip2_DIR) -f Makefile-libbz2_so + mkdir -p $(DEPSDIR)/lib + cp -a $(bzip2_DIR)/libbz2.so* $(DEPSDIR)/lib/ + @rm -f $(DEPSDIR)/lib/libbz2.so + # The dynamic library is required to prevent errors while building elfutils + cd $(DEPSDIR)/lib && ln -s libbz2.so.1.0 libbz2.so + $(MAKE) -C $(bzip2_DIR) clean + $(MAKE) CC="$(CC)" PREFIX=$(PREFIX) -C $(bzip2_DIR) install + touch $@ + +elfutils_LDFLAGS=$(LDFLAGS) -Wl,-rpath-link $(PREFIX)/lib + +$(elfutils_INSTALL): $(zlib_INSTALL) $(lzma_INSTALL) $(bzip2_INSTALL) $(elfutils_EXTRACT) + cd $(elfutils_DIR) && CFLAGS="$(CFLAGS)" LDFLAGS="$(elfutils_LDFLAGS)" ./configure --host=$(HOST) --prefix=$(PREFIX) --with-zlib --with-bzlib --with-lzma + $(MAKE) -C $(elfutils_DIR) + $(MAKE) -C $(elfutils_DIR) install + touch $@ + +$(lzma_INSTALL): $(lzma_EXTRACT) + cd $(lzma_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX) + $(MAKE) -C $(lzma_DIR) + $(MAKE) -C $(lzma_DIR) install + touch $@ + +$(slang_INSTALL): $(slang_EXTRACT) + cd $(slang_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX) + $(MAKE1) -C $(slang_DIR) + $(MAKE1) -C $(slang_DIR) install-all + touch $@ + +$(zlib_INSTALL): $(zlib_EXTRACT) + cd $(zlib_DIR) && ./configure --prefix=$(PREFIX) + $(MAKE) -C $(zlib_DIR) + $(MAKE) -C $(zlib_DIR) install + touch $@ + +$(unwind_INSTALL): $(unwind_EXTRACT) + cd $(unwind_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX) --enable-debug --enable-debug-frame + cd $(unwind_DIR) && $(MAKE) + cd $(unwind_DIR) && $(MAKE) install + touch $@ + +clean: + rm -rf $(BUILDDIR) + rm -rf $(DEPSDIR)
tools/perf/Makefile.perf +7 -0
@@ -92,6 +92,13 @@ ifneq ($(objtree),) #$(info Determined 'objtree' to be $(objtree)) endif +ifeq ($(findstring -static,${LDFLAGS}),-static) + ifneq ($(wildcard deps-$(ARCH)/*),) + LDFLAGS += -L $(PWD)/deps-$(ARCH)/lib + EXTRA_CFLAGS += -isystem $(PWD)/deps-$(ARCH)/include + endif +endif + ifneq ($(OUTPUT),) #$(info Determined 'OUTPUT' to be $(OUTPUT)) # Adding $(OUTPUT) as a directory to look for source files,
Signature · 1 line
1.7.10.4
Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
Quoted 6 lines · Rabin Vincent
It's easy to cross-compile a minimal perf binary without any external libraries (other than a C library of course) but if you want more of the juicy features it quickly becomes harder. You need to either cross-compile a bunch of libraries manually and send in the correct paths or integrate the perf build into some external build system.
Quoted 6 lines
In order to make it easier for people to qucikly get up and running with a fairly full featured cross-compiled mainline perf, provide a Makefile.deps which will download and build the required libraries, which can then be used in a static build of perf:
$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps
Makefile.cross_compile or Makefile.cross might suit better
Could you provide more details help/doc on how to use it and what it's actualy doing?
Quoted 18 lines
$ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static"Auto-detecting system features:
... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ OFF ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ OFF ] ... libperl: [ OFF ] ... libpython: [ OFF ] ... libslang: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ OFF ] ... zlib: [ on ] ... lzma: [ on ]
Quoted 1 line
Signed-off-by Rabin Vincent <[email protected]>
running the command from changelog failed on my setup, please check attached log
jirka
---
[jolsa@krava perf]$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps mkdir -p dl && cd dl && wget -N https://people.redhat.com/sgrubb/audit/audit-2.4.4.tar.gz
--2015-10-12 13:36:45-- https://people.redhat.com/sgrubb/audit/audit-2.4.4.tar.gz
Resolving people.redhat.com (people.redhat.com)... 10.5.19.28
Connecting to people.redhat.com (people.redhat.com)|10.5.19.28|:443... connected. HTTP request sent, awaiting response... 200 OK
Length: 1004024 (980K) [application/x-gzip]
Saving to: ‘audit-2.4.4.tar.gz’
audit-2.4.4.tar.gz 100%[=================================================================>] 980.49K 298KB/s in 3.3s
2015-10-12 13:36:50 (298 KB/s) - ‘audit-2.4.4.tar.gz’ saved [1004024/1004024]
mkdir -p build-arm && tar xf dl/audit-2.4.4.tar.gz -C build-arm
touch build-arm/audit-2.4.4/.extract
cd build-arm/audit-2.4.4 && ./configure --host=arm-linux --prefix=/home/jolsa/kernel/linux-perf/tools/perf/deps-arm Configuring auditd
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking target system type... arm-unknown-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for arm-linux-gcc... arm-linux-gcc
checking whether the C compiler works... no
configure: error: in `/home/jolsa/kernel/linux-perf/tools/perf/build-arm/audit-2.4.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
Makefile.deps:77: recipe for target 'deps-arm/lib/.audit.install' failed
make: *** [deps-arm/lib/.audit.install] Error 77
Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
Quoted 9 lines · Jiri Olsa
Quoted 6 lines · Rabin Vincent
In order to make it easier for people to qucikly get up and running with a fairly full featured cross-compiled mainline perf, provide a Makefile.deps which will download and build the required libraries, which can then be used in a static build of perf:
$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.depsMakefile.cross_compile or Makefile.cross might suit better
OK, I will change it to Makefile.cross.
Quoted 2 lines
Could you provide more details help/doc on how to use it and what it's actualy doing?
I will add comments to the file with this information.
Quoted 2 lines
running the command from changelog failed on my setup, please check attached log
Looks like you don't have a compiler with the name arm-linux-gcc in your PATH? The CROSS_COMPILE flag has the same meaning as in the perf and kernel builds: it's the prefix for a cross-toolchain which is available on the host.
Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
Quoted 18 lines · Rabin Vincent
Quoted 9 lines · Jiri Olsa
Quoted 6 lines · Rabin Vincent
In order to make it easier for people to qucikly get up and running with a fairly full featured cross-compiled mainline perf, provide a Makefile.deps which will download and build the required libraries, which can then be used in a static build of perf:
$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.depsMakefile.cross_compile or Makefile.cross might suit better
OK, I will change it to Makefile.cross.
Quoted 2 lines
Could you provide more details help/doc on how to use it and what it's actualy doing?
I will add comments to the file with this information.
Quoted 7 lines
Quoted 2 lines
running the command from changelog failed on my setup, please check attached log
Looks like you don't have a compiler with the name arm-linux-gcc in your PATH? The
CROSS_COMPILEflag has the same meaning as in the perf and kernel builds: it's the prefix for a cross-toolchain which is available on the host.
could the doc have this description as well? to have complete info on how to make it cross compile
thanks,
jirka
Hi Arnaldo,
Do you have any comments on this patch set?
Thanks.
Quoted 44 lines · Rabin Vincent
unw_word_tisuint64_teven on 32-bit MIPS. Cast it touintptr_tbefore the cast to void *p to get rid of the following errors:
util/unwind-libunwind.c: In function 'access_mem':util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [util/unwind-libunwind.o] Error 1Signed-off-by Rabin Vincent <[email protected]>--- tools/perf/util/unwind-libunwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/util/unwind-libunwind.c +2
-2@@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,if (ret) {pr_debug ("unwind: access_mem %p not inside range" " 0x%" PRIx64"-0x%" PRIx64"\n" , - (void *) addr, start, end); + (void *) (uintptr_t ) addr, start, end); *valp =0 ;return ret; }@@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as, offset = addr - start; *valp = *(unw_word_t *)&stack->data[offset];pr_debug ("unwind: access_mem addr %p val %lx, offset %d\n" , - (void *) addr, (unsigned long )*valp, offset); + (void *) (uintptr_t ) addr, (unsigned long )*valp, offset);return 0 ; }Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Arnaldo Carvalho de Melo
maintainerEm Sat, Oct 10, 2015 at 05:49:40PM +0200, Rabin Vincent escreveu:
Quoted 3 lines
Hi Arnaldo,
Do you have any comments on this patch set?
I looked at the patches now, all seem fine from a quick look.
The last patch is interesting, and a more general way of installing what is required for a full build using the native method for a distro, i.e. using yum/dnf/apt/etc would come in handy as well, so that it doesn't look like we recommend this fetch-the-sources-and-build-it method, but sure, that can come later, when someone steps up to that work.
Since this touches the build system and libunwind, areas that Jiri wrote/knows better, I'd like to get his ack, Jiri?
- Arnaldo
Quoted 47 lines
Thanks.
Quoted 44 lines · Rabin Vincent
unw_word_tisuint64_teven on 32-bit MIPS. Cast it touintptr_tbefore the cast to void *p to get rid of the following errors:
util/unwind-libunwind.c: In function 'access_mem':util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [util/unwind-libunwind.o] Error 1Signed-off-by Rabin Vincent <[email protected]>--- tools/perf/util/unwind-libunwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/util/unwind-libunwind.c +2
-2@@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,if (ret) {pr_debug ("unwind: access_mem %p not inside range" " 0x%" PRIx64"-0x%" PRIx64"\n" , - (void *) addr, start, end); + (void *) (uintptr_t ) addr, start, end); *valp =0 ;return ret; }@@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as, offset = addr - start; *valp = *(unw_word_t *)&stack->data[offset];pr_debug ("unwind: access_mem addr %p val %lx, offset %d\n" , - (void *) addr, (unsigned long )*valp, offset); + (void *) (uintptr_t ) addr, (unsigned long )*valp, offset);return 0 ; }Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Jiri Olsa
Acked-byQuoted 7 lines · Arnaldo Carvalho de Melo
Em Sat, Oct 10, 2015 at 05:49:40PM +0200, Rabin Vincent escreveu:
Quoted 3 lines
Hi Arnaldo,
Do you have any comments on this patch set?
I looked at the patches now, all seem fine from a quick look.
Quoted 8 lines
The last patch is interesting, and a more general way of installing what is required for a full build using the native method for a distro, i.e. using yum/dnf/apt/etc would come in handy as well, so that it doesn't look like we recommend this fetch-the-sources-and-build-it method, but sure, that can come later, when someone steps up to that work.
Since this touches the build system and libunwind, areas that Jiri wrote/knows better, I'd like to get his ack, Jiri?
thanks,
jirka
tip-bot for Rabin Vincent
merge bot[tip:perf/core] perf callchains: Fix unw_word_t pointer casts
In reply to Rabin Vincentperf callchains: Fix unw_word_t pointer casts
Commit-ID: 186c6cfb32beae66140bc3c3fe4a519ee0234e33 Gitweb: http://git.kernel.org/tip/186c6cfb32beae66140bc3c3fe4a519ee0234e33 Author: Rabin Vincent <[email protected]> AuthorDate: Sun, 27 Sep 2015 20:37:55 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 12 Oct 2015 23:27:40 -0300
perf callchains: Fix unw_word_t pointer casts
unw_word_t is uint64_t even on 32-bit MIPS. Cast it to uintptr_t before the cast to void *p to get rid of the following errors:
util/unwind-libunwind.c: In function 'access_mem':
util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [util/unwind-libunwind.o] Error 1
--- tools/perf/util/unwind-libunwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/unwind-libunwind.c +2 -2
@@ -463,7 +463,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,if (ret) {pr_debug ("unwind: access_mem %p not inside range" " 0x%" PRIx64"-0x%" PRIx64"\n" , - (void *) addr, start, end); + (void *) (uintptr_t ) addr, start, end); *valp =0 ;return ret; }
@@ -473,7 +473,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as, offset = addr - start; *valp = *(unw_word_t *)&stack->data[offset];pr_debug ("unwind: access_mem addr %p val %lx, offset %d\n" , - (void *) addr, (unsigned long )*valp, offset); + (void *) (uintptr_t ) addr, (unsigned long )*valp, offset);return 0 ; }