summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-04 18:40:28 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-04 18:40:28 +0000
commit3fc3d7bd6bd8485404a936f7354e781dc2be6a5a (patch)
treedd3067abcc90bb21b7e04567c6c4bbc7f79cfefd
parent59ea7f33f781e6e3f8c9d81d457e5d99eee8f1ce (diff)
Build fixes for uninitialized variables.
Add some branch prediction.
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/linux-kernel-modules.c3
-rw-r--r--src/ChangeLog6
-rw-r--r--src/readelf.c18
4 files changed, 25 insertions, 7 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 454d9342..d682f8f9 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-04 Ulrich Drepper <drepper@redhat.com>
+
+ * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Fake
+ initialization of notes variable.
+
2007-10-04 Roland McGrath <roland@redhat.com>
* linux-kernel-modules.c (intuit_kernel_bounds): Take new arg NOTES,
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 6164ae74..8954b2fe 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -501,6 +501,9 @@ dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
/* Try to figure out the bounds of the kernel image without
looking for any vmlinux file. */
Dwarf_Addr notes;
+ /* The compiler cannot deduce that if intuit_kernel_bounds returns
+ zero NOTES will be initialized. Fake the initialization. */
+ asm ("" : "=m" (notes));
int result = intuit_kernel_bounds (&start, &end, &notes);
if (result == 0)
{
diff --git a/src/ChangeLog b/src/ChangeLog
index f4937cf0..4d4fa9aa 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-04 Ulrich Drepper <drepper@redhat.com>
+
+ * readelf.c (dump_archive_index): Avoid warning about uninitialized
+ variable with older glibc versions.
+ Add some branch prediction.
+
2007-10-04 Roland McGrath <roland@redhat.com>
* readelf.c (print_archive_index): New variable.
diff --git a/src/readelf.c b/src/readelf.c
index fee908e9..ffcb0a1c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -5888,7 +5888,7 @@ print_strings (Ebl *ebl)
{
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+ if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -5921,7 +5921,7 @@ dump_archive_index (Elf *elf, const char *fname)
if (arsym == NULL)
{
int result = elf_errno ();
- if (result != ELF_E_NO_INDEX)
+ if (unlikely (result != ELF_E_NO_INDEX))
error (EXIT_FAILURE, 0,
gettext ("cannot get symbol index of archive '%s': %s"),
fname, elf_errmsg (result));
@@ -5941,11 +5941,15 @@ dump_archive_index (Elf *elf, const char *fname)
as_off = s->as_off;
Elf *subelf;
- if (elf_rand (elf, as_off) == 0
- || (subelf = elf_begin (-1, ELF_C_READ_MMAP, elf)) == NULL)
- error (EXIT_FAILURE, 0,
- gettext ("cannot extract member at offset %Zu in '%s': %s"),
- as_off, fname, elf_errmsg (-1));
+ if (unlikely (elf_rand (elf, as_off) == 0)
+ || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
+ == NULL))
+#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
+ while (1)
+#endif
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot extract member at offset %Zu in '%s': %s"),
+ as_off, fname, elf_errmsg (-1));
const Elf_Arhdr *h = elf_getarhdr (subelf);