linux/tools/perf/util
Jiri Olsa b39c2a57a0 perf tools: Fix strict alias issue for find_first_bit
When compiling perf tool code with gcc 4.4.7 I'm getting
following error:

    CC       util/session.o
  cc1: warnings being treated as errors
  util/session.c: In function ‘perf_session_deliver_event’:
  tools/perf/util/include/linux/bitops.h:109: error: dereferencing pointer ‘p’ does break strict-aliasing rules
  tools/perf/util/include/linux/bitops.h:101: error: dereferencing pointer ‘p’ does break strict-aliasing rules
  util/session.c:697: note: initialized from here
  tools/perf/util/include/linux/bitops.h:101: note: initialized from here
  make[1]: *** [util/session.o] Error 1
  make: *** [util/session.o] Error 2

The aliased types here are u64 and unsigned long pointers, which is safe
for the find_first_bit processing.

This error shows up for me only for gcc 4.4 on 32bit x86, even for
-Wstrict-aliasing=3, while newer gcc are quiet and scream here for
-Wstrict-aliasing={2,1}. Looks like newer gcc changed the rules for
strict alias warnings.

The gcc documentation offers workaround for valid aliasing by using
__may_alias__ attribute:

  http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Type-Attributes.html

Using this workaround for the find_first_bit function.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1393434867-20271-1-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-02-28 10:39:40 -03:00
..
include perf tools: Fix strict alias issue for find_first_bit 2014-02-28 10:39:40 -03:00
scripting-engines perf tools: No need to test against NULL before calling free() 2013-12-26 15:58:52 -03:00
abspath.c
alias.c perf tools: Introduce zfree 2013-12-27 15:17:00 -03:00
annotate.c perf annotate: Check availability of annotate when processing samples 2014-02-24 11:12:55 -03:00
annotate.h perf annotate: Check availability of annotate when processing samples 2014-02-24 11:12:55 -03:00
bitmap.c perf tools: Add bitmap_or function into bitmap object 2012-02-13 23:28:10 -02:00
build-id.c perf symbols: Constify some DSO methods parameters 2013-12-10 16:51:10 -03:00
build-id.h perf symbols: Constify some DSO methods parameters 2013-12-10 16:51:10 -03:00
cache.h tools/perf: Turn strlcpy() into a __weak function 2013-10-09 08:48:49 +02:00
callchain.c perf tools: Remove unnecessary callchain cursor state restore on unmatch 2014-01-17 11:25:24 -03:00
callchain.h perf tools: Factor out sample__resolve_callchain() 2014-01-15 15:32:43 -03:00
cgroup.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
cgroup.h perf tool: Add cgroup support 2011-02-16 13:30:48 +01:00
color.c perf diff: Color the Ratio column 2014-01-13 11:37:17 -03:00
color.h perf diff: Color the Ratio column 2014-01-13 11:37:17 -03:00
comm.c perf tools: Do proper comm override error handling 2014-01-16 16:44:39 -03:00
comm.h perf tools: Do proper comm override error handling 2014-01-16 16:44:39 -03:00
config.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
cpumap.c perf fs: Rename NAME_find_mountpoint() to NAME__mountpoint() 2013-11-05 15:15:00 -03:00
cpumap.h perf tools: Rename cpu_map__all() to cpu_map__empty() 2013-07-12 13:45:44 -03:00
ctype.c perf tools: ctype.c only wants util.h 2012-02-13 23:17:40 -02:00
data.c perf tools: Add perf_data_file__write interface 2013-12-02 09:22:46 -03:00
data.h perf tools: Add perf_data_file__write interface 2013-12-02 09:22:46 -03:00
debug.c perf tools: Get rid of a duplicate va_end() in error reporting routine 2013-12-19 11:38:42 -03:00
debug.h perf tools: Overload pr_stat traceevent print function 2013-12-04 15:23:55 -03:00
dso.c perf tools: Introduce zfree 2013-12-27 15:17:00 -03:00
dso.h perf symbols: Use consistent name for the DSO binary type member 2013-12-17 16:34:08 -03:00
dwarf-aux.c perf probe: Fix to find line information for probe list 2013-10-04 15:16:05 -03:00
dwarf-aux.h perf probe: Fix to find line information for probe list 2013-10-04 15:16:05 -03:00
environment.c
event.c perf record: Get ref_reloc_sym from kernel map 2014-01-31 17:21:50 -03:00
event.h perf record: Get ref_reloc_sym from kernel map 2014-01-31 17:21:50 -03:00
evlist.c perf stat: Fix memory corruption of xyarray when cpumask is used 2014-01-20 16:19:09 -03:00
evlist.h perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
evsel.c perf evsel: Remove duplicate member zeroing after free 2014-01-20 16:19:09 -03:00
evsel.h perf tools: Rename 'perf_record_opts' to 'record_opts 2013-12-19 14:43:45 -03:00
exec_cmd.c perf tools: Makefile: Remove various and sundry cruft 2011-02-18 07:43:06 -02:00
exec_cmd.h
fs.c perf fs: Add procfs support 2013-11-05 15:15:07 -03:00
fs.h perf fs: Add procfs support 2013-11-05 15:15:07 -03:00
generate-cmdlist.sh tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT 2013-10-09 08:48:28 +02:00
header.c perf tools: Ensure sscanf does not overrun the "mem" field 2014-01-20 16:19:08 -03:00
header.h perf header: Pack 'struct perf_session_env' 2014-01-13 10:06:23 -03:00
help.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
help.h
hist.c perf hists: Convert hist entry functions to use struct he_stat 2014-01-15 15:34:00 -03:00
hist.h perf annotate: Adopt methods from hists 2013-12-19 11:34:27 -03:00
hweight.c
intlist.c perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
intlist.h perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
levenshtein.c
levenshtein.h
machine.c perf machine: Set up ref_reloc_sym in machine__create_kernel_maps() 2014-01-31 17:21:49 -03:00
machine.h perf machine: Set up ref_reloc_sym in machine__create_kernel_maps() 2014-01-31 17:21:49 -03:00
map.c perf symbols: Fix symbol annotation for relocated kernel 2014-01-31 17:21:47 -03:00
map.h perf symbols: Fix symbol annotation for relocated kernel 2014-01-31 17:21:47 -03:00
pager.c perf tools: Fix pager on minimal-install embedded systems 2012-05-30 15:10:39 -03:00
parse-events.c perf list: Fix checking for supported events on older kernels 2014-02-10 11:34:31 -03:00
parse-events.h perf parse events: Demystify memory allocations 2013-07-12 13:52:05 -03:00
parse-events.l perf tools: Move start conditions to start of the flex file 2013-10-11 12:17:31 -03:00
parse-events.y perf parse events: Demystify memory allocations 2013-07-12 13:52:05 -03:00
parse-options.c perf tools: Add option macro OPT_BOOLEAN_SET 2013-11-27 14:58:36 -03:00
parse-options.h perf tools: Add option macro OPT_BOOLEAN_SET 2013-11-27 14:58:36 -03:00
path.c tools/perf: Turn strlcpy() into a __weak function 2013-10-09 08:48:49 +02:00
perf_regs.h tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT 2013-10-09 08:48:28 +02:00
PERF-VERSION-GEN perf tools: Fix version when building out of tree 2013-11-07 10:40:47 -03:00
pmu.c perf stat: fix NULL pointer reference bug with event unit 2014-01-20 16:19:08 -03:00
pmu.h perf stat: fix NULL pointer reference bug with event unit 2014-01-20 16:19:08 -03:00
pmu.l perf tools: Add perf pmu object to access pmu format definition 2012-03-16 14:29:35 -03:00
pmu.y perf tools: Fix build with bison 2.3 and older. 2013-02-14 16:12:34 -03:00
probe-event.c perf probe: Do not add offset twice to uprobe address 2014-02-10 11:34:30 -03:00
probe-event.h perf probe: Release all dynamically allocated parameters 2014-01-16 16:29:02 -03:00
probe-finder.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
probe-finder.h perf tools: Finish the removal of 'self' arguments 2013-11-05 15:32:36 -03:00
pstack.c perf tools: Stop using 'self' in pstack 2012-11-14 16:50:38 -03:00
pstack.h perf tools: Finish the removal of 'self' arguments 2013-11-05 15:32:36 -03:00
python-ext-sources perf tools: Add trace-event object 2013-12-04 15:20:52 -03:00
python.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
quote.c
quote.h
rblist.c perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
rblist.h perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
record.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
run-command.c
run-command.h
session.c perf tools: Handle PERF_RECORD_HEADER_EVENT_TYPE properly 2014-02-10 11:34:31 -03:00
session.h perf symbols: Add 'machine' member to struct addr_location 2013-12-19 17:38:27 -03:00
setup.py tools/: Convert to new topic libraries 2013-12-16 16:03:27 -03:00
sigchain.c
sigchain.h
sort.c perf sort: Do not compare dso again 2013-12-18 14:43:04 -03:00
sort.h perf tools: Remove unneeded include 2013-11-07 11:51:19 -03:00
srcline.c perf tools: Fix build error due to zfree() cast 2014-01-15 15:10:04 -03:00
stat.c perf stats: Add max and min stats 2013-08-07 17:35:26 -03:00
stat.h perf stats: Add max and min stats 2013-08-07 17:35:26 -03:00
strbuf.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
strbuf.h
strfilter.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
strfilter.h perf tools: Finish the removal of 'self' arguments 2013-11-05 15:32:36 -03:00
string.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
strlist.c perf tools: Fix build error due to zfree() cast 2014-01-15 15:10:04 -03:00
strlist.h perf tools: Stop using 'self' in strlist 2013-01-25 12:49:28 -03:00
svghelper.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
svghelper.h perf timechart: Add --highlight option 2013-12-17 16:33:55 -03:00
symbol-elf.c perf symbols: Fix symbol annotation for relocated kernel 2014-01-31 17:21:47 -03:00
symbol-minimal.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
symbol.c perf symbols: Destroy unused symsrcs 2014-02-24 11:13:08 -03:00
symbol.h perf symbols: Export elf_section_by_name and reuse 2014-01-16 16:29:44 -03:00
target.c perf record: Make per-cpu mmaps the default. 2013-11-27 14:58:36 -03:00
target.h perf target: Move the checking of which map function to call into function. 2013-12-04 13:46:37 -03:00
thread_map.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
thread_map.h perf evlist: Add thread_map__nr() helper 2013-03-15 13:06:02 -03:00
thread.c perf tools: Do proper comm override error handling 2014-01-16 16:44:39 -03:00
thread.h perf thread: Move comm_list check into function 2013-11-27 14:58:37 -03:00
tool.h perf tools: Add attr->mmap2 support 2013-09-11 10:09:32 -03:00
top.c perf tools: Rename 'perf_record_opts' to 'record_opts 2013-12-19 14:43:45 -03:00
top.h perf tools: Rename 'perf_record_opts' to 'record_opts 2013-12-19 14:43:45 -03:00
trace-event-info.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
trace-event-parse.c perf tools: Add trace-event object 2013-12-04 15:20:52 -03:00
trace-event-read.c perf tools: Add trace-event object 2013-12-04 15:20:52 -03:00
trace-event-scripting.c perf symbols: Add 'machine' member to struct addr_location 2013-12-19 17:38:27 -03:00
trace-event.c tools lib traceevent: Make plugin unload function receive pevent 2014-01-15 15:10:40 -03:00
trace-event.h perf symbols: Add 'machine' member to struct addr_location 2013-12-19 17:38:27 -03:00
types.h perf tools: Add union u64_swap type for swapping u64 data 2012-05-22 12:50:25 -03:00
unwind.c perf symbols: Export elf_section_by_name and reuse 2014-01-16 16:29:44 -03:00
unwind.h perf symbols: Limit max callchain using max_stack on DWARF unwinding too 2013-11-14 16:00:23 -03:00
usage.c perf target: Introduce perf_target__parse_uid() 2012-05-07 16:46:48 -03:00
util.c perf tools: Move mem_bswap32/64 to util.c 2013-12-13 10:30:21 -03:00
util.h perf tools: Introduce zfree 2013-12-27 15:17:00 -03:00
values.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
values.h
vdso.c perf symbols: Remove open coded management of long_name_allocated member 2013-12-10 16:51:09 -03:00
vdso.h perf tools: Back [vdso] DSO with real data 2012-09-11 12:08:30 -03:00
wrapper.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
xyarray.c
xyarray.h