public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix build error on zfree()
@ 2014-01-09 14:07 Namhyung Kim
  2014-01-13 18:00 ` Arnaldo Carvalho de Melo
  2014-01-16 13:37 ` [tip:perf/core] perf tools: Fix build error due to zfree() cast tip-bot for Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2014-01-09 14:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Ingo Molnar, Peter Zijlstra, LKML, Namhyung Kim

It failed to build perf on my ubuntu 10.04 box (gcc 4.4.3):

    CC       util/strlist.o
  cc1: warnings being treated as errors
  util/strlist.c: In function ‘str_node__delete’:
  util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
    CC       util/strfilter.o
  make: *** [util/strlist.o] Error 1

    CC       util/srcline.o
  cc1: warnings being treated as errors
  util/srcline.c: In function ‘addr2line_init’:
  util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c: In function ‘addr2line_cleanup’:
  util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
  make: *** [util/srcline.o] Error 1

It seems it only allows to remove 'const' qualifier.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/srcline.c |    4 ++--
 tools/perf/util/strlist.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 7e67879ebd25..f3e4bc5fe5d2 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -129,7 +129,7 @@ static struct a2l_data *addr2line_init(const char *path)
 
 out:
 	if (a2l) {
-		zfree((void **)&a2l->input);
+		zfree((char **)&a2l->input);
 		free(a2l);
 	}
 	bfd_close(abfd);
@@ -140,7 +140,7 @@ static void addr2line_cleanup(struct a2l_data *a2l)
 {
 	if (a2l->abfd)
 		bfd_close(a2l->abfd);
-	zfree((void **)&a2l->input);
+	zfree((char **)&a2l->input);
 	zfree(&a2l->syms);
 	free(a2l);
 }
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 61a90bf24b4d..71f9d102b96f 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -39,7 +39,7 @@ out_delete:
 static void str_node__delete(struct str_node *snode, bool dupstr)
 {
 	if (dupstr)
-		zfree((void **)&snode->s);
+		zfree((char **)&snode->s);
 	free(snode);
 }
 
-- 
1.7.9.2


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

* Re: [PATCH] perf tools: Fix build error on zfree()
  2014-01-09 14:07 [PATCH] perf tools: Fix build error on zfree() Namhyung Kim
@ 2014-01-13 18:00 ` Arnaldo Carvalho de Melo
  2014-01-14 14:21   ` Namhyung Kim
  2014-01-16 13:37 ` [tip:perf/core] perf tools: Fix build error due to zfree() cast tip-bot for Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-01-13 18:00 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, LKML, Namhyung Kim

Em Thu, Jan 09, 2014 at 11:07:59PM +0900, Namhyung Kim escreveu:
> It failed to build perf on my ubuntu 10.04 box (gcc 4.4.3):
> 
>     CC       util/strlist.o
>   cc1: warnings being treated as errors
>   util/strlist.c: In function ‘str_node__delete’:
>   util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
>   util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
>     CC       util/strfilter.o
>   make: *** [util/strlist.o] Error 1
> 
>     CC       util/srcline.o
>   cc1: warnings being treated as errors
>   util/srcline.c: In function ‘addr2line_init’:
>   util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
>   util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
>   util/srcline.c: In function ‘addr2line_cleanup’:
>   util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
>   util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
>   make: *** [util/srcline.o] Error 1
> 
> It seems it only allows to remove 'const' qualifier.

Humm, I just tried building it here on:

acme@ubuntu13:~/git/linux$ uname -a
Linux ubuntu13 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
acme@ubuntu13:~/git/linux$ cat /etc/debian_version 
wheezy/sid
acme@ubuntu13:~/git/linux$

acme@ubuntu13:~/git/linux$ make O=/tmp/build/perf -C tools/perf install
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
...                     backtrace: [ on  ]
...                         dwarf: [ OFF ]
...                fortify-source: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                  gtk2-infobar: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ OFF ]
...                        libelf: [ OFF ]
...             libelf-getphdrnum: [ OFF ]
...                   libelf-mmap: [ OFF ]
...                       libnuma: [ OFF ]
...                       libperl: [ OFF ]
...                     libpython: [ OFF ]
...             libpython-version: [ OFF ]
...                      libslang: [ OFF ]
...                     libunwind: [ OFF ]
...                       on-exit: [ on  ]
...            stackprotector-all: [ on  ]
...                       timerfd: [ on  ]

config/Makefile:276: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
config/Makefile:327: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1
config/Makefile:350: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:364: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:377: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:438: The path '/usr/bin/python-config' is not executable.
config/Makefile:442: No python-config tool was found
config/Makefile:442: Python support will not be built
config/Makefile:532: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
  MKDIR    /tmp/build/perf/arch
<SNIP>
  CC       /tmp/build/perf/util/strlist.o
<SNIP>
  CC       /tmp/build/perf/util/parse-events.o
  CC       /tmp/build/perf/util/parse-events-flex.o
  AR       /tmp/build/perf/libperf.a
  LINK     /tmp/build/perf/perf
  INSTALL  binaries
  INSTALL  libexec
  INSTALL  perf-archive
  INSTALL  perf_completion-script
  INSTALL  tests
make: Leaving directory `/home/acme/git/linux/tools/perf'
acme@ubuntu13:~/git/linux$ 

Works just fine, can you provide more details about your system? Is it 32-bit?

I'm installing more devel packages to this just installed 64-bit VM system and
will install another VM with a 32-bit Ubuntu with the same version as you.

- Arnaldo

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

* Re: [PATCH] perf tools: Fix build error on zfree()
  2014-01-13 18:00 ` Arnaldo Carvalho de Melo
@ 2014-01-14 14:21   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2014-01-14 14:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Ingo Molnar, Peter Zijlstra, LKML, Namhyung Kim

2014-01-13 (월), 15:00 -0300, Arnaldo Carvalho de Melo:
> Em Thu, Jan 09, 2014 at 11:07:59PM +0900, Namhyung Kim escreveu:
> > It failed to build perf on my ubuntu 10.04 box (gcc 4.4.3):
> > 
> >     CC       util/strlist.o
> >   cc1: warnings being treated as errors
> >   util/strlist.c: In function ‘str_node__delete’:
> >   util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
> >   util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
> >     CC       util/strfilter.o
> >   make: *** [util/strlist.o] Error 1
> > 
> >     CC       util/srcline.o
> >   cc1: warnings being treated as errors
> >   util/srcline.c: In function ‘addr2line_init’:
> >   util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
> >   util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
> >   util/srcline.c: In function ‘addr2line_cleanup’:
> >   util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
> >   util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
> >   make: *** [util/srcline.o] Error 1
> > 
> > It seems it only allows to remove 'const' qualifier.
> 
> Humm, I just tried building it here on:
> 
> acme@ubuntu13:~/git/linux$ uname -a
> Linux ubuntu13 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> acme@ubuntu13:~/git/linux$ cat /etc/debian_version 
> wheezy/sid
> acme@ubuntu13:~/git/linux$
> 
> acme@ubuntu13:~/git/linux$ make O=/tmp/build/perf -C tools/perf install
> make: Entering directory `/home/acme/git/linux/tools/perf'
>   BUILD:   Doing 'make -j4' parallel build
> 
> Auto-detecting system features:
> ...                     backtrace: [ on  ]
> ...                         dwarf: [ OFF ]
> ...                fortify-source: [ on  ]
> ...                         glibc: [ on  ]
> ...                          gtk2: [ OFF ]
> ...                  gtk2-infobar: [ OFF ]
> ...                      libaudit: [ OFF ]
> ...                        libbfd: [ OFF ]
> ...                        libelf: [ OFF ]
> ...             libelf-getphdrnum: [ OFF ]
> ...                   libelf-mmap: [ OFF ]
> ...                       libnuma: [ OFF ]
> ...                       libperl: [ OFF ]
> ...                     libpython: [ OFF ]
> ...             libpython-version: [ OFF ]
> ...                      libslang: [ OFF ]
> ...                     libunwind: [ OFF ]
> ...                       on-exit: [ on  ]
> ...            stackprotector-all: [ on  ]
> ...                       timerfd: [ on  ]
> 
> config/Makefile:276: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
> config/Makefile:327: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1
> config/Makefile:350: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
> config/Makefile:364: slang not found, disables TUI support. Please install slang-devel or libslang-dev
> config/Makefile:377: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
> config/Makefile:438: The path '/usr/bin/python-config' is not executable.
> config/Makefile:442: No python-config tool was found
> config/Makefile:442: Python support will not be built
> config/Makefile:532: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
>   MKDIR    /tmp/build/perf/arch
> <SNIP>
>   CC       /tmp/build/perf/util/strlist.o
> <SNIP>
>   CC       /tmp/build/perf/util/parse-events.o
>   CC       /tmp/build/perf/util/parse-events-flex.o
>   AR       /tmp/build/perf/libperf.a
>   LINK     /tmp/build/perf/perf
>   INSTALL  binaries
>   INSTALL  libexec
>   INSTALL  perf-archive
>   INSTALL  perf_completion-script
>   INSTALL  tests
> make: Leaving directory `/home/acme/git/linux/tools/perf'
> acme@ubuntu13:~/git/linux$ 
> 
> Works just fine, can you provide more details about your system? Is it 32-bit?

Nope, it's a 64-bit machine.

$ uname -a 
Linux leonhard 2.6.32-45-generic #104-Ubuntu SMP Tue Feb 19 21:20:09 UTC
2013 x86_64 GNU/Linux

$ cat /etc/debian_version 
squeeze/sid

$ make
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
...                     backtrace: [ on  ]
...                         dwarf: [ on  ]
...                fortify-source: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ on  ]
...                  gtk2-infobar: [ on  ]
...                      libaudit: [ on  ]
...                        libbfd: [ on  ]
...                        libelf: [ on  ]
...             libelf-getphdrnum: [ OFF ]
...                   libelf-mmap: [ on  ]
...                       libnuma: [ OFF ]
...                       libperl: [ on  ]
...                     libpython: [ on  ]
...             libpython-version: [ on  ]
...                      libslang: [ on  ]
...                     libunwind: [ OFF ]
...                       on-exit: [ on  ]
...            stackprotector-all: [ on  ]
...                       timerfd: [ on  ]

config/Makefile:327: No libunwind found, disabling post unwind support.
Please install libunwind-dev[el] >= 1.1
config/Makefile:532: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
  GEN      common-cmds.h
<SNIP>
  CC       util/strlist.o
  CC       util/string.o
cc1: warnings being treated as errors
util/strlist.c: In function ‘str_node__delete’:
util/strlist.c:42: error: dereferencing type-punned pointer will break
strict-aliasing rules
util/strlist.c:42: error: dereferencing type-punned pointer will break
strict-aliasing rules
make[1]: *** [util/strlist.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


Thanks,
Namhyung




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

* [tip:perf/core] perf tools: Fix build error due to zfree() cast
  2014-01-09 14:07 [PATCH] perf tools: Fix build error on zfree() Namhyung Kim
  2014-01-13 18:00 ` Arnaldo Carvalho de Melo
@ 2014-01-16 13:37 ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Namhyung Kim @ 2014-01-16 13:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, peterz, namhyung.kim,
	mark.rutland, namhyung, tglx

Commit-ID:  7d16c634233c411f54b89d0f1d51750dc85c5f7e
Gitweb:     http://git.kernel.org/tip/7d16c634233c411f54b89d0f1d51750dc85c5f7e
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 9 Jan 2014 23:07:59 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 15 Jan 2014 15:10:04 -0300

perf tools: Fix build error due to zfree() cast

It failed to build perf on my ubuntu 10.04 box (gcc 4.4.3):

    CC       util/strlist.o
  cc1: warnings being treated as errors
  util/strlist.c: In function ‘str_node__delete’:
  util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/strlist.c:42: error: dereferencing type-punned pointer will break strict-aliasing rules
    CC       util/strfilter.o
  make: *** [util/strlist.o] Error 1

    CC       util/srcline.o
  cc1: warnings being treated as errors
  util/srcline.c: In function ‘addr2line_init’:
  util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c:132: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c: In function ‘addr2line_cleanup’:
  util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
  util/srcline.c:143: error: dereferencing type-punned pointer will break strict-aliasing rules
  make: *** [util/srcline.o] Error 1

It seems it only allows to remove 'const' qualifier.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1389276479-9047-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/srcline.c | 4 ++--
 tools/perf/util/strlist.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 7e67879..f3e4bc5 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -129,7 +129,7 @@ static struct a2l_data *addr2line_init(const char *path)
 
 out:
 	if (a2l) {
-		zfree((void **)&a2l->input);
+		zfree((char **)&a2l->input);
 		free(a2l);
 	}
 	bfd_close(abfd);
@@ -140,7 +140,7 @@ static void addr2line_cleanup(struct a2l_data *a2l)
 {
 	if (a2l->abfd)
 		bfd_close(a2l->abfd);
-	zfree((void **)&a2l->input);
+	zfree((char **)&a2l->input);
 	zfree(&a2l->syms);
 	free(a2l);
 }
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 61a90bf..71f9d10 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -39,7 +39,7 @@ out_delete:
 static void str_node__delete(struct str_node *snode, bool dupstr)
 {
 	if (dupstr)
-		zfree((void **)&snode->s);
+		zfree((char **)&snode->s);
 	free(snode);
 }
 

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

end of thread, other threads:[~2014-01-16 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 14:07 [PATCH] perf tools: Fix build error on zfree() Namhyung Kim
2014-01-13 18:00 ` Arnaldo Carvalho de Melo
2014-01-14 14:21   ` Namhyung Kim
2014-01-16 13:37 ` [tip:perf/core] perf tools: Fix build error due to zfree() cast tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox