#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.89 2011/08/17 11:34:39 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.90 2011/08/23 08:01:12 christos Exp $")
#endif
#ifdef BUILTIN_ELF
Elf64_Shdr sh64;
int stripped = 1;
void *nbuf;
- off_t noff;
+ off_t noff, coff;
uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */
}
off += size;
- if (xsh_offset > fsize) {
- /* Perhaps warn here */
- continue;
- }
-
+ /* Things we can determine before we seek */
switch (xsh_type) {
case SHT_SYMTAB:
#if 0
#endif
stripped = 0;
break;
+ default:
+ if (xsh_offset > fsize) {
+ /* Perhaps warn here */
+ continue;
+ }
+ break;
+ }
+
+ /* Things we can determine when we seek */
+ switch (xsh_type) {
case SHT_NOTE:
if ((nbuf = malloc((size_t)xsh_size)) == NULL) {
file_error(ms, errno, "Cannot allocate memory"
free(nbuf);
break;
case SHT_SUNW_cap:
- {
- off_t coff;
if (lseek(fd, (off_t)xsh_offset, SEEK_SET) ==
(off_t)-1) {
file_badseek(ms);
}
}
break;
- }
+
+ default:
+ break;
}
}
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
}
off += size;
- if (xph_offset > fsize) {
- /* Maybe warn here? */
- continue;
- }
+ /* Things we can determine before we seek */
switch (xph_type) {
case PT_DYNAMIC:
linking_style = "dynamically";
case PT_INTERP:
shared_libraries = " (uses shared libs)";
break;
+ default:
+ if (xph_offset > fsize) {
+ /* Maybe warn here? */
+ continue;
+ }
+ break;
+ }
+
+ /* Things we can determine when we seek */
+ switch (xph_type) {
case PT_NOTE:
if ((align = xph_align) & 0x80000000UL) {
if (file_printf(ms,