[06/25] move platform depended include into system.h of libebl
Commit Message
Because all source in libebl #include <libeblP.h>, so #include <system.h> in
libeblP.h is enough, there is multiple memory-access.h file, so use relative path to
include it properly,
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
---
libebl/eblauxvinfo.c | 3 +--
libebl/eblcorenote.c | 3 +--
libebl/ebldynamictagname.c | 2 +-
libebl/eblobjnote.c | 10 +++++-----
libebl/eblobjnotetypename.c | 3 +--
libebl/eblopenbackend.c | 4 ++--
libebl/eblresolvesym.c | 3 ++-
libebl/libeblP.h | 4 +++-
8 files changed, 16 insertions(+), 16 deletions(-)
Comments
On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
wrote:
> Because all source in libebl #include <libeblP.h>, so #include
> <system.h> in
> libeblP.h is enough, there is multiple memory-access.h file, so use
> relative path to
> include it properly,
I am not a fan of the relative path trick, especially if there it is
clear only one is every needed. You also use it for other files, why?
Cheers,
Mark
On Fri, Oct 28, 2022 at 7:35 PM Mark Wielaard <mark@klomp.org> wrote:
>
> On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
> wrote:
> > Because all source in libebl #include <libeblP.h>, so #include
> > <system.h> in
> > libeblP.h is enough, there is multiple memory-access.h file, so use
> > relative path to
> > include it properly,
>
> I am not a fan of the relative path trick, especially if there it is
> clear only one is every needed. You also use it for other files, why?
>
I am respect the original code
looks at
https://github.com/sourceware-org/elfutils/blob/master/libdwfl/core-file.c#L31
> Cheers,
>
> Mark
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
Hi,
On Sat, 2022-12-17 at 05:19 +0800, 罗勇刚(Yonggang Luo) wrote:
> On Fri, Oct 28, 2022 at 7:35 PM Mark Wielaard <mark@klomp.org> wrote:
> >
> > On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
> > wrote:
> > > Because all source in libebl #include <libeblP.h>, so #include
> > > <system.h> in
> > > libeblP.h is enough, there is multiple memory-access.h file, so
> > > use
> > > relative path to
> > > include it properly,
> >
> > I am not a fan of the relative path trick, especially if there it
> > is
> > clear only one is every needed. You also use it for other files,
> > why?
>
> I am respect the original code
> looks at
> https://github.com/sourceware-org/elfutils/blob/master/libdwfl/core-file.c#L31
I see. But I rather fix that than do the same in new files.
The attached patch does that so no relative paths are needed in
#include statements.
Cheers,
Mark
On Tue, 2022-12-20 at 14:59 +0100, Mark Wielaard wrote:
> The attached patch does that so no relative paths are needed in
> #include statements.
The try-bot looked good:
https://builder.sourceware.org/buildbot/#/changes/16025
So I pushed this:
commit 6ecd16410ce1fe5cb0ac5b7c3342c5cc330e3a04
Author: Mark Wielaard <mark@klomp.org>
Date: Tue Dec 20 14:53:43 2022 +0100
Do not use relative include paths in library files.
Rely on include dirs being set up correctly. Setup libdw AM_CPPFLAGS
to include libebl directory. In libdwfl note that debuginfod.h is a
generated file in the builddir. Only include it in the one file
debuginfod-client.c that really needs it.
Signed-off-by: Mark Wielaard <mark@klomp.org>
@@ -31,11 +31,10 @@
#endif
#include <assert.h>
-#include <byteswap.h>
-#include <endian.h>
#include <inttypes.h>
#include <stdio.h>
#include <stddef.h>
+
#include <libeblP.h>
#define AUXV_TYPES \
@@ -31,12 +31,11 @@
#endif
#include <assert.h>
-#include <byteswap.h>
-#include <endian.h>
#include <inttypes.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
+
#include <libeblP.h>
@@ -33,8 +33,8 @@
#include <inttypes.h>
#include <stdio.h>
+
#include <libeblP.h>
-#include "system.h"
const char *
@@ -35,13 +35,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <libeblP.h>
-#include "common.h"
-#include "libelfP.h"
-#include "libdwP.h"
-#include "memory-access.h"
+#include <libeblP.h>
+#include "../libelf/common.h"
+#include "../libelf/libelfP.h"
+#include "../libdw/libdwP.h"
+#include "../libdw/memory-access.h"
void
ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
@@ -31,11 +31,10 @@
# include <config.h>
#endif
-#include <system.h>
-
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
+
#include <libeblP.h>
@@ -31,15 +31,15 @@
#endif
#include <assert.h>
-#include <libelfP.h>
#include <dwarf.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <system.h>
#include <libeblP.h>
+#include "../libelf/libelfP.h"
+
Ebl *i386_init (Elf *, GElf_Half, Ebl *);
Ebl *sh_init (Elf *, GElf_Half, Ebl *);
Ebl *x86_64_init (Elf *, GElf_Half, Ebl *);
@@ -30,9 +30,10 @@
# include <config.h>
#endif
-#include <libeblP.h>
#include <assert.h>
+#include <libeblP.h>
+
bool
ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
{
@@ -30,9 +30,11 @@
#define _LIBEBLP_H 1
#include <gelf.h>
-#include <libasm.h>
#include <libebl.h>
+#include <system.h>
+
+#include <../libasm/libasm.h>
/* Backend handle. */
struct ebl