diff options
| author | Ulrich Drepper <[email protected]> | 2007-10-04 18:40:28 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2007-10-04 18:40:28 +0000 |
| commit | 3fc3d7bd6bd8485404a936f7354e781dc2be6a5a (patch) | |
| tree | dd3067abcc90bb21b7e04567c6c4bbc7f79cfefd /src | |
| parent | 59ea7f33f781e6e3f8c9d81d457e5d99eee8f1ce (diff) | |
Build fixes for uninitialized variables.
Add some branch prediction.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/readelf.c | 18 |
2 files changed, 17 insertions, 7 deletions
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 <[email protected]> + + * readelf.c (dump_archive_index): Avoid warning about uninitialized + variable with older glibc versions. + Add some branch prediction. + 2007-10-04 Roland McGrath <[email protected]> * 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); |
