All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andriin@fb.com>, Alexei Starovoitov <ast@fb.com>,
	dwarves@vger.kernel.org, bpf@vger.kernel.org,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	Kernel Team <Kernel-team@fb.com>,
	jolsa@kernel.org, namhyung@kernel.org, wangnan0@huawei.com,
	Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH pahole] libbpf: build as PIC and statically link into libdwarves
Date: Tue, 19 Feb 2019 10:16:59 -0300	[thread overview]
Message-ID: <20190219131659.GY31177@kernel.org> (raw)
In-Reply-To: <CAEf4BzYjpaeOE+upCHjt4GhO07nPXepHHfTgebe0c8zfJgAFAw@mail.gmail.com>

Em Mon, Feb 18, 2019 at 07:04:17PM -0800, Andrii Nakryiko escreveu:
> cc Yonghong (mistyped his email)

Applied, but before I split it into two patches, one bumping the minimum
required cmake version, with an explanation about why that is needed,
then the rest of the patch, with the explanation you provided.

Please try to make the patches in a granular fashion, with justification
for each independent part,

Thanks,

- Arnaldo
 
> On Mon, Feb 18, 2019 at 7:02 PM Andrii Nakryiko <andriin@fb.com> wrote:
> >
> > As libbpf is not yet widely available, it's safer to statically link it
> > into libdwarves for now. Easiest way to define that in cmake is through
> > OBJECT library with PIC.
> >
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
> >  CMakeLists.txt | 17 ++++++-----------
> >  1 file changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/CMakeLists.txt b/CMakeLists.txt
> > index d6929b4..e0fdaf7 100644
> > --- a/CMakeLists.txt
> > +++ b/CMakeLists.txt
> > @@ -1,5 +1,5 @@
> >  project(pahole C)
> > -cmake_minimum_required(VERSION 2.4.8)
> > +cmake_minimum_required(VERSION 2.8.8)
> >  cmake_policy(SET CMP0005 NEW)
> >
> >  INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
> > @@ -72,24 +72,19 @@ if (NOT HAVE_REALLOCARRAY_SUPPORT)
> >  endif()
> >
> >  file(GLOB libbpf_sources "lib/bpf/src/*.c")
> > -add_library(bpf-static STATIC ${libbpf_sources})
> > -set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bpf)
> > -target_include_directories(bpf-static PRIVATE
> > -                          ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include
> > -                          ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi)
> > -add_library(bpf-shared SHARED ${libbpf_sources})
> > -set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bpf)
> > -target_include_directories(bpf-shared PRIVATE
> > +add_library(bpf OBJECT ${libbpf_sources})
> > +set_property(TARGET bpf PROPERTY POSITION_INDEPENDENT_CODE 1)
> > +target_include_directories(bpf PRIVATE
> >                            ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include
> >                            ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi)
> >
> >  set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings
> >                      ctf_encoder.c ctf_loader.c libctf.c btf_encoder.c btf_loader.c libbtf.c
> >                      dwarf_loader.c dutil.c elf_symtab.c rbtree.c)
> > -add_library(dwarves SHARED ${dwarves_LIB_SRCS})
> > +add_library(dwarves SHARED ${dwarves_LIB_SRCS} $<TARGET_OBJECTS:bpf>)
> >  set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1)
> >  set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "")
> > -target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} bpf-shared)
> > +target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES})
> >
> >  set(dwarves_emit_LIB_SRCS dwarves_emit.c)
> >  add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS})
> > --
> > 2.17.1
> >

-- 

- Arnaldo

  reply	other threads:[~2019-02-19 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  3:02 [PATCH pahole] libbpf: build as PIC and statically link into libdwarves Andrii Nakryiko
2019-02-19  3:04 ` Andrii Nakryiko
2019-02-19 13:16   ` Arnaldo Carvalho de Melo [this message]
2019-02-19 18:22     ` Andrii Nakryiko

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=20190219131659.GY31177@kernel.org \
    --to=acme@kernel.org \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=jolsa@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    --cc=yhs@fb.com \
    /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 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.