Re: pkg-config not used in configure?

2024-09-11 Thread Mark Wielaard
Hi Paul,

On Tue, Sep 10, 2024 at 08:47:17AM -0400, Paul Smith wrote:
> On Tue, 2024-09-10 at 10:52 +0200, Mark Wielaard wrote:
> > On Mon, Sep 09, 2024 at 06:21:16PM -0400, Paul Smith wrote:
> > > On Mon, 2024-09-09 at 15:29 -0400, Paul Smith wrote:
> > > > I'm trying to build the latest elfutils release 0.191.  The
> > > > configure
> > > > help says:
> > > > 
> > > >   ZSTD_COMPRESS_CFLAGS
> > > >   C compiler flags for ZSTD_COMPRESS, overriding pkg-
> > > > config
> > > >   ZSTD_COMPRESS_LIBS
> > > >   linker flags for ZSTD_COMPRESS, overriding pkg-
> > > > config
> > > 
> > > Actually, these variables don't seem to work either.
> > > 
> > > Looking at the generated configure script, I don't see how to get
> > > elfutils to use zstd from a non-standard location?
> > 
> > Yeah, this is unfortunate. There are two checks in configure.ac. One
> > for zstd decompression support (as used in libdw) which uses the
> > eu_ZIPLIB macro (as defined in m4/zip.m4). This is the main check, it
> > also creates the --with-zstd=... configure argument to provide an
> > alternative location.
> 
> Hm.  Are you saying that if I use --with-zstd=/my/prefix that should
> work?  That was the first thing I tried, but it didn't seem to work and
> I don't think (from reading the configure script) where this value is
> used as part of the path search.  But, the shell output of autoconf is
> not easy to read so maybe I missed it.  I can give it another try.

It should work, for building libdw. But then we (elfutils in
configure.ac) does something odd for building with libelf by using
pkgconfig.

I would try two things:

- Remove the PKG_CONFIG checking and just set with_zstd_compress to
  with_zstd:

diff --git a/configure.ac b/configure.ac
index 8f5901a2af7c..3c10ae3482fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,12 +458,7 @@ zip_LIBS="$LIBS"
 LIBS="$save_LIBS"
 AC_SUBST([zip_LIBS])
 
-dnl zstd compression support requires libzstd 1.4.0+
-AS_IF([test "x$with_zstd" = xyes], [
-  PKG_PROG_PKG_CONFIG
-  PKG_CHECK_MODULES([ZSTD_COMPRESS],[libzstd >= 1.4.0],
-[with_zstd_compress="yes"],[with_zstd_compress="no"])],
-  [with_zstd_compress="no"])
+with_zstd_compress=$with_zstd
 AM_CONDITIONAL(USE_ZSTD_COMPRESS, test "x$with_zstd_compress" = "xyes")
 AS_IF([test "x$with_zstd_compress" = "xyes"],
   [AC_DEFINE([USE_ZSTD_COMPRESS], [1], [zstd compression support])])

Now --with-zstd=... should work.

- Replace the function being checked to something libzstd only defines
  with 1.4.0+ maybe ZSTD_compressStream2 (which is actually used in
  libelf.

diff --git a/configure.ac b/configure.ac
index 8f5901a2af7c..1307fb2df086 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,7 +449,7 @@ LIBS="$lzma_LIBS $save_LIBS"
 AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
 AC_SUBST([lzma_LIBS])
 AC_SUBST([LIBLZMA])
-eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
+eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_compressStream2,[ZSTD (zst)])
 AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
 AC_SUBST([LIBZSTD])
 zstd_LIBS="$LIBS"

Hope that helps. It would mean requiring zstd 1.4.0+ always, but that
might be reasonable these days.

Cheers,

Mark


Re: [PATCH] elf*_xlatetof: do not check ELF_T_NHDR[8] has integer number of records

2024-09-11 Thread Mark Wielaard
Hi,

On Wed, 2024-08-28 at 23:43 +0200, Mark Wielaard wrote:
> commit bc0f7450c "elf*_xlatetom: do not check ELF_T_NHDR has integer
> number of records" fixed
> https://bugzilla.redhat.com/show_bug.cgi?id=835877
> But only for xlatetom. Do the same for xlatetof.
> 
>* elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Do not check for
>integer number of records in case of ELF_T_NHDR[8].

Pushed this to main.

Cheers,

Mark


Re: [PATCH] libelf: Don't crash elf[32|64]_xlateto[fm] on bad arguments.

2024-09-11 Thread Mark Wielaard
Hi,

On Wed, 2024-08-28 at 23:58 +0200, Mark Wielaard wrote:
> Check that src and dest aren't NULL and that src->d_type < ELF_T_NUM.
> 
>   * elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Check src, dest
>   and src->d_type are valid.
>   * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Likewise.

Pushed to main,

Mark


Forw: [RFE] Improve handling of framepointer-based backtraces for function prologue samples

2024-09-11 Thread Frank Ch. Eigler
Hi -

wcohen wrote this to linux-perf-users@, touching on unwinding
and especially eu-stacktrace comparison subjects.

https://www.spinics.net/lists/linux-perf-users/msg44812.html

- FChE