* [patch] perf build questions
@ 2009-10-05 20:17 Randy Dunlap
2009-10-05 20:47 ` Frederic Weisbecker
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Randy Dunlap @ 2009-10-05 20:17 UTC (permalink / raw)
To: lkml; +Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar
Hi,
How do I build 'perf' for an i386 target when running on x86_64?
and how do I do 'perf' cross-builds in general?
Also, I see build errors/warnings (-Werror). Others aren't seeing these?
Just due to my gcc version?
Patch below.
Thanks.
---
From: Randy Dunlap <randy.dunlap@oracle.com>
Fix perf build warnings/errors in function argument types:
builtin-sched.c:1894: warning: passing argument 1 of 'sort_dimension__add' discards qualifiers from pointer target type
util/trace-event-parse.c:685: warning: passing argument 2 of 'read_expected' discards qualifiers from pointer target type
util/trace-event-parse.c:741: warning: passing argument 4 of 'test_type_token' discards qualifiers from pointer target type
util/trace-event-parse.c:706: warning: passing argument 2 of 'read_expected_item' discards qualifiers from pointer target type
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
tools/perf/builtin-sched.c | 2 +-
tools/perf/util/trace-event-parse.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1287,7 +1287,7 @@ static struct sort_dimension *available_
static LIST_HEAD(sort_list);
-static int sort_dimension__add(char *tok, struct list_head *list)
+static int sort_dimension__add(const char *tok, struct list_head *list)
{
int i;
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -618,7 +618,7 @@ static int test_type(enum event_type typ
}
static int test_type_token(enum event_type type, char *token,
- enum event_type expect, char *expect_tok)
+ enum event_type expect, const char *expect_tok)
{
if (type != expect) {
die("Error: expected type %d but read %d",
@@ -650,7 +650,7 @@ static int read_expect_type(enum event_t
return __read_expect_type(expect, tok, 1);
}
-static int __read_expected(enum event_type expect, char *str, int newline_ok)
+static int __read_expected(enum event_type expect, const char *str, int newline_ok)
{
enum event_type type;
char *token;
@@ -668,12 +668,12 @@ static int __read_expected(enum event_ty
return 0;
}
-static int read_expected(enum event_type expect, char *str)
+static int read_expected(enum event_type expect, const char *str)
{
return __read_expected(expect, str, 1);
}
-static int read_expected_item(enum event_type expect, char *str)
+static int read_expected_item(enum event_type expect, const char *str)
{
return __read_expected(expect, str, 0);
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-05 20:17 [patch] perf build questions Randy Dunlap
@ 2009-10-05 20:47 ` Frederic Weisbecker
2009-10-06 8:48 ` Peter Zijlstra
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-10-05 20:47 UTC (permalink / raw)
To: Randy Dunlap; +Cc: lkml, Peter Zijlstra, Paul Mackerras, Ingo Molnar
On Mon, Oct 05, 2009 at 01:17:29PM -0700, Randy Dunlap wrote:
> Hi,
>
> How do I build 'perf' for an i386 target when running on x86_64?
> and how do I do 'perf' cross-builds in general?
>
I let someone else who knows that better than me answer to that.
But you may need to override the CC var in the makefile for now.
This is something we should make tunable.
> Also, I see build errors/warnings (-Werror). Others aren't seeing these?
> Just due to my gcc version?
>
> Patch below.
>
> Thanks.
Oh thanks. I've never seen them.
The builtin-sched.c warning is right.
But the util/trace-event-parse.c warnings are wrong since the parameters
passed to these functions are always cast to char *
But that is wrong too, these functions should take const char * and
not char * as they never need to touch these strings.
So your patch is correct, I'll just convert the callsites. It's
my bad, I've put these casts to shutdown such warnings while integrating
the trace-cmd lib. I was distracted by harder integration problems.
Thanks.
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> From: Randy Dunlap <randy.dunlap@oracle.com>
>
> Fix perf build warnings/errors in function argument types:
>
> builtin-sched.c:1894: warning: passing argument 1 of 'sort_dimension__add' discards qualifiers from pointer target type
> util/trace-event-parse.c:685: warning: passing argument 2 of 'read_expected' discards qualifiers from pointer target type
> util/trace-event-parse.c:741: warning: passing argument 4 of 'test_type_token' discards qualifiers from pointer target type
> util/trace-event-parse.c:706: warning: passing argument 2 of 'read_expected_item' discards qualifiers from pointer target type
>
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
> tools/perf/builtin-sched.c | 2 +-
> tools/perf/util/trace-event-parse.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -1287,7 +1287,7 @@ static struct sort_dimension *available_
>
> static LIST_HEAD(sort_list);
>
> -static int sort_dimension__add(char *tok, struct list_head *list)
> +static int sort_dimension__add(const char *tok, struct list_head *list)
> {
> int i;
>
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -618,7 +618,7 @@ static int test_type(enum event_type typ
> }
>
> static int test_type_token(enum event_type type, char *token,
> - enum event_type expect, char *expect_tok)
> + enum event_type expect, const char *expect_tok)
> {
> if (type != expect) {
> die("Error: expected type %d but read %d",
> @@ -650,7 +650,7 @@ static int read_expect_type(enum event_t
> return __read_expect_type(expect, tok, 1);
> }
>
> -static int __read_expected(enum event_type expect, char *str, int newline_ok)
> +static int __read_expected(enum event_type expect, const char *str, int newline_ok)
> {
> enum event_type type;
> char *token;
> @@ -668,12 +668,12 @@ static int __read_expected(enum event_ty
> return 0;
> }
>
> -static int read_expected(enum event_type expect, char *str)
> +static int read_expected(enum event_type expect, const char *str)
> {
> return __read_expected(expect, str, 1);
> }
>
> -static int read_expected_item(enum event_type expect, char *str)
> +static int read_expected_item(enum event_type expect, const char *str)
> {
> return __read_expected(expect, str, 0);
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-05 20:17 [patch] perf build questions Randy Dunlap
2009-10-05 20:47 ` Frederic Weisbecker
@ 2009-10-06 8:48 ` Peter Zijlstra
2009-10-06 17:26 ` Randy Dunlap
2009-10-12 6:35 ` Ingo Molnar
2009-10-12 6:52 ` [tip:perf/urgent] perf tools: Fix const char type propagation tip-bot for Randy Dunlap
3 siblings, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2009-10-06 8:48 UTC (permalink / raw)
To: Randy Dunlap; +Cc: lkml, Paul Mackerras, Ingo Molnar
On Mon, 2009-10-05 at 13:17 -0700, Randy Dunlap wrote:
> Hi,
>
> How do I build 'perf' for an i386 target when running on x86_64?
make NO_64BIT=1
> and how do I do 'perf' cross-builds in general?
make CC=arm-linux-gcc AR=arm-linux-ar STRIP=arm-linux-strip
I think,.. but I don't have full cross build environments, just the bare
binutils+gcc bits to cross build kernels.
> Also, I see build errors/warnings (-Werror). Others aren't seeing these?
> Just due to my gcc version?
Didn't see any here, but what frederic said..
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-06 8:48 ` Peter Zijlstra
@ 2009-10-06 17:26 ` Randy Dunlap
2009-10-06 18:02 ` Peter Zijlstra
2009-10-06 18:05 ` Kyle McMartin
0 siblings, 2 replies; 12+ messages in thread
From: Randy Dunlap @ 2009-10-06 17:26 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: lkml, Paul Mackerras, Ingo Molnar
On Tue, 06 Oct 2009 10:48:59 +0200 Peter Zijlstra wrote:
> On Mon, 2009-10-05 at 13:17 -0700, Randy Dunlap wrote:
> > Hi,
> >
> > How do I build 'perf' for an i386 target when running on x86_64?
>
> make NO_64BIT=1
$ make NO_64BIT=1 all
$ file perf
perf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
Shouldn't that be a 32-bit executable for i386?
Am I confused? (you don't have to answer that)
> > and how do I do 'perf' cross-builds in general?
>
> make CC=arm-linux-gcc AR=arm-linux-ar STRIP=arm-linux-strip
>
> I think,.. but I don't have full cross build environments, just the bare
> binutils+gcc bits to cross build kernels.
>
> > Also, I see build errors/warnings (-Werror). Others aren't seeing these?
> > Just due to my gcc version?
>
> Didn't see any here, but what frederic said..
---
~Randy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-06 17:26 ` Randy Dunlap
@ 2009-10-06 18:02 ` Peter Zijlstra
2009-10-06 18:05 ` Kyle McMartin
1 sibling, 0 replies; 12+ messages in thread
From: Peter Zijlstra @ 2009-10-06 18:02 UTC (permalink / raw)
To: Randy Dunlap; +Cc: lkml, Paul Mackerras, Ingo Molnar
On Tue, 2009-10-06 at 10:26 -0700, Randy Dunlap wrote:
> On Tue, 06 Oct 2009 10:48:59 +0200 Peter Zijlstra wrote:
>
> > On Mon, 2009-10-05 at 13:17 -0700, Randy Dunlap wrote:
> > > Hi,
> > >
> > > How do I build 'perf' for an i386 target when running on x86_64?
> >
> > make NO_64BIT=1
>
> $ make NO_64BIT=1 all
> $ file perf
> perf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
>
>
> Shouldn't that be a 32-bit executable for i386?
> Am I confused? (you don't have to answer that)
# uname -a
Linux twins 2.6.31-tip #212 SMP PREEMPT Tue Sep 22 12:02:22 CEST 2009
x86_64 GNU/Linux
# rm perf
# make NO_64BIT=1 perf
# file perf
perf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not
stripped
seems to work for me...
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-06 17:26 ` Randy Dunlap
2009-10-06 18:02 ` Peter Zijlstra
@ 2009-10-06 18:05 ` Kyle McMartin
2009-10-06 18:09 ` Randy Dunlap
1 sibling, 1 reply; 12+ messages in thread
From: Kyle McMartin @ 2009-10-06 18:05 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Peter Zijlstra, lkml, Paul Mackerras, Ingo Molnar
On Tue, Oct 06, 2009 at 10:26:26AM -0700, Randy Dunlap wrote:
> $ make NO_64BIT=1 all
> $ file perf
> perf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
>
>
> Shouldn't that be a 32-bit executable for i386?
> Am I confused? (you don't have to answer that)
>
Are you running a 32-bit userspace, with x86_64 kernel? Or running
x86_64 userspace as well and trying to crossbuild for i386? In the
latter case NO_64BIT won't do what you hope, it's to avoid trying to
build a 64-bit binary in the former case.
You could force -m32 into CFLAGS in the second case, but unless you have
the proper i386 bi-arch toolchain installed (glibc, etc.) it likely
won't build...
regards, Kyle
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-06 18:05 ` Kyle McMartin
@ 2009-10-06 18:09 ` Randy Dunlap
2009-10-12 8:47 ` Ingo Molnar
0 siblings, 1 reply; 12+ messages in thread
From: Randy Dunlap @ 2009-10-06 18:09 UTC (permalink / raw)
To: Kyle McMartin; +Cc: Peter Zijlstra, lkml, Paul Mackerras, Ingo Molnar
On Tue, 6 Oct 2009 14:05:51 -0400 Kyle McMartin wrote:
> On Tue, Oct 06, 2009 at 10:26:26AM -0700, Randy Dunlap wrote:
> > $ make NO_64BIT=1 all
> > $ file perf
> > perf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
> >
> >
> > Shouldn't that be a 32-bit executable for i386?
> > Am I confused? (you don't have to answer that)
> >
>
> Are you running a 32-bit userspace, with x86_64 kernel? Or running
> x86_64 userspace as well and trying to crossbuild for i386? In the
> latter case NO_64BIT won't do what you hope, it's to avoid trying to
> build a 64-bit binary in the former case.
All 64-bit userspace & kernel. so that fails. Thanks.
> You could force -m32 into CFLAGS in the second case, but unless you have
> the proper i386 bi-arch toolchain installed (glibc, etc.) it likely
> won't build...
I'll test/check etc.
---
~Randy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-05 20:17 [patch] perf build questions Randy Dunlap
2009-10-05 20:47 ` Frederic Weisbecker
2009-10-06 8:48 ` Peter Zijlstra
@ 2009-10-12 6:35 ` Ingo Molnar
2009-10-12 15:33 ` Randy Dunlap
2009-10-12 6:52 ` [tip:perf/urgent] perf tools: Fix const char type propagation tip-bot for Randy Dunlap
3 siblings, 1 reply; 12+ messages in thread
From: Ingo Molnar @ 2009-10-12 6:35 UTC (permalink / raw)
To: Randy Dunlap; +Cc: lkml, Peter Zijlstra, Paul Mackerras
* Randy Dunlap <randy.dunlap@oracle.com> wrote:
> Also, I see build errors/warnings (-Werror). Others aren't seeing these?
> Just due to my gcc version?
Thanks for the fix. Which GCC version is this btw?
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* [tip:perf/urgent] perf tools: Fix const char type propagation
2009-10-05 20:17 [patch] perf build questions Randy Dunlap
` (2 preceding siblings ...)
2009-10-12 6:35 ` Ingo Molnar
@ 2009-10-12 6:52 ` tip-bot for Randy Dunlap
3 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Randy Dunlap @ 2009-10-12 6:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, randy.dunlap,
fweisbec, tglx, mingo
Commit-ID: cbef79a82a64ec13e745ce2b0274154ae1e47243
Gitweb: http://git.kernel.org/tip/cbef79a82a64ec13e745ce2b0274154ae1e47243
Author: Randy Dunlap <randy.dunlap@oracle.com>
AuthorDate: Mon, 5 Oct 2009 13:17:29 -0700
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 12 Oct 2009 08:35:00 +0200
perf tools: Fix const char type propagation
The following perf build warnings/errors in function
argument types:
builtin-sched.c:1894: warning: passing argument 1 of 'sort_dimension__add' discards qualifiers from pointer target type
util/trace-event-parse.c:685: warning: passing argument 2 of 'read_expected' discards qualifiers from pointer target type
util/trace-event-parse.c:741: warning: passing argument 4 of 'test_type_token' discards qualifiers from pointer target type
util/trace-event-parse.c:706: warning: passing argument 2 of 'read_expected_item' discards qualifiers from pointer target type
... trigger because older GCC is not able to prove that
sort_dimension__add() does not change the string.
Some goes for test_type_token().
Fix this by improving type consistency.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091005131729.78444bfb.randy.dunlap@oracle.com>
[ Also remove ugly type cast now unnecessary. ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-sched.c | 4 ++--
tools/perf/util/trace-event-parse.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ea9c15c..ce2d5be 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1287,7 +1287,7 @@ static struct sort_dimension *available_sorts[] = {
static LIST_HEAD(sort_list);
-static int sort_dimension__add(char *tok, struct list_head *list)
+static int sort_dimension__add(const char *tok, struct list_head *list)
{
int i;
@@ -1917,7 +1917,7 @@ static void setup_sorting(void)
free(str);
- sort_dimension__add((char *)"pid", &cmp_pid);
+ sort_dimension__add("pid", &cmp_pid);
}
static const char *record_args[] = {
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 55b41b9..55c9659 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -618,7 +618,7 @@ static int test_type(enum event_type type, enum event_type expect)
}
static int test_type_token(enum event_type type, char *token,
- enum event_type expect, char *expect_tok)
+ enum event_type expect, const char *expect_tok)
{
if (type != expect) {
die("Error: expected type %d but read %d",
@@ -650,7 +650,7 @@ static int read_expect_type(enum event_type expect, char **tok)
return __read_expect_type(expect, tok, 1);
}
-static int __read_expected(enum event_type expect, char *str, int newline_ok)
+static int __read_expected(enum event_type expect, const char *str, int newline_ok)
{
enum event_type type;
char *token;
@@ -668,12 +668,12 @@ static int __read_expected(enum event_type expect, char *str, int newline_ok)
return 0;
}
-static int read_expected(enum event_type expect, char *str)
+static int read_expected(enum event_type expect, const char *str)
{
return __read_expected(expect, str, 1);
}
-static int read_expected_item(enum event_type expect, char *str)
+static int read_expected_item(enum event_type expect, const char *str)
{
return __read_expected(expect, str, 0);
}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-06 18:09 ` Randy Dunlap
@ 2009-10-12 8:47 ` Ingo Molnar
2009-10-12 15:34 ` Randy Dunlap
0 siblings, 1 reply; 12+ messages in thread
From: Ingo Molnar @ 2009-10-12 8:47 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Kyle McMartin, Peter Zijlstra, lkml, Paul Mackerras
* Randy Dunlap <randy.dunlap@oracle.com> wrote:
> All 64-bit userspace & kernel. so that fails. Thanks.
btw., i'm curious, what was/is your motivation for cross-building in
that way? On a 64-bit system you really want a 64-bit perf binary - it's
faster.
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-12 6:35 ` Ingo Molnar
@ 2009-10-12 15:33 ` Randy Dunlap
0 siblings, 0 replies; 12+ messages in thread
From: Randy Dunlap @ 2009-10-12 15:33 UTC (permalink / raw)
To: Ingo Molnar; +Cc: lkml, Peter Zijlstra, Paul Mackerras
On Mon, 12 Oct 2009 08:35:47 +0200 Ingo Molnar wrote:
>
> * Randy Dunlap <randy.dunlap@oracle.com> wrote:
>
> > Also, I see build errors/warnings (-Werror). Others aren't seeing these?
> > Just due to my gcc version?
>
> Thanks for the fix. Which GCC version is this btw?
gcc (GCC) 4.2.1 (SUSE Linux)
(from some openSUSE.org release)
---
~Randy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] perf build questions
2009-10-12 8:47 ` Ingo Molnar
@ 2009-10-12 15:34 ` Randy Dunlap
0 siblings, 0 replies; 12+ messages in thread
From: Randy Dunlap @ 2009-10-12 15:34 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Kyle McMartin, Peter Zijlstra, lkml, Paul Mackerras
On Mon, 12 Oct 2009 10:47:34 +0200 Ingo Molnar wrote:
>
> * Randy Dunlap <randy.dunlap@oracle.com> wrote:
>
> > All 64-bit userspace & kernel. so that fails. Thanks.
>
> btw., i'm curious, what was/is your motivation for cross-building in
> that way? On a 64-bit system you really want a 64-bit perf binary - it's
> faster.
I'm just trying to build 64-bit and 32-bit RPMs.
Thanks.
---
~Randy
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-10-12 15:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-05 20:17 [patch] perf build questions Randy Dunlap
2009-10-05 20:47 ` Frederic Weisbecker
2009-10-06 8:48 ` Peter Zijlstra
2009-10-06 17:26 ` Randy Dunlap
2009-10-06 18:02 ` Peter Zijlstra
2009-10-06 18:05 ` Kyle McMartin
2009-10-06 18:09 ` Randy Dunlap
2009-10-12 8:47 ` Ingo Molnar
2009-10-12 15:34 ` Randy Dunlap
2009-10-12 6:35 ` Ingo Molnar
2009-10-12 15:33 ` Randy Dunlap
2009-10-12 6:52 ` [tip:perf/urgent] perf tools: Fix const char type propagation tip-bot for Randy Dunlap
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).