From 426db34b65d660c439b31d25308bc346d6272923 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 20 Dec 2022 14:53:43 +0100 Subject: [PATCH] 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 --- libasm/ChangeLog | 6 ++++++ libasm/disasm_begin.c | 2 +- libasm/disasm_cb.c | 2 +- libcpu/ChangeLog | 6 ++++++ libcpu/bpf_disasm.c | 4 ++-- libcpu/i386_disasm.c | 2 +- libcpu/riscv_disasm.c | 2 +- libdw/ChangeLog | 7 +++++++ libdw/Makefile.am | 2 +- libdw/cfi.c | 2 +- libdw/encoded-value.h | 2 +- libdw/frame-cache.c | 2 +- libdwelf/ChangeLog | 4 ++++ libdwelf/libdwelfP.h | 2 +- libdwfl/ChangeLog | 24 ++++++++++++++++++++++++ libdwfl/Makefile.am | 2 +- libdwfl/core-file.c | 2 +- libdwfl/cu.c | 4 ++-- libdwfl/debuginfod-client.c | 2 ++ libdwfl/dwfl_dwarf_line.c | 2 +- libdwfl/dwfl_lineinfo.c | 2 +- libdwfl/dwfl_module.c | 2 +- libdwfl/dwfl_module_dwarf_cfi.c | 2 +- libdwfl/dwfl_module_eh_cfi.c | 2 +- libdwfl/dwfl_module_getdwarf.c | 4 ++-- libdwfl/dwfl_module_getsrc.c | 2 +- libdwfl/dwfl_module_getsrc_file.c | 2 +- libdwfl/dwfl_segment_report_module.c | 2 +- libdwfl/elf-from-memory.c | 2 +- libdwfl/frame_unwind.c | 2 +- libdwfl/libdwflP.h | 8 ++------ libdwfl/lines.c | 2 +- libdwfl/link_map.c | 2 +- libdwfl/linux-core-attach.c | 2 +- libdwfl/open.c | 2 +- 35 files changed, 82 insertions(+), 37 deletions(-) diff --git a/libasm/ChangeLog b/libasm/ChangeLog index ce0f24f4..a12d14b3 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,9 @@ +2022-12-20 Mark Wielaard + + * disasm_begin.c: Include libeblP.h. + * disasm_cb.c: Likewise. + * bpf_disasm.c: Likewise and include common.h. + 2022-10-21 Yonggang Luo * asm_abort.c: Don't include unistd.h. diff --git a/libasm/disasm_begin.c b/libasm/disasm_begin.c index cb10f66e..78db90c7 100644 --- a/libasm/disasm_begin.c +++ b/libasm/disasm_begin.c @@ -34,7 +34,7 @@ #include #include "libasmP.h" -#include "../libebl/libeblP.h" +#include "libeblP.h" DisasmCtx_t * diff --git a/libasm/disasm_cb.c b/libasm/disasm_cb.c index 80f8b25b..9353e2e5 100644 --- a/libasm/disasm_cb.c +++ b/libasm/disasm_cb.c @@ -33,7 +33,7 @@ #include #include "libasmP.h" -#include "../libebl/libeblP.h" +#include "libeblP.h" struct symtoken diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index 248b1aba..bd517b94 100644 --- a/libcpu/ChangeLog +++ b/libcpu/ChangeLog @@ -1,3 +1,9 @@ +2022-12-20 Mark Wielaard + + * bpf_disasm.c: Include common.h and libeblP.h. + * i386_disasm.c: Include libeblP.h. + * riscv_disasm.c: Likewise. + 2022-10-21 Yonggang Luo * i386_data.h: Define FCT_mod$64r_m as FCT_mod$r_m for i386. diff --git a/libcpu/bpf_disasm.c b/libcpu/bpf_disasm.c index 62643c81..dabd8a4e 100644 --- a/libcpu/bpf_disasm.c +++ b/libcpu/bpf_disasm.c @@ -37,8 +37,8 @@ #include #include "bpf.h" -#include "../libelf/common.h" -#include "../libebl/libeblP.h" +#include "common.h" +#include "libeblP.h" static const char class_string[8][8] = { [BPF_LD] = "ld", diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index 599d1654..c42f8d1c 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c @@ -41,7 +41,7 @@ #include #include -#include "../libebl/libeblP.h" +#include "libeblP.h" #define MACHINE_ENCODING LITTLE_ENDIAN #include "memory-access.h" diff --git a/libcpu/riscv_disasm.c b/libcpu/riscv_disasm.c index 7175c077..823fe9ca 100644 --- a/libcpu/riscv_disasm.c +++ b/libcpu/riscv_disasm.c @@ -39,7 +39,7 @@ #include #include -#include "../libebl/libeblP.h" +#include "libeblP.h" #define MACHINE_ENCODING LITTLE_ENDIAN #include "memory-access.h" diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 019c6580..4c7af94e 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,10 @@ +2022-12-20 Mark Wielaard + + * Makefile.am (AM_CPPFLAGS): Add -I$(srcdir)/../libebl. + * cfi.c: Include libebl.h. + * encoded-value.h: Likewise. + * frame-cache.h: Likewise. + 2022-10-21 Yonggang Luo * memory-access.h (get_uleb128_step): Use __typeof. diff --git a/libdw/Makefile.am b/libdw/Makefile.am index 4fda33bd..1b6fead4 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -31,7 +31,7 @@ include $(top_srcdir)/config/eu.am if BUILD_STATIC AM_CFLAGS += $(fpic_CFLAGS) endif -AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread +AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread VERSION = 1 lib_LIBRARIES = libdw.a diff --git a/libdw/cfi.c b/libdw/cfi.c index a73fb03f..6d08ca90 100644 --- a/libdw/cfi.c +++ b/libdw/cfi.c @@ -31,7 +31,7 @@ #endif #include -#include "../libebl/libebl.h" +#include "libebl.h" #include "cfi.h" #include "memory-access.h" #include "encoded-value.h" diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h index f0df4cec..d4e01924 100644 --- a/libdw/encoded-value.h +++ b/libdw/encoded-value.h @@ -32,7 +32,7 @@ #include #include #include "libdwP.h" -#include "../libelf/common.h" +#include "common.h" /* Returns zero if the value is omitted, the encoding is unknown or diff --git a/libdw/frame-cache.c b/libdw/frame-cache.c index 5b6afb5d..683f7f17 100644 --- a/libdw/frame-cache.c +++ b/libdw/frame-cache.c @@ -30,7 +30,7 @@ # include #endif -#include "../libebl/libebl.h" +#include "libebl.h" #include "cfi.h" #include #include diff --git a/libdwelf/ChangeLog b/libdwelf/ChangeLog index 5d61aa85..1940629f 100644 --- a/libdwelf/ChangeLog +++ b/libdwelf/ChangeLog @@ -1,3 +1,7 @@ +2022-12-20 Mark Wielaard + + * libdwelfP.h: Include libdwP.h. + 2022-10-21 Yonggang Luo * dwelf_elf_begin.c: Don't include unistd.h. diff --git a/libdwelf/libdwelfP.h b/libdwelf/libdwelfP.h index d83c759a..faaf1a20 100644 --- a/libdwelf/libdwelfP.h +++ b/libdwelf/libdwelfP.h @@ -30,7 +30,7 @@ #define _LIBDWELFP_H 1 #include -#include "../libdw/libdwP.h" /* We need its INTDECLs. */ +#include "libdwP.h" /* We need its INTDECLs. */ #include #include diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 68527327..1b465e48 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,27 @@ +2022-12-20 Mark Wielaard + + * Makefile.am (AM_CPPFLAGS): debuginfod.h is in builddir. + * core-file.c: Include libelfP.h. + * cu.c: Include libdwP.h and memory-access.h. + * debuginfod-client.c: Include debuginfod.h. + * dwfl_dwarf_line.c: Include libdwP.h. + * dwfl_lineinfo.c: Include libdwP.h. + * dwfl_module.c: Include cfi.h. + * dwfl_module_dwarf_cfi.c: Include cfi.h. + * dwfl_module_eh_cfi.c: Include cfi.h. + * dwfl_module_getdwarf.c: Include libdwP.h and libelfP.h. + * dwfl_module_getsrc.c: Include libdwP.h. + * dwfl_module_getsrc_file.c: Include libdwP.h. + * dwfl_segment_report_module.c: Include libelfP.h. + * elf-from-memory.c: Include libelfP.h. + * frame_unwind.c: Include dwarf.h. + * libdwflP.h: Include libdwP.h and libdwelfP.h. Don't include + debuginfod.h. + * lines.c: Include libdwP.h. + * link_map.c: Include memory-access.h. + * linux-core-attach.c: Include memory-access.h. + * open.c: Include libelfP.h. + 2022-11-28 Gavin Li Mark Wielaard diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am index 3278358d..6b26cd51 100644 --- a/libdwfl/Makefile.am +++ b/libdwfl/Makefile.am @@ -31,7 +31,7 @@ ## include $(top_srcdir)/config/eu.am AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ - -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(srcdir)/../debuginfod + -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(builddir)/../debuginfod VERSION = 1 noinst_LIBRARIES = libdwfl.a diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c index cd9b4f38..1ddf0f18 100644 --- a/libdwfl/core-file.c +++ b/libdwfl/core-file.c @@ -28,7 +28,7 @@ not, see . */ #include -#include "../libelf/libelfP.h" /* For NOTE_ALIGN. */ +#include "libelfP.h" /* For NOTE_ALIGN. */ #undef _ #include "libdwflP.h" #include diff --git a/libdwfl/cu.c b/libdwfl/cu.c index 4de66248..b1afb19a 100644 --- a/libdwfl/cu.c +++ b/libdwfl/cu.c @@ -31,8 +31,8 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" -#include "../libdw/memory-access.h" +#include "libdwP.h" +#include "memory-access.h" #include diff --git a/libdwfl/debuginfod-client.c b/libdwfl/debuginfod-client.c index d581daab..882a5eff 100644 --- a/libdwfl/debuginfod-client.c +++ b/libdwfl/debuginfod-client.c @@ -35,6 +35,8 @@ #ifdef ENABLE_LIBDEBUGINFOD +#include "debuginfod.h" + #include #include diff --git a/libdwfl/dwfl_dwarf_line.c b/libdwfl/dwfl_dwarf_line.c index e22e984c..5084c659 100644 --- a/libdwfl/dwfl_dwarf_line.c +++ b/libdwfl/dwfl_dwarf_line.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" +#include "libdwP.h" Dwarf_Line * dwfl_dwarf_line (Dwfl_Line *line, Dwarf_Addr *bias) diff --git a/libdwfl/dwfl_lineinfo.c b/libdwfl/dwfl_lineinfo.c index 96187128..85c4b314 100644 --- a/libdwfl/dwfl_lineinfo.c +++ b/libdwfl/dwfl_lineinfo.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" +#include "libdwP.h" const char * dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp, diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index 4fbff33e..221d726d 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/cfi.h" +#include "cfi.h" #include static void diff --git a/libdwfl/dwfl_module_dwarf_cfi.c b/libdwfl/dwfl_module_dwarf_cfi.c index 0e5b4356..05a14f7c 100644 --- a/libdwfl/dwfl_module_dwarf_cfi.c +++ b/libdwfl/dwfl_module_dwarf_cfi.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/cfi.h" +#include "cfi.h" Dwarf_CFI * internal_function diff --git a/libdwfl/dwfl_module_eh_cfi.c b/libdwfl/dwfl_module_eh_cfi.c index c296e399..aac6657d 100644 --- a/libdwfl/dwfl_module_eh_cfi.c +++ b/libdwfl/dwfl_module_eh_cfi.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/cfi.h" +#include "cfi.h" Dwarf_CFI * dwfl_module_eh_cfi (Dwfl_Module *mod, Dwarf_Addr *bias) diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index 498c7cd2..9ba499bb 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -34,8 +34,8 @@ #include #include #include -#include "../libdw/libdwP.h" /* DWARF_E_* values are here. */ -#include "../libelf/libelfP.h" +#include "libdwP.h" /* DWARF_E_* values are here. */ +#include "libelfP.h" #include "system.h" static inline Dwfl_Error diff --git a/libdwfl/dwfl_module_getsrc.c b/libdwfl/dwfl_module_getsrc.c index fc99b163..73dbf435 100644 --- a/libdwfl/dwfl_module_getsrc.c +++ b/libdwfl/dwfl_module_getsrc.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" +#include "libdwP.h" Dwfl_Line * dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr) diff --git a/libdwfl/dwfl_module_getsrc_file.c b/libdwfl/dwfl_module_getsrc_file.c index cea2ba41..513af6b8 100644 --- a/libdwfl/dwfl_module_getsrc_file.c +++ b/libdwfl/dwfl_module_getsrc_file.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" +#include "libdwP.h" static inline const char * diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 19fa6ded..41285103 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -28,7 +28,7 @@ not, see . */ #include -#include "../libelf/libelfP.h" /* For NOTE_ALIGN4 and NOTE_ALIGN8. */ +#include "libelfP.h" /* For NOTE_ALIGN4 and NOTE_ALIGN8. */ #undef _ #include "libdwflP.h" #include "common.h" diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c index a0ef0014..f7fb3ab7 100644 --- a/libdwfl/elf-from-memory.c +++ b/libdwfl/elf-from-memory.c @@ -27,7 +27,7 @@ not, see . */ #include -#include "../libelf/libelfP.h" +#include "libelfP.h" #undef _ #include "libdwflP.h" diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c index 8185d84b..1e2f0255 100644 --- a/libdwfl/frame_unwind.c +++ b/libdwfl/frame_unwind.c @@ -33,7 +33,7 @@ #include "cfi.h" #include #include "libdwflP.h" -#include "../libdw/dwarf.h" +#include "dwarf.h" #include /* Maximum number of DWARF expression stack slots before returning an error. */ diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index 011b5de9..cdc528d0 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -38,12 +38,8 @@ #include #include -#include "../libdw/libdwP.h" /* We need its INTDECLs. */ -#include "../libdwelf/libdwelfP.h" - -#ifdef ENABLE_LIBDEBUGINFOD -#include "../debuginfod/debuginfod.h" -#endif +#include "libdwP.h" /* We need its INTDECLs. */ +#include "libdwelfP.h" typedef struct Dwfl_Process Dwfl_Process; diff --git a/libdwfl/lines.c b/libdwfl/lines.c index 128c0c97..a7f3004a 100644 --- a/libdwfl/lines.c +++ b/libdwfl/lines.c @@ -31,7 +31,7 @@ #endif #include "libdwflP.h" -#include "../libdw/libdwP.h" +#include "libdwP.h" Dwfl_Error internal_function diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index 7ec7eca1..06d85eb6 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -29,7 +29,7 @@ #include #include "libdwflP.h" -#include "../libdw/memory-access.h" +#include "memory-access.h" #include "system.h" #include diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c index ee7afa40..d6f9e971 100644 --- a/libdwfl/linux-core-attach.c +++ b/libdwfl/linux-core-attach.c @@ -34,7 +34,7 @@ #include #include "system.h" -#include "../libdw/memory-access.h" +#include "memory-access.h" struct core_arg { diff --git a/libdwfl/open.c b/libdwfl/open.c index 68b755cd..32bd7ff8 100644 --- a/libdwfl/open.c +++ b/libdwfl/open.c @@ -31,7 +31,7 @@ # include #endif -#include "../libelf/libelfP.h" +#include "libelfP.h" #undef _ #include "libdwflP.h" -- 2.18.4