diff options
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 26 | ||||
-rw-r--r-- | libdwfl/derelocate.c | 19 | ||||
-rw-r--r-- | libdwfl/linux-kernel-modules.c | 3 |
3 files changed, 27 insertions, 21 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 517ba216..d6aa70e5 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -30,14 +30,22 @@ * linux-kernel-modules.c: Don't include system.h. +2017-02-22 Ulf Hermann <ulf.hermann@qt.io> + + * dwfl_error.c: If we don't have a strerror_r returning a char*, + output a less useful message in case of a system error. + 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> + Mark Wielaard <mark@klomp.org> * derelocate.c (compare_secrefs): Compare by end address and then by - name if start addresses are equal. + section number if addresses are equal. 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> + Mark Wielaard <mark@klomp.org> - * elf-from-memory.c: Explicitly cast phnum to size_t. + * linux-kernel-modules.c: Always return NULL from kernel_release() on + non-linux systems and set errno to ENOTSUP. 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> @@ -99,17 +107,16 @@ 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> - * linux-kernel-modules.c: Always return NULL from kernel_release() on - non-linux systems. + * libdwfl.h: Use __const_attribute__. 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> - * dwfl_module_getdwarf.c: Check shnum for 0 before subtracting from - it. + * elf-from-memory.c: Explicitly cast phnum to size_t. 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> - * libdwfl.h: Use __const_attribute__. + * dwfl_module_getdwarf.c: Check shnum for 0 before subtracting from + it. 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> @@ -128,11 +135,6 @@ the note name data is the empty string. (dwfl_core_file_attach): Likewise. -2017-02-22 Ulf Hermann <ulf.hermann@qt.io> - - * dwfl_error.c: If we don't have a strerror_r returning a char*, - output a less useful message in case of a system error. - 2017-02-15 Ulf Hermann <ulf.hermann@qt.io> * linux-kernel-modules.c: Include system.h. diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c index 8d965af9..2f80b20f 100644 --- a/libdwfl/derelocate.c +++ b/libdwfl/derelocate.c @@ -57,22 +57,23 @@ struct secref static int compare_secrefs (const void *a, const void *b) { - struct secref const *p1 = *(struct secref *const *)a; - struct secref const *p2 = *(struct secref *const *)b; + struct secref *const *p1 = a; + struct secref *const *p2 = b; /* No signed difference calculation is correct here, since the terms are unsigned and could be more than INT64_MAX apart. */ - if (p1->start < p2->start) + if ((*p1)->start < (*p2)->start) return -1; - if (p1->start > p2->start) + if ((*p1)->start > (*p2)->start) return 1; - if (p1->end < p2->end) + + if ((*p1)->end < (*p2)->end) return -1; - if (p1->end > p2->end) + if ((*p1)->end > (*p2)->end) return 1; - if (p1->name == NULL) - return p2->name == NULL ? 0 : -1; - return p2->name == NULL ? 1 : strcmp(p1->name, p2->name); + + /* Same start/end, then just compare which section came first. */ + return elf_ndxscn ((*p1)->scn) - elf_ndxscn ((*p2)->scn); } static int diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index bd963d32..4b454d37 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -163,6 +163,9 @@ kernel_release (void) return NULL; return utsname.release; #else + /* Used for finding the running linux kernel, which isn't supported + on non-linux kernel systems. */ + errno = ENOTSUP; return NULL; #endif } |