Message ID | 20220227115726.1272270-2-stijn@linux-ipv6.be |
---|---|
State | Changes Requested |
Delegated to: | Stijn Tintel |
Headers | show |
Series | [1/6] layerscape/armv8_64b: enable DEBUG_INFO_REDUCED | expand |
> > From: Tony Ambardar <itugrok@yahoo.com> > > dwarves is a set of tools that use the debugging information inserted in > ELF binaries by compilers such as GCC. Utilities in the dwarves suite > include pahole, which can be used to find alignment holes in structs and > classes, and also extracts other information such as CPU cacheline > alignment, helping pack those structures to achieve more cache hits. > > These tools are also used to encode and read the BTF type information > format used with the bpf syscall, making this a Linux build dependency > when using kernel BTF information. BTW this fails to build if libdw-dev is not installed with -- Checking availability of DWARF and ELF development libraries -- Could NOT find dwarf include dir -- Could NOT find libdw include dir -- Could NOT find libdw library CMake Error at cmake/modules/FindDWARF.cmake:93 (message): Could NOT find some ELF and DWARF libraries, please install the missing packages Call Stack (most recent call first): CMakeLists.txt:60 (find_package) ERROR: tools/dwarves failed to build. Should we add it to the build prereq? > > Signed-off-by: Tony Ambardar <itugrok@yahoo.com> > Signed-off-by: Felix Fietkau <nbd@nbd.name> > [bump to 1.23] > Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be> > --- > toolchain/Config.in | 8 ++++++++ > tools/Makefile | 1 + > tools/dwarves/Makefile | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 47 insertions(+) > create mode 100644 tools/dwarves/Makefile > > diff --git a/toolchain/Config.in b/toolchain/Config.in > index 366f5c8b48..fb14006055 100644 > --- a/toolchain/Config.in > +++ b/toolchain/Config.in > @@ -247,6 +247,14 @@ comment "Binary tools" > > source "toolchain/binutils/Config.in" > > +config DWARVES > + bool > + prompt "Build pahole" if TOOLCHAINOPTS > + depends on !HOST_OS_MACOS > + default n > + help > + Enable if you want to build pahole and the dwarves tools. > + > comment "Compiler" > depends on TOOLCHAINOPTS > > diff --git a/tools/Makefile b/tools/Makefile > index 681344a014..9eefcaf393 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -36,6 +36,7 @@ tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs > tools-$(CONFIG_USES_MINOR) += kernel2minor > tools-$(CONFIG_USE_SPARSE) += sparse > tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf > +tools-$(CONFIG_DWARVES) += dwarves > > # builddir dependencies > $(curdir)/autoconf/compile := $(curdir)/m4/compile > diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile > new file mode 100644 > index 0000000000..b02a2398a1 > --- /dev/null > +++ b/tools/dwarves/Makefile > @@ -0,0 +1,38 @@ > +# SPDX-License-Identifier: GPL-2.0-only > + > +include $(TOPDIR)/rules.mk > + > +PKG_NAME:=dwarves > + > +PKG_SOURCE_VERSION:=v1.23 > +PKG_SOURCE_PROTO:=git > +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git > +PKG_MIRROR_HASH:=6ab1bb1dbdf6c73ffcf485d909229dc1da1a3d24efd213e92c56489b58d6a4bd > +PKG_LICENSE:=GPL-2.0-only > +PKG_LICENSE_FILES:=COPYING > + > +HOST_BUILD_PARALLEL:=1 > + > +include $(INCLUDE_DIR)/host-build.mk > +include $(INCLUDE_DIR)/cmake.mk > + > +CMAKE_HOST_OPTIONS += \ > + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ > + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ > + -DCMAKE_BUILD_TYPE=Release \ > + -D__LIB=lib \ > + -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ > + -DCMAKE_SKIP_RPATH=FALSE > + > +define Host/Clean > + rm -f $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags} > + rm -f $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse} > + rm -f $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle} > + rm -f $(STAGING_DIR_HOST)/lib/libdwarves*.so* > + rm -f $(STAGING_DIR_HOST)/share/man/man1/pahole.1 > + rm -rf $(STAGING_DIR_HOST)/include/dwarves > + rm -rf $(STAGING_DIR_HOST)/share/dwarves > + $(call Host/Clean/Default) > +endef > + > +$(eval $(call HostBuild)) > -- > 2.34.1 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
On 27/02/2022 17:20, Ansuel Smith wrote: > > >> From: Tony Ambardar <itugrok@yahoo.com> >> >> dwarves is a set of tools that use the debugging information inserted in >> ELF binaries by compilers such as GCC. Utilities in the dwarves suite >> include pahole, which can be used to find alignment holes in structs and >> classes, and also extracts other information such as CPU cacheline >> alignment, helping pack those structures to achieve more cache hits. >> >> These tools are also used to encode and read the BTF type information >> format used with the bpf syscall, making this a Linux build dependency >> when using kernel BTF information. > BTW this fails to build if libdw-dev is not installed with > > -- Checking availability of DWARF and ELF development libraries > -- Could NOT find dwarf include dir > -- Could NOT find libdw include dir > -- Could NOT find libdw library > CMake Error at cmake/modules/FindDWARF.cmake:93 (message): > Could NOT find some ELF and DWARF libraries, please install the missing > packages > Call Stack (most recent call first): > CMakeLists.txt:60 (find_package) > > ERROR: tools/dwarves failed to build. > > Should we add it to the build prereq? Please try this instead: diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile index b02a2398a1..e5a55706be 100644 --- a/tools/dwarves/Makefile +++ b/tools/dwarves/Makefile @@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING HOST_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=elfutils/host include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk CMAKE_HOST_OPTIONS += \ - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ - -DCMAKE_BUILD_TYPE=Release \ -D__LIB=lib \ -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ -DCMAKE_SKIP_RPATH=FALSE Thanks, Stijn
> > On 27/02/2022 17:20, Ansuel Smith wrote: > > > > >> From: Tony Ambardar <itugrok@yahoo.com> > >> > >> dwarves is a set of tools that use the debugging information inserted in > >> ELF binaries by compilers such as GCC. Utilities in the dwarves suite > >> include pahole, which can be used to find alignment holes in structs and > >> classes, and also extracts other information such as CPU cacheline > >> alignment, helping pack those structures to achieve more cache hits. > >> > >> These tools are also used to encode and read the BTF type information > >> format used with the bpf syscall, making this a Linux build dependency > >> when using kernel BTF information. > > BTW this fails to build if libdw-dev is not installed with > > > > -- Checking availability of DWARF and ELF development libraries > > -- Could NOT find dwarf include dir > > -- Could NOT find libdw include dir > > -- Could NOT find libdw library > > CMake Error at cmake/modules/FindDWARF.cmake:93 (message): > > Could NOT find some ELF and DWARF libraries, please install the missing > > packages > > Call Stack (most recent call first): > > CMakeLists.txt:60 (find_package) > > > > ERROR: tools/dwarves failed to build. > > > > Should we add it to the build prereq? > > Please try this instead: > > diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile > index b02a2398a1..e5a55706be 100644 > --- a/tools/dwarves/Makefile > +++ b/tools/dwarves/Makefile > @@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only > PKG_LICENSE_FILES:=COPYING > > HOST_BUILD_PARALLEL:=1 > +PKG_BUILD_DEPENDS:=elfutils/host > > include $(INCLUDE_DIR)/host-build.mk > include $(INCLUDE_DIR)/cmake.mk > > CMAKE_HOST_OPTIONS += \ > - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ > - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ > - -DCMAKE_BUILD_TYPE=Release \ > -D__LIB=lib \ > -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ > -DCMAKE_SKIP_RPATH=FALSE > > Thanks, > Stijn > No luck... still make[3]: Leaving directory '/home/ansuel/openwrt/tools/missing-macros' time: tools/missing-macros/compile#0.09#0.06#0.12 -- The C compiler identification is GNU 11.2.0 -- Detecting C compiler ABI info make[3]: Leaving directory '/home/ansuel/openwrt/tools/automake' time: tools/automake/compile#0.14#0.44#0.51 make[3]: Entering directory '/home/ansuel/openwrt/tools/libtool' make[3]: Entering directory '/home/ansuel/openwrt/tools/dosfstools' make[3]: Leaving directory '/home/ansuel/openwrt/tools/dosfstools' time: tools/dosfstools/compile#0.13#0.17#0.25 -- Detecting C compiler ABI info - done -- Check for working C compiler: /home/ansuel/openwrt/staging_dir/host/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Setting BUILD_SHARED_LIBS = ON make[3]: Leaving directory '/home/ansuel/openwrt/tools/libtool' -- Checking availability of DWARF and ELF development libraries time: tools/libtool/compile#0.15#0.27#0.34 -- Could NOT find dwarf include dir -- Could NOT find libdw include dir -- Could NOT find libdw library -- Could NOT find libelf library CMake Error at cmake/modules/FindDWARF.cmake:93 (message): Could NOT find some ELF and DWARF libraries, please install the missing packages Call Stack (most recent call first): CMakeLists.txt:60 (find_package) -- Configuring incomplete, errors occurred!
On 28/02/2022 16:16, Ansuel Smith wrote: >> On 27/02/2022 17:20, Ansuel Smith wrote: >>> > >>>> From: Tony Ambardar <itugrok@yahoo.com> >>>> >>>> dwarves is a set of tools that use the debugging information inserted in >>>> ELF binaries by compilers such as GCC. Utilities in the dwarves suite >>>> include pahole, which can be used to find alignment holes in structs and >>>> classes, and also extracts other information such as CPU cacheline >>>> alignment, helping pack those structures to achieve more cache hits. >>>> >>>> These tools are also used to encode and read the BTF type information >>>> format used with the bpf syscall, making this a Linux build dependency >>>> when using kernel BTF information. >>> BTW this fails to build if libdw-dev is not installed with >>> >>> -- Checking availability of DWARF and ELF development libraries >>> -- Could NOT find dwarf include dir >>> -- Could NOT find libdw include dir >>> -- Could NOT find libdw library >>> CMake Error at cmake/modules/FindDWARF.cmake:93 (message): >>> Could NOT find some ELF and DWARF libraries, please install the missing >>> packages >>> Call Stack (most recent call first): >>> CMakeLists.txt:60 (find_package) >>> >>> ERROR: tools/dwarves failed to build. >>> >>> Should we add it to the build prereq? >> Please try this instead: >> >> diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile >> index b02a2398a1..e5a55706be 100644 >> --- a/tools/dwarves/Makefile >> +++ b/tools/dwarves/Makefile >> @@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only >> PKG_LICENSE_FILES:=COPYING >> >> HOST_BUILD_PARALLEL:=1 >> +PKG_BUILD_DEPENDS:=elfutils/host >> >> include $(INCLUDE_DIR)/host-build.mk >> include $(INCLUDE_DIR)/cmake.mk >> >> CMAKE_HOST_OPTIONS += \ >> - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ >> - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ >> - -DCMAKE_BUILD_TYPE=Release \ >> -D__LIB=lib \ >> -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ >> -DCMAKE_SKIP_RPATH=FALSE >> >> Thanks, >> Stijn >> > No luck... still > Apparently we cannot use PKG_BUILD_DEPENDS or HOST_BUILD_DEPENDS in tools/, as this is handled in include/package-dumpinfo.mk, which is included from include/package.mk, which we don't include in tools/... Could use some guidance here, as I am not familiar enough with this part of the code. Thanks, Stijn
On Mon, Feb 28, 2022 at 8:17 AM Stijn Tintel <stijn@linux-ipv6.be> wrote: > > On 28/02/2022 16:16, Ansuel Smith wrote: > >> On 27/02/2022 17:20, Ansuel Smith wrote: > >>> > > >>>> From: Tony Ambardar <itugrok@yahoo.com> > >>>> > >>>> dwarves is a set of tools that use the debugging information inserted in > >>>> ELF binaries by compilers such as GCC. Utilities in the dwarves suite > >>>> include pahole, which can be used to find alignment holes in structs and > >>>> classes, and also extracts other information such as CPU cacheline > >>>> alignment, helping pack those structures to achieve more cache hits. > >>>> > >>>> These tools are also used to encode and read the BTF type information > >>>> format used with the bpf syscall, making this a Linux build dependency > >>>> when using kernel BTF information. > >>> BTW this fails to build if libdw-dev is not installed with > >>> > >>> -- Checking availability of DWARF and ELF development libraries > >>> -- Could NOT find dwarf include dir > >>> -- Could NOT find libdw include dir > >>> -- Could NOT find libdw library > >>> CMake Error at cmake/modules/FindDWARF.cmake:93 (message): > >>> Could NOT find some ELF and DWARF libraries, please install the missing > >>> packages > >>> Call Stack (most recent call first): > >>> CMakeLists.txt:60 (find_package) > >>> > >>> ERROR: tools/dwarves failed to build. > >>> > >>> Should we add it to the build prereq? > >> Please try this instead: > >> > >> diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile > >> index b02a2398a1..e5a55706be 100644 > >> --- a/tools/dwarves/Makefile > >> +++ b/tools/dwarves/Makefile > >> @@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only > >> PKG_LICENSE_FILES:=COPYING > >> > >> HOST_BUILD_PARALLEL:=1 > >> +PKG_BUILD_DEPENDS:=elfutils/host > >> > >> include $(INCLUDE_DIR)/host-build.mk > >> include $(INCLUDE_DIR)/cmake.mk > >> > >> CMAKE_HOST_OPTIONS += \ > >> - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ > >> - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ > >> - -DCMAKE_BUILD_TYPE=Release \ > >> -D__LIB=lib \ > >> -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ > >> -DCMAKE_SKIP_RPATH=FALSE > >> > >> Thanks, > >> Stijn > >> > > No luck... still > > > Apparently we cannot use PKG_BUILD_DEPENDS or HOST_BUILD_DEPENDS in > tools/, as this is handled in include/package-dumpinfo.mk, which is > included from include/package.mk, which we don't include in tools/... > Could use some guidance here, as I am not familiar enough with this part > of the code. depends for tools/ are specified in tools/Makefile. Which means it requires tools/elfutils > > Thanks, > Stijn > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff --git a/toolchain/Config.in b/toolchain/Config.in index 366f5c8b48..fb14006055 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -247,6 +247,14 @@ comment "Binary tools" source "toolchain/binutils/Config.in" +config DWARVES + bool + prompt "Build pahole" if TOOLCHAINOPTS + depends on !HOST_OS_MACOS + default n + help + Enable if you want to build pahole and the dwarves tools. + comment "Compiler" depends on TOOLCHAINOPTS diff --git a/tools/Makefile b/tools/Makefile index 681344a014..9eefcaf393 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,6 +36,7 @@ tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs tools-$(CONFIG_USES_MINOR) += kernel2minor tools-$(CONFIG_USE_SPARSE) += sparse tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf +tools-$(CONFIG_DWARVES) += dwarves # builddir dependencies $(curdir)/autoconf/compile := $(curdir)/m4/compile diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile new file mode 100644 index 0000000000..b02a2398a1 --- /dev/null +++ b/tools/dwarves/Makefile @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dwarves + +PKG_SOURCE_VERSION:=v1.23 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git +PKG_MIRROR_HASH:=6ab1bb1dbdf6c73ffcf485d909229dc1da1a3d24efd213e92c56489b58d6a4bd +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=COPYING + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ + -DCMAKE_BUILD_TYPE=Release \ + -D__LIB=lib \ + -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \ + -DCMAKE_SKIP_RPATH=FALSE + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags} + rm -f $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse} + rm -f $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle} + rm -f $(STAGING_DIR_HOST)/lib/libdwarves*.so* + rm -f $(STAGING_DIR_HOST)/share/man/man1/pahole.1 + rm -rf $(STAGING_DIR_HOST)/include/dwarves + rm -rf $(STAGING_DIR_HOST)/share/dwarves + $(call Host/Clean/Default) +endef + +$(eval $(call HostBuild))