summaryrefslogtreecommitdiff
path: root/libdwfl
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2005-10-28 06:56:24 +0000
committerRoland McGrath <roland@redhat.com>2005-10-28 06:56:24 +0000
commit07d4f2fc1cb53f170a71bc13617bbdd9cb1c3c60 (patch)
tree0cd998a48772a7857dc187899cb5bb1f8decc35b /libdwfl
parent89757447dbcd0ac946db345fa6aa1edc76a37a11 (diff)
downloadelfutils-07d4f2fc1cb53f170a71bc13617bbdd9cb1c3c60.tar.gz
libdw/
Fixes to last changes. tests/ 2005-10-27 Roland McGrath <roland@redhat.com> * run-find-prologues.sh: New file. * Makefile.am (TESTS, EXTRA_DIST): Add it.
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog18
-rw-r--r--libdwfl/libdwflP.h1
-rw-r--r--libdwfl/linux-kernel-modules.c7
-rw-r--r--libdwfl/relocate.c48
4 files changed, 49 insertions, 25 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index efffa616..60bd68b3 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,21 @@
+2005-10-20 Roland McGrath <roland@redhat.com>
+
+ * libdwflP.h (DWFL_ERRORS): New error UNKNOWN_MACHINE.
+ * relocate.c (__libdwfl_relocate): Return DWFL_E_UNKNOWN_MACHINE
+ instead of DWFL_E_BADRELTYPE if ebl_get_elfmachine yields EM_NONE.
+
+2005-10-01 Roland McGrath <roland@redhat.com>
+
+ * linux-kernel-modules.c (report_kernel): Return ENOENT if we fail
+ with errno 0.
+
+2005-09-19 Roland McGrath <roland@redhat.com>
+
+ * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use
+ PRIx64 instead of PRIi64, lest addresses with high bits set overflow
+ the signed integer reading; they will just have to be in hexadecimal.
+ (dwfl_linux_kernel_module_section_address): Likewise.
+
2005-08-28 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (%.os): Use COMPILE.os.
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index ae8985db..c4f303ed 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -38,6 +38,7 @@
DWFL_ERROR (LIBELF, N_("See elf_errno")) \
DWFL_ERROR (LIBDW, N_("See dwarf_errno")) \
DWFL_ERROR (LIBEBL, N_("See ebl_errno (XXX missing)")) \
+ DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \
DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \
DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \
DWFL_ERROR (BADRELOFF, N_("r_offset is bogus")) \
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index ba65c599..c219c330 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -88,7 +88,8 @@ report_kernel (Dwfl *dwfl, const char *release,
int result = 0;
if (fd < 0)
- result = (predicate != NULL && !(*predicate) ("kernel", NULL)) ? 0 : errno;
+ result = ((predicate != NULL && !(*predicate) ("kernel", NULL))
+ ? 0 : errno ?: ENOENT);
else
{
bool report = true;
@@ -398,7 +399,7 @@ dwfl_linux_kernel_module_section_address
(void) __fsetlocking (f, FSETLOCKING_BYCALLER);
- int result = (fscanf (f, "%" PRIi64 "\n", addr) == 1 ? 0
+ int result = (fscanf (f, "%" PRIx64 "\n", addr) == 1 ? 0
: ferror_unlocked (f) ? errno : ENOEXEC);
fclose (f);
@@ -423,7 +424,7 @@ dwfl_linux_kernel_report_modules (Dwfl *dwfl)
Dwarf_Addr modaddr;
unsigned long int modsz;
char modname[128];
- while (fscanf (f, "%128s %lu %*s %*s %*s %" PRIi64 "\n",
+ while (fscanf (f, "%128s %lu %*s %*s %*s %" PRIx64 "\n",
modname, &modsz, &modaddr) == 3)
if (INTUSE(dwfl_report_module) (dwfl, modname,
modaddr, modaddr + modsz) == NULL)
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index fe03d397..8644fb77 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -168,20 +168,24 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
}
/* These are the types we can relocate. */
-#define TYPES DO_TYPE (BYTE, Byte) DO_TYPE (HALF, Half) \
- DO_TYPE (WORD, Word) DO_TYPE (SWORD, Sword) \
- DO_TYPE (XWORD, Xword) DO_TYPE (SXWORD, Sxword)
+#define TYPES DO_TYPE (BYTE, Byte); DO_TYPE (HALF, Half); \
+ DO_TYPE (WORD, Word); DO_TYPE (SWORD, Sword); \
+ DO_TYPE (XWORD, Xword); DO_TYPE (SXWORD, Sxword)
size_t size;
Elf_Type type = ebl_reloc_simple_type (mod->ebl, rtype);
switch (type)
{
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- size = sizeof (GElf_##Name); \
- break;
- TYPES
+#define DO_TYPE(NAME, Name) \
+ case ELF_T_##NAME: \
+ size = sizeof (GElf_##Name); \
+ break
+ TYPES;
#undef DO_TYPE
- default:
+ default:
+ /* This might be because ebl_openbackend failed to find
+ any libebl_CPU.so library. Diagnose that clearly. */
+ if (ebl_get_elfmachine (mod->ebl) == EM_NONE)
+ return DWFL_E_UNKNOWN_MACHINE;
return DWFL_E_BADRELTYPE;
}
@@ -189,7 +193,7 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
return DWFL_E_BADRELOFF;
#define DO_TYPE(NAME, Name) GElf_##Name Name;
- union { TYPES } tmpbuf;
+ union { TYPES; } tmpbuf;
#undef DO_TYPE
Elf_Data tmpdata =
{
@@ -213,13 +217,13 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
value += *addend;
switch (type)
{
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- tmpbuf.Name = value; \
- break;
- TYPES
+#define DO_TYPE(NAME, Name) \
+ case ELF_T_##NAME: \
+ tmpbuf.Name = value; \
+ break
+ TYPES;
#undef DO_TYPE
- default:
+ default:
abort ();
}
}
@@ -233,13 +237,13 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
assert (d == &tmpdata);
switch (type)
{
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- tmpbuf.Name += (GElf_##Name) value; \
- break;
- TYPES
+#define DO_TYPE(NAME, Name) \
+ case ELF_T_##NAME: \
+ tmpbuf.Name += (GElf_##Name) value; \
+ break
+ TYPES;
#undef DO_TYPE
- default:
+ default:
abort ();
}
}