Hi Dmitry,

On Thu, 2020-01-02 at 03:02 +0300, Dmitry V. Levin wrote:
> On Thu, Aug 29, 2019 at 11:43:58PM +0200, Mark Wielaard wrote:
> > All archive members from libebl.a are now in libdw.a. We don't generate
> > separate backend shared libraries anymore. So remove them from the
> > elfutils.spec file.
> > 
> > diff --git a/libebl/ChangeLog b/libebl/ChangeLog
> > index 6ba3a02b..4da7eeeb 100644
> > --- a/libebl/ChangeLog
> > +++ b/libebl/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2019-08-29  Mark Wielaard  <m...@klomp.org>
> > +
> > +   * Makefile.am (noinst_LIBRARIES): Add libebl.a.
> > +   (noinst_HEADERS): Add libebl.h.
> 
> (pkginclude_HEADERS): Remove.

Ah, yes, sorry missed that one.

> > @@ -62,6 +59,6 @@ libebl_a_SOURCES = eblopenbackend.c
> > eblclosebackend.c eblreloctypename.c \
> >  libebl_pic_a_SOURCES =
> >  am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os)
> >  
> > -noinst_HEADERS = libeblP.h ebl-hooks.h
> > +noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
> >  
> >  MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
> 
> After this part of the change libebl.h is no longer installed, but
> it's included by libasm.h which is still installed.
> 
> This has to be fixed somehow, but I'm not sure whether libebl.h should be
> reinstated, libasm.h should stop to include it, or libasm.h should stop
> to be installed.

Urgh. Missed that too.

Even if you could use libasm.h, linking with libasm always was kind of
useless since there was no supported way to create an Ebl handle.
Unless you statically linked with libebl, which was never supported and
might still not work since it might conflict with changes in the libebl
linked to by libasm/libdw.

In fact our own elfutils.spec doesn't even install it. But sadly some
distros (including Fedora... my fault) do install it.

Short term I propose the attached patch.

But longer term we need new asm_begin and disasm_begin functions that
don't depend on unsupportable libebl features.

Cheers,

Mark
From 5cf9865639fdedc22e06f09bfa3f7713b8b65d95 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <m...@klomp.org>
Date: Wed, 8 Jan 2020 15:04:50 +0100
Subject: [PATCH] libasm.h: Don't include libebl.h. Define an opaque Ebl
 handle.

Using libasm isn't really usable without a way to create an Ebl handle.
But we don't support libebl.h (and libebl itself). Just define the
Ebl handle as an opaque struct. Code that uses it needs to figure out
how to instantiate one itself (they cannot in any supportable way...)

Signed-off-by: Mark Wielaard <m...@klomp.org>
---
 libasm/ChangeLog | 5 +++++
 libasm/libasm.h  | 2 +-
 libasm/libasmP.h | 1 +
 tests/ChangeLog  | 4 ++++
 tests/asm-tst1.c | 1 +
 tests/asm-tst2.c | 1 +
 tests/asm-tst3.c | 1 +
 tests/asm-tst4.c | 1 +
 tests/asm-tst5.c | 1 +
 tests/asm-tst6.c | 1 +
 tests/asm-tst7.c | 1 +
 tests/asm-tst8.c | 1 +
 tests/asm-tst9.c | 1 +
 13 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index a1abac88..7b0d3df3 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-08  Mark Wielaard  <m...@klomp.org>
+
+	* libasm.h: Don't include libebl.h. Define an opaque Ebl handle.
+	* libasmP.h: Do include libebl.h.
+
 2019-08-28  Mark Wielaard  <m...@klomp.org>
 
 	* Makefile.am (libasm_so_DEPS): Replace libebl.a with libebl_pic.a.
diff --git a/libasm/libasm.h b/libasm/libasm.h
index 5c612243..a45c9fa3 100644
--- a/libasm/libasm.h
+++ b/libasm/libasm.h
@@ -32,7 +32,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#include <libebl.h>
+typedef struct ebl Ebl;
 
 
 /* Opaque type for the assembler context descriptor.  */
diff --git a/libasm/libasmP.h b/libasm/libasmP.h
index 54460cf9..a4703fc3 100644
--- a/libasm/libasmP.h
+++ b/libasm/libasmP.h
@@ -31,6 +31,7 @@
 
 #include <stdio.h>
 
+#include "libebl.h"
 #include <libasm.h>
 
 #include "libdwelf.h"
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 7103cf51..2ed36c6c 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-08  Mark Wielaard  <m...@klomp.org>
+
+	* asm-test?.c: include libebl.h.
+
 2019-12-04  Frank Ch. Eigler  <f...@redhat.com>
 
 	* run-debuinfod-find.sh: Test $DEBUGINFOD_PROGRESS.
diff --git a/tests/asm-tst1.c b/tests/asm-tst1.c
index 9afc676b..cdf2a921 100644
--- a/tests/asm-tst1.c
+++ b/tests/asm-tst1.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst2.c b/tests/asm-tst2.c
index 2556d0c4..9e88b70c 100644
--- a/tests/asm-tst2.c
+++ b/tests/asm-tst2.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst3.c b/tests/asm-tst3.c
index e52cfbe1..39c1d90c 100644
--- a/tests/asm-tst3.c
+++ b/tests/asm-tst3.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c
index 52e9e20b..5114938b 100644
--- a/tests/asm-tst4.c
+++ b/tests/asm-tst4.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c
index 5a29b01c..dcb852f8 100644
--- a/tests/asm-tst5.c
+++ b/tests/asm-tst5.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c
index bd9b362b..829cd90c 100644
--- a/tests/asm-tst6.c
+++ b/tests/asm-tst6.c
@@ -19,6 +19,7 @@
 # include <config.h>
 #endif
 
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst7.c b/tests/asm-tst7.c
index 00cb2bfe..90179769 100644
--- a/tests/asm-tst7.c
+++ b/tests/asm-tst7.c
@@ -21,6 +21,7 @@
 
 #include <fcntl.h>
 #include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst8.c b/tests/asm-tst8.c
index 4fb0d998..a65509fe 100644
--- a/tests/asm-tst8.c
+++ b/tests/asm-tst8.c
@@ -21,6 +21,7 @@
 
 #include <fcntl.h>
 #include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
diff --git a/tests/asm-tst9.c b/tests/asm-tst9.c
index b6d0e431..681e872d 100644
--- a/tests/asm-tst9.c
+++ b/tests/asm-tst9.c
@@ -21,6 +21,7 @@
 
 #include <fcntl.h>
 #include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(asm)
 #include <libelf.h>
 #include <stdio.h>
-- 
2.18.1

Reply via email to