Re: [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode

2020-08-30 Thread Mark Wielaard
Hi Dmitry,

On Thu, Aug 20, 2020 at 11:27:24PM +0300, Dmitry V. Levin wrote:
> debuginfod-client.c used to try to dlopen libdebuginfod.so even if
> libdebuginfod was completely disabled using --disable-libdebuginfod.
> 
> Fix this by disabling build of debuginfod-client.c and disabling all
> __libdwfl_debuginfod_* invocations in --disable-libdebuginfod mode.

To be honest I really hope libdebuginfod is only disabled for
bootstrapping reasons and that people will use
--enable-libdebuginfod=dummy.

That said, your patch makes sense if people explicitly choose to
--disable-libdebuginfod and it handles --enable-libdebuginfod=dummy
correctly.

To double check I removed all references to debuginfod_client from
libdwflP.h when libdebuginfod is disabled. And things look fine in
that case too. I think it makes sense to add this to your patch. See
attached.

Thanks,

Mark
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 25753de2..ad6779ad 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -40,7 +40,10 @@
 
 #include "../libdw/libdwP.h"	/* We need its INTDECLs.  */
 #include "../libdwelf/libdwelfP.h"
+
+#ifdef ENABLE_LIBDEBUGINFOD
 #include "../debuginfod/debuginfod.h"
+#endif
 
 typedef struct Dwfl_Process Dwfl_Process;
 
@@ -115,8 +118,9 @@ struct Dwfl_User_Core
 struct Dwfl
 {
   const Dwfl_Callbacks *callbacks;
+#ifdef ENABLE_LIBDEBUGINFOD
   debuginfod_client *debuginfod;
-
+#endif
   Dwfl_Module *modulelist;/* List in order used by full traversals.  */
 
   Dwfl_Process *process;
@@ -631,6 +635,7 @@ extern Dwfl_Error __libdw_open_elf (int fd, Elf **elfp) internal_function;
 extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
   internal_function;
 
+#ifdef ENABLE_LIBDEBUGINFOD
 /* Internal interface to libdebuginfod (if installed).  */
 int
 __libdwfl_debuginfod_find_executable (Dwfl *dwfl,
@@ -642,6 +647,7 @@ __libdwfl_debuginfod_find_debuginfo (Dwfl *dwfl,
  size_t build_id_len);
 void
 __libdwfl_debuginfod_end (debuginfod_client *c);
+#endif
 
 
 /* These are working nicely for --core, but are not ready to be


Re: [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode

2020-08-30 Thread Dmitry V. Levin
Hi Mark,

On Sun, Aug 30, 2020 at 10:40:29PM +0200, Mark Wielaard wrote:
> Hi Dmitry,
> 
> On Thu, Aug 20, 2020 at 11:27:24PM +0300, Dmitry V. Levin wrote:
> > debuginfod-client.c used to try to dlopen libdebuginfod.so even if
> > libdebuginfod was completely disabled using --disable-libdebuginfod.
> > 
> > Fix this by disabling build of debuginfod-client.c and disabling all
> > __libdwfl_debuginfod_* invocations in --disable-libdebuginfod mode.
> 
> To be honest I really hope libdebuginfod is only disabled for
> bootstrapping reasons and that people will use
> --enable-libdebuginfod=dummy.
> 
> That said, your patch makes sense if people explicitly choose to
> --disable-libdebuginfod and it handles --enable-libdebuginfod=dummy
> correctly.
> 
> To double check I removed all references to debuginfod_client from
> libdwflP.h when libdebuginfod is disabled. And things look fine in
> that case too. I think it makes sense to add this to your patch. See
> attached.

Yes, it definitely makes sense, thanks.

> Thanks,
> 
> Mark

> diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
> index 25753de2..ad6779ad 100644
> --- a/libdwfl/libdwflP.h
> +++ b/libdwfl/libdwflP.h
> @@ -40,7 +40,10 @@
>  
>  #include "../libdw/libdwP.h" /* We need its INTDECLs.  */
>  #include "../libdwelf/libdwelfP.h"
> +
> +#ifdef ENABLE_LIBDEBUGINFOD
>  #include "../debuginfod/debuginfod.h"
> +#endif
>  
>  typedef struct Dwfl_Process Dwfl_Process;
>  
> @@ -115,8 +118,9 @@ struct Dwfl_User_Core
>  struct Dwfl
>  {
>const Dwfl_Callbacks *callbacks;
> +#ifdef ENABLE_LIBDEBUGINFOD
>debuginfod_client *debuginfod;
> -
> +#endif
>Dwfl_Module *modulelist;/* List in order used by full traversals.  */
>  
>Dwfl_Process *process;
> @@ -631,6 +635,7 @@ extern Dwfl_Error __libdw_open_elf (int fd, Elf **elfp) 
> internal_function;
>  extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
>internal_function;
>  
> +#ifdef ENABLE_LIBDEBUGINFOD
>  /* Internal interface to libdebuginfod (if installed).  */
>  int
>  __libdwfl_debuginfod_find_executable (Dwfl *dwfl,
> @@ -642,6 +647,7 @@ __libdwfl_debuginfod_find_debuginfo (Dwfl *dwfl,
>size_t build_id_len);
>  void
>  __libdwfl_debuginfod_end (debuginfod_client *c);
> +#endif
>  
>  
>  /* These are working nicely for --core, but are not ready to be


-- 
ldv


Re: [PATCH] readelf: It is not an error if there are no line number statements

2020-08-30 Thread Mark Wielaard
On Wed, Aug 26, 2020 at 02:30:42PM +0200, Mark Wielaard wrote:
> It can happen that there are no line number statements at the end of
> a debug line section. So don't check that there are any more bytes
> after the last file entry. And print "No line number statements."

Pushed.