mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Jihong <yangjihong@bytedance.com>
To: Leo Yan <leo.yan@arm.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw
Date: Wed, 7 Aug 2024 11:18:17 +0800	[thread overview]
Message-ID: <a6ae5450-9293-40d2-a643-bb7c783e6c44@bytedance.com> (raw)
In-Reply-To: <2e9a74b5-9403-425d-8d98-9469e290d297@arm.com>

Hello,

On 8/7/24 05:28, Leo Yan wrote:
> On 8/6/2024 12:48 PM, Yang Jihong wrote:
>>
>> For libdw versions below 0.177, need to link libdl.a in addition to
>> libbebl.a during static compilation, otherwise feature-dwarf_getlocations
>> compilation will fail.
>>
>> Before:
>>
>>    $ make LDFLAGS=-static
>>      BUILD:   Doing 'make -j20' parallel build
>>    <SNIP>
>>    Makefile.config:483: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157
>>    <SNIP>
>>
>>    $ cat ../build/feature/test-dwarf_getlocations.make.output
>>    /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libebl.a(eblclosebackend.o): in function `ebl_closebackend':
>>    (.text+0x20): undefined reference to `dlclose'
>>    collect2: error: ld returned 1 exit status
> 
> Indeed. Thanks for pointing out this.
> 
>> After:
>>
>>    $ make LDFLAGS=-static
>>    <SNIP>
>>      Auto-detecting system features:
>>    ...                                   dwarf: [ on  ]
>>    <SNIP>
>>
>>      $ ./perf probe
>>     Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
>>        or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
>>        or: perf probe [<options>] --del '[GROUP:]EVENT' ...
>>        or: perf probe --list [GROUP:]EVENT ...
>>    <SNIP>
>>
>> Fixes: 536661da6ea1 ("perf: build: Only link libebl.a for old libdw")
>> Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
>> ---
>>   tools/build/feature/Makefile | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
>> index b18513ec4da6..1fc651cae9e5 100644
>> --- a/tools/build/feature/Makefile
>> +++ b/tools/build/feature/Makefile
>> @@ -179,7 +179,7 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
>>     # Elfutils merged libebl.a into libdw.a starting from version 0.177,
>>     # Link libebl.a only if libdw is older than this version.
>>     ifeq ($(shell test $(LIBDW_VERSION_2)0 -lt 1770; echo $$?),0)
>> -    DWARFLIBS += -lebl
>> +    DWARFLIBS += -lebl -ldl
>>     endif
> 
> One critical thing is the ordering of libs. We must put libdl after libebl,
> otherwise, the building still fails (based on my test).
> 
> Given libdl is a general lib, I think it is good to add a line after the
> `endif` wrapper and with a comment, something like:
> 
>     ifeq ($(shell test $(LIBDW_VERSION_2)0 -lt 1770; echo $$?),0)
>        DWARFLIBS += -lebl
>     endif
> 
>     # Must put -ldl after -lebl for dependency
>     DWARFLIBS += -ldl
> 
> Please update the file tools/perf/Makefile.config for consistency.

Okay, will change in next version.

Thanks,
Yang

  reply	other threads:[~2024-08-07  3:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 11:47 [PATCH v2 0/3] perf: build: Minor fixes for build failures Yang Jihong
2024-08-06 11:47 ` [PATCH v2 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
2024-08-06 21:00   ` Leo Yan
2024-08-07  3:16     ` Yang Jihong
2024-08-06 11:48 ` [PATCH v2 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw Yang Jihong
2024-08-06 21:28   ` Leo Yan
2024-08-07  3:18     ` Yang Jihong [this message]
2024-08-06 11:48 ` [PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined Yang Jihong
2024-08-06 21:34   ` Leo Yan
2024-08-07  3:19     ` Yang Jihong
2024-08-06 17:58 ` [PATCH v2 0/3] perf: build: Minor fixes for build failures Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6ae5450-9293-40d2-a643-bb7c783e6c44@bytedance.com \
    --to=yangjihong@bytedance.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®