* [PATCH] perf tools: Fix static building
@ 2016-08-22 17:33 Alexey Brodkin
2016-08-30 16:21 ` Vineet Gupta
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alexey Brodkin @ 2016-08-22 17:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-snps-arc, Alexey Brodkin, Arnaldo Carvalho de Melo,
Vineet Gupta, Wang Nan, Jiri Olsa, He Kuang, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, Zefan Li, pi3orama
With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
used by traceevent plugins") we started to add "--dynamic-list" in
LDFLAGS. One side-effect of that was inability to build really
statically-linked perf.
I.e. even if "LDFLAGS=-static" were passed on perf building command-line
it had no effect and perf was built dynamically.
This change disables setup of "--dynamic-list" if LDFLAGS contains
"-static" option.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/Makefile.perf | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2d908750..e9acc7c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -236,7 +236,9 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
export LIBTRACEEVENT
LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
+ifeq ($(filter -static,$(LDFLAGS)),)
LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
+endif
LIBAPI = $(API_PATH)libapi.a
export LIBAPI
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] perf tools: Fix static building
2016-08-22 17:33 [PATCH] perf tools: Fix static building Alexey Brodkin
@ 2016-08-30 16:21 ` Vineet Gupta
2016-08-31 7:21 ` Jiri Olsa
2016-08-31 7:24 ` Jiri Olsa
2 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2016-08-30 16:21 UTC (permalink / raw)
To: Alexey Brodkin, linux-kernel
Cc: linux-snps-arc, Arnaldo Carvalho de Melo, Wang Nan, Jiri Olsa,
He Kuang, Masami Hiramatsu, Namhyung Kim, Peter Zijlstra,
Zefan Li, pi3orama
On 08/22/2016 10:35 AM, Alexey Brodkin wrote:
> With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> used by traceevent plugins") we started to add "--dynamic-list" in
> LDFLAGS. One side-effect of that was inability to build really
> statically-linked perf.
>
> I.e. even if "LDFLAGS=-static" were passed on perf building command-line
> it had no effect and perf was built dynamically.
>
> This change disables setup of "--dynamic-list" if LDFLAGS contains
> "-static" option.
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
> tools/perf/Makefile.perf | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 2d908750..e9acc7c 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -236,7 +236,9 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
> export LIBTRACEEVENT
>
> LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
> +ifeq ($(filter -static,$(LDFLAGS)),)
> LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
> +endif
>
> LIBAPI = $(API_PATH)libapi.a
> export LIBAPI
Gentle Ping while Alexey is away on vacation !
Arnaldo are you ok with this patch.
Thx,
-Vineet
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf tools: Fix static building
2016-08-22 17:33 [PATCH] perf tools: Fix static building Alexey Brodkin
2016-08-30 16:21 ` Vineet Gupta
@ 2016-08-31 7:21 ` Jiri Olsa
2016-09-01 18:28 ` Vineet Gupta
2016-08-31 7:24 ` Jiri Olsa
2 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2016-08-31 7:21 UTC (permalink / raw)
To: Alexey Brodkin
Cc: linux-kernel, linux-snps-arc, Arnaldo Carvalho de Melo,
Vineet Gupta, Wang Nan, Jiri Olsa, He Kuang, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, Zefan Li, pi3orama
On Mon, Aug 22, 2016 at 08:33:42PM +0300, Alexey Brodkin wrote:
> With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> used by traceevent plugins") we started to add "--dynamic-list" in
> LDFLAGS. One side-effect of that was inability to build really
> statically-linked perf.
IIRC --dynamic-list forces perf to exports some symbols to
be used by plugins.. don't see this breaking static build
also it's working properly for me:
[jolsa@krava perf]$ make LDFLAGS=-static
...
[jolsa@krava perf]$ ldd ./perf
not a dynamic executable
unless I miss what you mean by 'really statically-linked' ;-)
Maybe different features enabled/build environment could you
please send the .config-detected along with the build error?
thanks,
jirka
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf tools: Fix static building
2016-08-22 17:33 [PATCH] perf tools: Fix static building Alexey Brodkin
2016-08-30 16:21 ` Vineet Gupta
2016-08-31 7:21 ` Jiri Olsa
@ 2016-08-31 7:24 ` Jiri Olsa
2 siblings, 0 replies; 6+ messages in thread
From: Jiri Olsa @ 2016-08-31 7:24 UTC (permalink / raw)
To: Alexey Brodkin
Cc: linux-kernel, linux-snps-arc, Arnaldo Carvalho de Melo,
Vineet Gupta, Wang Nan, Jiri Olsa, He Kuang, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, Zefan Li, pi3orama
On Mon, Aug 22, 2016 at 08:33:42PM +0300, Alexey Brodkin wrote:
> With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> used by traceevent plugins") we started to add "--dynamic-list" in
> LDFLAGS. One side-effect of that was inability to build really
> statically-linked perf.
>
> I.e. even if "LDFLAGS=-static" were passed on perf building command-line
> it had no effect and perf was built dynamically.
>
> This change disables setup of "--dynamic-list" if LDFLAGS contains
> "-static" option.
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
> tools/perf/Makefile.perf | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 2d908750..e9acc7c 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -236,7 +236,9 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
> export LIBTRACEEVENT
>
> LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
> +ifeq ($(filter -static,$(LDFLAGS)),)
> LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
> +endif
hum, e3d09ec8126f changelog mentioned python feature adding this by default
but not sure python could be added within static build
jirka
>
> LIBAPI = $(API_PATH)libapi.a
> export LIBAPI
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf tools: Fix static building
2016-08-31 7:21 ` Jiri Olsa
@ 2016-09-01 18:28 ` Vineet Gupta
2016-09-14 16:21 ` Alexey Brodkin
0 siblings, 1 reply; 6+ messages in thread
From: Vineet Gupta @ 2016-09-01 18:28 UTC (permalink / raw)
To: Jiri Olsa, Alexey Brodkin
Cc: linux-kernel, linux-snps-arc, Arnaldo Carvalho de Melo,
Vineet Gupta, Wang Nan, Jiri Olsa, He Kuang, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, Zefan Li, pi3orama
On 08/31/2016 12:21 AM, Jiri Olsa wrote:
> On Mon, Aug 22, 2016 at 08:33:42PM +0300, Alexey Brodkin wrote:
>> With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
>> used by traceevent plugins") we started to add "--dynamic-list" in
>> LDFLAGS. One side-effect of that was inability to build really
>> statically-linked perf.
>
> IIRC --dynamic-list forces perf to exports some symbols to
> be used by plugins.. don't see this breaking static build
>
> also it's working properly for me:
>
> [jolsa@krava perf]$ make LDFLAGS=-static
> ...
> [jolsa@krava perf]$ ldd ./perf
> not a dynamic executable
>
> unless I miss what you mean by 'really statically-linked' ;-)
Right - so I tried this as well and indeed I can confirm that it builds for me as
static. Atleast the build system doesn;t need changing as -sattic being propagated
to fianl link cmd.
There seems to be some weirdness with ARC tools: file reports
| ELF 32-bit LSB executable, *unknown arch 0xc3* version 1 (SYSV),
| dynamically linked, interpreter *empty*, for GNU/Linux 3.9.0, not stripped
That is clearly wrong !
And the static binary as expected doesn't seem to run on target - exits with -EACCESS.
-Vineet
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf tools: Fix static building
2016-09-01 18:28 ` Vineet Gupta
@ 2016-09-14 16:21 ` Alexey Brodkin
0 siblings, 0 replies; 6+ messages in thread
From: Alexey Brodkin @ 2016-09-14 16:21 UTC (permalink / raw)
To: jolsa, Vineet Gupta
Cc: wangnan0, linux-kernel, lizefan, pi3orama, a.p.zijlstra,
masami.hiramatsu.pt, linux-snps-arc, jolsa, namhyung, acme,
hekuang
Hi Vineet, Jiri,
On Thu, 2016-09-01 at 11:28 -0700, Vineet Gupta wrote:
> On 08/31/2016 12:21 AM, Jiri Olsa wrote:
> >
> > On Mon, Aug 22, 2016 at 08:33:42PM +0300, Alexey Brodkin wrote:
> > >
> > > With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> > > used by traceevent plugins") we started to add "--dynamic-list" in
> > > LDFLAGS. One side-effect of that was inability to build really
> > > statically-linked perf.
> >
> > IIRC --dynamic-list forces perf to exports some symbols to
> > be used by plugins.. don't see this breaking static build
> >
> > also it's working properly for me:
> >
> > [jolsa@krava perf]$ make LDFLAGS=-static
> > ...
> > [jolsa@krava perf]$ ldd ./perf
> > not a dynamic executable
> >
> > unless I miss what you mean by 'really statically-linked' ;-)
>
> Right - so I tried this as well and indeed I can confirm that it builds for me as
> static. Atleast the build system doesn;t need changing as -sattic being propagated
> to fianl link cmd.
>
> There seems to be some weirdness with ARC tools: file reports
>
> >
> > ELF 32-bit LSB executable, *unknown arch 0xc3* version 1 (SYSV),
> > dynamically linked, interpreter *empty*, for GNU/Linux 3.9.0, not stripped
>
>
> That is clearly wrong !
>
> And the static binary as expected doesn't seem to run on target - exits with -EACCESS.
I may confirm what Vineet said already adding just that funny ldd output on target:
-------------------->8-----------------
# ldd /home/perf
=> (0x00000000)
-------------------->8-----------------
Just for comparison that's ldd output for dynamically built perf:
-------------------->8-----------------
# ldd /usr/bin/perf
checking sub-depends for '/lib/libpthread.so.0'
checking sub-depends for '/lib/librt.so.0'
checking sub-depends for '/lib/libm.so.0'
checking sub-depends for '/lib/libdl.so.0'
checking sub-depends for '/lib/libc.so.0'
libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
librt.so.0 => /lib/librt.so.0 (0x00000000)
libm.so.0 => /lib/libm.so.0 (0x00000000)
libdl.so.0 => /lib/libdl.so.0 (0x00000000)
libc.so.0 => /lib/libc.so.0 (0x00000000)
/lib/ld-uClibc.so.1 => /lib/ld-uClibc.so.1 (0x00000000)
-------------------->8-----------------
And most probably the reason for me to think perf built with LDFLAGS=-static
was not static is indeed "file" output:
-------------------->8-----------------
file tools/perf/perf
tools/perf/perf: ELF 32-bit LSB executable, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
3.9.0, not stripped
-------------------->8-----------------
Sorry for the noise.
-Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-14 16:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 17:33 [PATCH] perf tools: Fix static building Alexey Brodkin
2016-08-30 16:21 ` Vineet Gupta
2016-08-31 7:21 ` Jiri Olsa
2016-09-01 18:28 ` Vineet Gupta
2016-09-14 16:21 ` Alexey Brodkin
2016-08-31 7:24 ` Jiri Olsa
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).