All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: perf: fix linker error when libelf config is disabled
@ 2017-01-04 13:52 Sudeep Holla
  2017-01-04 14:45 ` Jiri Olsa
  2017-01-04 15:56 ` [PATCH v2] " Sudeep Holla
  0 siblings, 2 replies; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 13:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sudeep Holla, Peter Zijlstra, Ingo Molnar, Jiri Olsa

When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

This patch fixes the error by using the configuration macro EXTLIBS.

Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..6defd9b00bc4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
 
 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
 endif
 
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
-- 
2.7.4

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

* Re: [PATCH] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 13:52 [PATCH] tools: perf: fix linker error when libelf config is disabled Sudeep Holla
@ 2017-01-04 14:45 ` Jiri Olsa
  2017-01-04 15:45   ` Sudeep Holla
  2017-01-04 15:56 ` [PATCH v2] " Sudeep Holla
  1 sibling, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2017-01-04 14:45 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa

On Wed, Jan 04, 2017 at 01:52:40PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> This patch fixes the error by using the configuration macro EXTLIBS.
> 
> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  tools/perf/Makefile.perf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 8fc24824705e..6defd9b00bc4 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
>  	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
>  
>  $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
> -	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
> +	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
>  endif

hm, do we need -lelf -lrt at all? can't see reason for that

jirka

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

* Re: [PATCH] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 14:45 ` Jiri Olsa
@ 2017-01-04 15:45   ` Sudeep Holla
  0 siblings, 0 replies; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 15:45 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Sudeep Holla, linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa



On 04/01/17 14:45, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 01:52:40PM +0000, Sudeep Holla wrote:
>> When libelf is disabled in the configuration, we get the following
>> linker error:
>>   LINK     libperf-jvmti.so
>>   ld: cannot find -lelf
>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>
>> This patch fixes the error by using the configuration macro EXTLIBS.
>>
>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Jiri Olsa <jolsa@kernel.org>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  tools/perf/Makefile.perf | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index 8fc24824705e..6defd9b00bc4 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
>>  	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
>>  
>>  $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
>> -	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
>> +	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
>>  endif
> 
> hm, do we need -lelf -lrt at all? can't see reason for that

I agree as it links well without libelf. I was not sure if enabling
libelf has any issue removing it, hence I retained. I will remove both
and repost. Thanks for having a look.

-- 
Regards,
Sudeep

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

* [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 13:52 [PATCH] tools: perf: fix linker error when libelf config is disabled Sudeep Holla
  2017-01-04 14:45 ` Jiri Olsa
@ 2017-01-04 15:56 ` Sudeep Holla
  2017-01-04 16:06   ` Jiri Olsa
  2017-01-04 17:30   ` [PATCH v3] " Sudeep Holla
  1 sibling, 2 replies; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 15:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sudeep Holla, Peter Zijlstra, Ingo Molnar, Jiri Olsa

When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.

Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v1->v2:
	- Dropped libelf and librt as they are not required

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..9e4a7ea84637 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti

 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
 endif

 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.7.4

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

* Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 15:56 ` [PATCH v2] " Sudeep Holla
@ 2017-01-04 16:06   ` Jiri Olsa
  2017-01-04 16:08     ` Sudeep Holla
  2017-01-04 17:30   ` [PATCH v3] " Sudeep Holla
  1 sibling, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2017-01-04 16:06 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa

On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> Jiri pointed out that both librt and libelf are not really required. So
> this patch fixes the linker error by getting rid of unwanted libraries
> in the linker stage.
> 
> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")

hum, AFAICS it linked -lelf and -lrt even before right? ;-)

jirka

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

* Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 16:06   ` Jiri Olsa
@ 2017-01-04 16:08     ` Sudeep Holla
  2017-01-04 16:18       ` Sudeep Holla
  0 siblings, 1 reply; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 16:08 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Sudeep Holla, linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa



On 04/01/17 16:06, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>> When libelf is disabled in the configuration, we get the following
>> linker error:
>>   LINK     libperf-jvmti.so
>>   ld: cannot find -lelf
>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>
>> Jiri pointed out that both librt and libelf are not really required. So
>> this patch fixes the linker error by getting rid of unwanted libraries
>> in the linker stage.
>>
>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> 
> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
> 

Yes, sorry I forgot to remove that and trace it back the actual commit.

-- 
Regards,
Sudeep

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

* Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 16:08     ` Sudeep Holla
@ 2017-01-04 16:18       ` Sudeep Holla
  2017-01-04 17:19         ` Jiri Olsa
  0 siblings, 1 reply; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 16:18 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Sudeep Holla, linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa



On 04/01/17 16:08, Sudeep Holla wrote:
> 
> 
> On 04/01/17 16:06, Jiri Olsa wrote:
>> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>>> When libelf is disabled in the configuration, we get the following
>>> linker error:
>>>   LINK     libperf-jvmti.so
>>>   ld: cannot find -lelf
>>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>>
>>> Jiri pointed out that both librt and libelf are not really required. So
>>> this patch fixes the linker error by getting rid of unwanted libraries
>>> in the linker stage.
>>>
>>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>>
>> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
>>
> 
> Yes, sorry I forgot to remove that and trace it back the actual commit.
> 

Having looked at it again, it looks new additions in the above commit.
It may be a copied from somewhere else but I can't trace it back :(.
I need your help if you want to get rid of that ;)

-- 
Regards,
Sudeep

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

* Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 16:18       ` Sudeep Holla
@ 2017-01-04 17:19         ` Jiri Olsa
  2017-01-04 17:26           ` Sudeep Holla
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2017-01-04 17:19 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa

On Wed, Jan 04, 2017 at 04:18:10PM +0000, Sudeep Holla wrote:
> 
> 
> On 04/01/17 16:08, Sudeep Holla wrote:
> > 
> > 
> > On 04/01/17 16:06, Jiri Olsa wrote:
> >> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
> >>> When libelf is disabled in the configuration, we get the following
> >>> linker error:
> >>>   LINK     libperf-jvmti.so
> >>>   ld: cannot find -lelf
> >>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> >>>
> >>> Jiri pointed out that both librt and libelf are not really required. So
> >>> this patch fixes the linker error by getting rid of unwanted libraries
> >>> in the linker stage.
> >>>
> >>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> >>
> >> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
> >>
> > 
> > Yes, sorry I forgot to remove that and trace it back the actual commit.
> > 
> 
> Having looked at it again, it looks new additions in the above commit.
> It may be a copied from somewhere else but I can't trace it back :(.
> I need your help if you want to get rid of that ;)

I think it's this one:
  209045adc2bb perf tools: add JVMTI agent library

jirka

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

* Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 17:19         ` Jiri Olsa
@ 2017-01-04 17:26           ` Sudeep Holla
  0 siblings, 0 replies; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 17:26 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Sudeep Holla, linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa



On 04/01/17 17:19, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 04:18:10PM +0000, Sudeep Holla wrote:
>>
>>
>> On 04/01/17 16:08, Sudeep Holla wrote:
>>>
>>>
>>> On 04/01/17 16:06, Jiri Olsa wrote:
>>>> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>>>>> When libelf is disabled in the configuration, we get the following
>>>>> linker error:
>>>>>   LINK     libperf-jvmti.so
>>>>>   ld: cannot find -lelf
>>>>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>>>>
>>>>> Jiri pointed out that both librt and libelf are not really required. So
>>>>> this patch fixes the linker error by getting rid of unwanted libraries
>>>>> in the linker stage.
>>>>>
>>>>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>>>>
>>>> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
>>>>
>>>
>>> Yes, sorry I forgot to remove that and trace it back the actual commit.
>>>
>>
>> Having looked at it again, it looks new additions in the above commit.
>> It may be a copied from somewhere else but I can't trace it back :(.
>> I need your help if you want to get rid of that ;)
> 
> I think it's this one:
>   209045adc2bb perf tools: add JVMTI agent library

Thanks for that, I would never have figured this out myself. Will fix
that and send out v3.

-- 
Regards,
Sudeep

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

* [PATCH v3] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 15:56 ` [PATCH v2] " Sudeep Holla
  2017-01-04 16:06   ` Jiri Olsa
@ 2017-01-04 17:30   ` Sudeep Holla
  2017-01-04 17:35     ` Jiri Olsa
  1 sibling, 1 reply; 11+ messages in thread
From: Sudeep Holla @ 2017-01-04 17:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sudeep Holla, Peter Zijlstra, Ingo Molnar, Jiri Olsa, Stephane Eranian

When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.

Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2->v3:
	- Corrected the original commit under "Fixes:" tag that
	  introduced the libraries initially
v1->v2:
	- Dropped libelf and librt as they are not required

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..9e4a7ea84637 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti

 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
 endif

 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.7.4

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

* Re: [PATCH v3] tools: perf: fix linker error when libelf config is disabled
  2017-01-04 17:30   ` [PATCH v3] " Sudeep Holla
@ 2017-01-04 17:35     ` Jiri Olsa
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Olsa @ 2017-01-04 17:35 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa, Stephane Eranian

On Wed, Jan 04, 2017 at 05:30:02PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> Jiri pointed out that both librt and libelf are not really required. So
> this patch fixes the linker error by getting rid of unwanted libraries
> in the linker stage.
> 
> Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

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

end of thread, other threads:[~2017-01-04 17:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04 13:52 [PATCH] tools: perf: fix linker error when libelf config is disabled Sudeep Holla
2017-01-04 14:45 ` Jiri Olsa
2017-01-04 15:45   ` Sudeep Holla
2017-01-04 15:56 ` [PATCH v2] " Sudeep Holla
2017-01-04 16:06   ` Jiri Olsa
2017-01-04 16:08     ` Sudeep Holla
2017-01-04 16:18       ` Sudeep Holla
2017-01-04 17:19         ` Jiri Olsa
2017-01-04 17:26           ` Sudeep Holla
2017-01-04 17:30   ` [PATCH v3] " Sudeep Holla
2017-01-04 17:35     ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.