[PATCH v2 01/16] ignore build directory

2022-12-17 Thread Yonggang Luo via Elfutils-devel
This is for in in three building and won't affect IDE for example mkdir build && cd build && ../configure && make install Signed-off-by: Yonggang Luo --- .gitignore | 1 + ChangeLog | 4 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 8bcd88d7..ca06 100644

[PATCH v2 02/16] move platform depended include into system.h of libebl

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Because all source in libebl #include , so #include 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 -#include -#include #include #include #include diff --git a/libebl/eblcorenote.c b/libebl/eblcoren

[PATCH v2 00/16] Patches for building with mingw/gcc msvc/clang-cl

2022-12-17 Thread Yonggang Luo via Elfutils-devel
I split it into small patches for easier to review Changes v1->v2: The reviews are applied Yonggang Luo (16): ignore build directory move platform depended include into system.h of libebl Use configure to detect HAVE_DECL_MMAP and use it for system doesn't provide sys/mman.h Fixes us

[PATCH v2 03/16] Use configure to detect HAVE_DECL_MMAP and use it for system doesn't provide sys/mman.h

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- configure.ac | 1 + lib/crc32_file.c | 4 ++-- lib/system.h | 2 ++ libelf/elf32_updatefile.c | 3 ++- libelf/elf_begin.c| 5 - libelf/elf_end.c | 2 ++ libelf/elf_update.c | 5 - 7 files changed, 17

[PATCH v2 04/16] Fixes usage of basename about prototype differences

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libdw/dwarf_getsrc_file.c| 2 +- libdwfl/dwfl_module_getsrc_file.c| 2 +- libdwfl/dwfl_segment_report_module.c | 2 +- libdwfl/find-debuginfo.c | 6 +++--- libdwfl/link_map.c | 2 +- src/addr2line.c

[PATCH v2 05/16] libcpu: Remove the need of NMNES by using enum

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libcpu/Makefile.am | 2 +- libcpu/i386_disasm.c | 14 +- libcpu/i386_mne.h| 36 libcpu/i386_parse.y | 9 +++-- 4 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 libcpu/i386_mne.h di

[PATCH v2 06/16] libcpu: Use __asm instead asm that can be recognized by both clang-cl and gcc

2022-12-17 Thread Yonggang Luo via Elfutils-devel
This block of code can not be removed. As it's contains a goto label enomem that been used elsewhere Signed-off-by: Yonggang Luo --- libcpu/i386_disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index c34f03d6..44bf7d37 10064

[PATCH v2 07/16] libdw: Fixes compile of dwarf_whatattr.c and dwarf_whatform.c

2022-12-17 Thread Yonggang Luo via Elfutils-devel
If __OPTIMIZE__ is defined, then compile dwarf_whatattr.c and dwarf_whatform.c will cause symbol conflict between dwarf_whatattr.c and libdw.h, dwarf_whatform.c and libdw.h, So always undefined __OPTIMIZE__ when compiling these two files The error message is: dwarf_whatform.c [build] C:\work\xe

[PATCH v2 10/16] libasm: stdio_ext.h are not present on win32

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libasm/asm_begin.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c index 9e4dfe43..9b6d974e 100644 --- a/libasm/asm_begin.c +++ b/libasm/asm_begin.c @@ -34,10 +34,13 @@ #include #include #includ

[PATCH v2 11/16] libebl/libdwelf: define ssize_t and pid_t for MSVC within installed header libdwelf.h and libebl.h

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libdwelf/libdwelf.h | 5 + libebl/libebl.h | 5 + 2 files changed, 10 insertions(+) diff --git a/libdwelf/libdwelf.h b/libdwelf/libdwelf.h index 263ca60e..167ac0dc 100644 --- a/libdwelf/libdwelf.h +++ b/libdwelf/libdwelf.h @@ -31,6 +31,11 @@ #includ

[PATCH v2 13/16] lib: isatty is not available on windows

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- lib/color.c | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/color.c b/lib/color.c index 8063dc26..963a2ec2 100644 --- a/lib/color.c +++ b/lib/color.c @@ -117,9 +117,14 @@ parse_opt (int key, char *arg, if (strcmp (arg, values[i].str) == 0)

[PATCH v2 08/16] lib: Implement error properly even when not HAVE_ERR_H

2022-12-17 Thread Yonggang Luo via Elfutils-devel
on win32, there is no err.h Signed-off-by: Yonggang Luo --- lib/error.c | 16 +++- lib/system.h | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/error.c b/lib/error.c index 5186fc15..d4cbf0ff 100644 --- a/lib/error.c +++ b/lib/error.c @@ -28,12 +28,14 @

[PATCH v2 12/16] libasm/debuginfod: fchmod doesn't present on win32

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- debuginfod/debuginfod-client.c | 4 +++- libasm/asm_end.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 8873fcc8..7a67a440 100644 --- a/debuginfod/debuginfod

[PATCH v2 09/16] libelf: uid_t, gid_t and mode_t are not comes with msvcrt, so using long/unsigned long instead on win32

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libelf/libelf.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libelf/libelf.h b/libelf/libelf.h index a139e733..2fa3838b 100644 --- a/libelf/libelf.h +++ b/libelf/libelf.h @@ -195,9 +195,15 @@ typedef struct { char *ar_name; /* Name of

[PATCH v2 16/16] lib: Use HAVE_LIBINTL_H to guard #include

2022-12-17 Thread Yonggang Luo via Elfutils-devel
MSVC doesn't have libintl.h, so use macro to guard it. Signed-off-by: Yonggang Luo --- configure.ac| 2 ++ lib/eu-config.h | 7 +++ 2 files changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index b84623fe..aea12be3 100644 --- a/configure.ac +++ b/configure.ac @@ -441,6 +

[PATCH v2 14/16] Add function sys_get_page_size to replace platform dependent sysconf (_SC_PAGESIZE)

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- lib/Makefile.am| 2 +- lib/crc32_file.c | 2 +- lib/system.c | 48 ++ lib/system.h | 3 +++ libdw/dwarf_begin_elf.c| 2 +- libdwelf/dwelf_strtab.c|

[PATCH v2 15/16] libelf: F_GETFD may not predefined with msvc/mingw, guard the usage of it

2022-12-17 Thread Yonggang Luo via Elfutils-devel
Signed-off-by: Yonggang Luo --- libelf/elf_begin.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 6d31882e..3d324694 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -1163,12 +1163,19 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *