linux/tools/perf
Mike Frysinger d14c496588 perf tools: Fix -ldw/-lelf link test when static linking
Since libelf sometimes uses libpthread, we have to list that after -lelf
when someone tries to build statically.  Else things go boom:

Makefile:479: *** No libelf.h/libelf found, please install \
	libelf-dev/elfutils-libelf-devel.  Stop.

Similarly, the -ldw test fails as it often uses -lz:

Makefile:462: No libdw.h found or old libdw.h found or elfutils is older \
	than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev

And if we add debugging to try-cc, we see:
+ echo '#include <dwarf.h>

int main(void)
{
        Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
        return (long)dbg;
}'
+ i686-pc-linux-gnu-gcc -x c - -O2 -pipe -march=atom -mtune=atom -mfpmath=sse -g \
	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
	-ldw -lelf -static -lpthread -lrt -lelf -lm -o .24368
/usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateInit_'
/usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflate'
/usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateReset'
/usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateEnd'

+ echo '#include <libelf.h>

int main(void)
{
        Elf *elf = elf_begin(0, ELF_C_READ, 0);
        return (long)elf;
}'
+ i686-pc-linux-gnu-gcc -x c - -O2 -pipe -march=atom -mtune=atom -mfpmath=sse -g \
	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
	-static -lpthread -lrt -lelf -lm -o .19216
/usr/lib/libelf.a(elf_begin.o):function file_read_elf: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/libelf.a(elf_begin.o):function read_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/libelf.a(elf_begin.o):function lock_dup_elf.8072: error: undefined reference to 'pthread_rwlock_unlock'
/usr/lib/libelf.a(elf_begin.o):function lock_dup_elf.8072: error: undefined reference to 'pthread_rwlock_wrlock'
/usr/lib/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_rdlock'
/usr/lib/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_unlock'

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1368073064-18276-1-git-send-email-vapier@gentoo.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-07-10 13:41:12 -03:00
..
arch perf tools: Fix build on non-glibc systems due to libio.h absence 2013-03-15 13:05:13 -03:00
bench perf bench: Fix memory allocation fail check in mem{set,cpy} workloads 2013-07-08 17:35:40 -03:00
config perf tools: Fix -ldw/-lelf link test when static linking 2013-07-10 13:41:12 -03:00
Documentation perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
python
scripts perf: net_dropmonitor: Remove progress indicator 2013-05-22 15:10:11 -07:00
tests perf tests: Fix exclude_guest|exclude_host checking for attr tests 2013-05-29 15:15:19 +03:00
ui perf top: Add --percent-limit option 2013-05-28 16:24:01 +03:00
util perf tools: Fix perf version generation 2013-07-08 18:09:52 -03:00
.gitignore
bash_completion
builtin-annotate.c perf tools: Add support for weight v7 (modified) 2013-04-01 12:19:43 -03:00
builtin-bench.c perf tools: Make numa benchmark optional 2013-01-30 10:36:21 -03:00
builtin-buildid-cache.c perf buildid-cache: Add --update option 2013-02-14 14:59:27 -03:00
builtin-buildid-list.c perf symbols: Generalize filter in __fprintf_buildid methods 2012-12-09 08:46:07 -03:00
builtin-diff.c perf tools: Fix -x/--exclude-other option for report command 2013-07-08 17:38:53 -03:00
builtin-evlist.c perf evlist: Pass the event_group info via perf_attr_details 2013-02-06 18:09:28 -03:00
builtin-help.c
builtin-inject.c
builtin-kmem.c perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
builtin-kvm.c perf kvm: Handle realloc failures 2013-05-28 16:24:04 +03:00
builtin-list.c
builtin-lock.c perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
builtin-mem.c perf tools: Add new mem command for memory access profiling 2013-04-01 12:21:44 -03:00
builtin-probe.c perf tools: Introduce tools/lib/lk library 2013-03-15 13:06:00 -03:00
builtin-record.c perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
builtin-report.c perf tools: Fix -x/--exclude-other option for report command 2013-07-08 17:38:53 -03:00
builtin-sched.c perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
builtin-script.c perf script: Don't display trace info when invoking scripts 2013-01-24 16:40:52 -03:00
builtin-stat.c perf stat: Fix per-socket output bug for uncore events 2013-07-08 18:01:46 -03:00
builtin-timechart.c perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
builtin-top.c perf tools: Fix -x/--exclude-other option for report command 2013-07-08 17:38:53 -03:00
builtin-trace.c perf trace: Free evlist resources properly on return path 2013-03-15 13:06:11 -03:00
builtin.h perf tools: Add new mem command for memory access profiling 2013-04-01 12:21:44 -03:00
command-list.txt perf tools: Add new mem command for memory access profiling 2013-04-01 12:21:44 -03:00
CREDITS
design.txt
Makefile perf tools: Fix build errors with O and DESTDIR make vars set 2013-07-08 17:34:00 -03:00
MANIFEST perf tools: Introduce tools/lib/lk library 2013-03-15 13:06:00 -03:00
perf-archive.sh
perf.c perf tools: Convert needless static variable to local 2013-04-01 12:22:48 -03:00
perf.h perf tools: Add support for weight v7 (modified) 2013-04-01 12:19:43 -03:00