From 4d6ed7c8cea13961e6c4bd3425dd679eb44ebc34 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 7 Feb 2001 19:41:03 +0000 Subject: [PATCH] Add -u option toi readelf to display unwind info. Add support to display unwind info for IA64 binaries. --- binutils/ChangeLog | 15 + binutils/Makefile.am | 2 +- binutils/Makefile.in | 5 +- binutils/po/binutils.pot | 768 +++++++++++++------------- binutils/readelf.c | 663 +++++++++++++++++++---- binutils/unwind-ia64.c | 1111 ++++++++++++++++++++++++++++++++++++++ binutils/unwind-ia64.h | 31 ++ 7 files changed, 2118 insertions(+), 477 deletions(-) create mode 100644 binutils/unwind-ia64.c create mode 100644 binutils/unwind-ia64.h diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b79058bf9ec..7e8766842e1 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,18 @@ +2001-02-07 David Mosberger + + * readelf.c (process_unwind): New function. + (slurp_ia64_unwind_table): Ditto. + (dump_ia64_unwind): Ditto. + (find_symbol_for_address): Ditto. + (slurp_rela_relocs): New function (split off from dump_relocations()). + (slurp_rel_relocs): Ditto. + (parse_args): Handle '-u' option. + + * unwind-ia64.c: New file. + * unwind-ia64.h: New file. + * Makefile.am: Include unwind-ia64.c in readelf build. + * Makefile.in: Regenerate. + 2001-02-04 Philip Blundell * configure.in (OBJDUMP_DEFS): Match `arm*-*', not just `arm-*'. diff --git a/binutils/Makefile.am b/binutils/Makefile.am index 1ddf2f7fc5e..d0adea0623c 100644 --- a/binutils/Makefile.am +++ b/binutils/Makefile.am @@ -161,7 +161,7 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) strings_SOURCES = strings.c $(BULIBS) -readelf_SOURCES = readelf.c version.c +readelf_SOURCES = readelf.c version.c unwind-ia64.c readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 1b2a2969db9..76b0b88b70a 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -253,7 +253,7 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) strings_SOURCES = strings.c $(BULIBS) -readelf_SOURCES = readelf.c version.c +readelf_SOURCES = readelf.c version.c unwind-ia64.c readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) @@ -394,7 +394,8 @@ version.$(OBJEXT) filemode.$(OBJEXT) addr2line_LDADD = $(LDADD) addr2line_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a addr2line_LDFLAGS = -readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) +readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \ +unwind-ia64.$(OBJEXT) readelf_DEPENDENCIES = ../libiberty/libiberty.a readelf_LDFLAGS = nm_new_OBJECTS = nm.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ diff --git a/binutils/po/binutils.pot b/binutils/po/binutils.pot index b497a04a046..c6df38c107a 100644 --- a/binutils/po/binutils.pot +++ b/binutils/po/binutils.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-01-11 12:02-0800\n" +"POT-Creation-Date: 2001-02-07 10:50-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -23,7 +23,7 @@ msgid "" msgstr "" #: addr2line.c:83 ar.c:288 nlmconv.c:1119 objcopy.c:373 objcopy.c:405 -#: readelf.c:1876 size.c:91 strings.c:530 windres.c:737 +#: readelf.c:1966 size.c:91 strings.c:530 windres.c:737 #, c-format msgid "Report bugs to %s\n" msgstr "" @@ -185,7 +185,7 @@ msgstr "" msgid "internal error -- this option not implemented" msgstr "" -#: ar.c:824 ar.c:876 ar.c:1322 objcopy.c:1124 +#: ar.c:824 ar.c:876 ar.c:1322 objcopy.c:1131 #, c-format msgid "internal stat error on %s" msgstr "" @@ -1174,17 +1174,17 @@ msgstr "" msgid "IEEE string length overflow: %u\n" msgstr "" -#: ieee.c:5324 +#: ieee.c:5333 #, c-format msgid "IEEE unsupported integer type size %u\n" msgstr "" -#: ieee.c:5360 +#: ieee.c:5369 #, c-format msgid "IEEE unsupported float type size %u\n" msgstr "" -#: ieee.c:5396 +#: ieee.c:5405 #, c-format msgid "IEEE unsupported complex type size %u\n" msgstr "" @@ -1618,138 +1618,142 @@ msgstr "" msgid "%s: Symbol \"%s\" is target of more than one redefinition" msgstr "" -#: objcopy.c:773 +#: objcopy.c:772 +msgid "Unable to change endianness of input file(s)" +msgstr "" + +#: objcopy.c:780 #, c-format msgid "copy from %s(%s) to %s(%s)\n" msgstr "" -#: objcopy.c:792 +#: objcopy.c:799 #, c-format msgid "Warning: Output file cannot represent architecture %s" msgstr "" -#: objcopy.c:819 +#: objcopy.c:826 #, c-format msgid "can't create section `%s': %s" msgstr "" -#: objcopy.c:905 +#: objcopy.c:912 #, c-format msgid "Can't fill gap after %s: %s" msgstr "" -#: objcopy.c:930 +#: objcopy.c:937 #, c-format msgid "Can't add padding to %s: %s" msgstr "" -#: objcopy.c:1068 +#: objcopy.c:1075 #, c-format msgid "%s: error copying private BFD data: %s" msgstr "" -#: objcopy.c:1102 +#: objcopy.c:1109 #, c-format msgid "cannot mkdir %s for archive copying (error: %s)" msgstr "" -#: objcopy.c:1291 +#: objcopy.c:1298 msgid "making" msgstr "" -#: objcopy.c:1300 +#: objcopy.c:1307 msgid "size" msgstr "" -#: objcopy.c:1314 +#: objcopy.c:1321 msgid "vma" msgstr "" -#: objcopy.c:1340 +#: objcopy.c:1347 msgid "alignment" msgstr "" -#: objcopy.c:1349 +#: objcopy.c:1356 msgid "flags" msgstr "" -#: objcopy.c:1363 +#: objcopy.c:1370 msgid "private data" msgstr "" -#: objcopy.c:1371 +#: objcopy.c:1378 #, c-format msgid "%s: section `%s': error in %s: %s" msgstr "" -#: objcopy.c:1645 +#: objcopy.c:1652 #, c-format msgid "%s: can't create debugging section: %s" msgstr "" -#: objcopy.c:1660 +#: objcopy.c:1667 #, c-format msgid "%s: can't set debugging section contents: %s" msgstr "" -#: objcopy.c:1669 +#: objcopy.c:1676 #, c-format msgid "%s: don't know how to write debugging information for %s" msgstr "" -#: objcopy.c:1775 +#: objcopy.c:1782 #, c-format msgid "%s: cannot stat: %s" msgstr "" -#: objcopy.c:1825 +#: objcopy.c:1832 msgid "byte number must be non-negative" msgstr "" -#: objcopy.c:1831 +#: objcopy.c:1838 msgid "interleave must be positive" msgstr "" -#: objcopy.c:1851 objcopy.c:1859 +#: objcopy.c:1858 objcopy.c:1866 #, c-format msgid "%s both copied and removed" msgstr "" -#: objcopy.c:1928 objcopy.c:1998 objcopy.c:2099 objcopy.c:2127 +#: objcopy.c:1935 objcopy.c:2005 objcopy.c:2106 objcopy.c:2134 #, c-format msgid "bad format for %s" msgstr "" -#: objcopy.c:1931 +#: objcopy.c:1938 #, c-format msgid "cannot stat: %s: %s" msgstr "" -#: objcopy.c:1949 +#: objcopy.c:1956 #, c-format msgid "cannot open: %s: %s" msgstr "" -#: objcopy.c:1953 +#: objcopy.c:1960 #, c-format msgid "%s: fread failed" msgstr "" -#: objcopy.c:2067 +#: objcopy.c:2074 #, c-format msgid "Warning: truncating gap-fill from 0x%s to 0x%x" msgstr "" -#: objcopy.c:2169 +#: objcopy.c:2176 msgid "byte number must be less than interleave" msgstr "" -#: objcopy.c:2188 +#: objcopy.c:2195 #, c-format msgid "Cannot stat: %s: %s" msgstr "" -#: objcopy.c:2228 objcopy.c:2242 +#: objcopy.c:2235 objcopy.c:2249 #, c-format msgid "%s %s%c0x%s never used" msgstr "" @@ -1996,984 +2000,1010 @@ msgstr "" msgid "Last stabs entries before error:\n" msgstr "" -#: readelf.c:260 +#: readelf.c:270 #, c-format msgid "Unable to seek to start of %s at %x\n" msgstr "" -#: readelf.c:268 +#: readelf.c:278 #, c-format msgid "Out of memory allocating %d bytes for %s\n" msgstr "" -#: readelf.c:274 +#: readelf.c:284 #, c-format msgid "Unable to read in %d bytes of %s\n" msgstr "" -#: readelf.c:284 +#: readelf.c:294 #, c-format msgid "Unable to seek to %x for %s\n" msgstr "" -#: readelf.c:289 +#: readelf.c:299 #, c-format msgid "Unable to read data at %x for %s\n" msgstr "" -#: readelf.c:304 readelf.c:330 +#: readelf.c:314 readelf.c:340 #, c-format msgid "%s: Error: " msgstr "" -#: readelf.c:316 readelf.c:345 +#: readelf.c:326 readelf.c:355 #, c-format msgid "%s: Warning: " msgstr "" -#: readelf.c:395 readelf.c:533 +#: readelf.c:405 readelf.c:543 #, c-format msgid "Unhandled data length: %d\n" msgstr "" -#: readelf.c:597 +#: readelf.c:607 msgid "Don't know about relocations on this machine architecture\n" msgstr "" -#: readelf.c:637 readelf.c:666 readelf.c:698 readelf.c:726 +#: readelf.c:638 readelf.c:665 readelf.c:708 readelf.c:733 msgid "out of memory parsing relocs" msgstr "" -#: readelf.c:744 +#: readelf.c:782 msgid "" " Offset Info Type Symbol's Value Symbol's Name " "Addend\n" msgstr "" -#: readelf.c:747 +#: readelf.c:785 msgid " Offset Info Type Symbol's Value Symbol's Name\n" msgstr "" -#: readelf.c:907 readelf.c:909 +#: readelf.c:945 readelf.c:947 #, c-format msgid "unrecognised: %-7lx" msgstr "" -#: readelf.c:934 +#: readelf.c:972 #, c-format msgid "" msgstr "" -#: readelf.c:1147 +#: readelf.c:1185 #, c-format msgid "Processor Specific: %lx" msgstr "" -#: readelf.c:1166 +#: readelf.c:1204 #, c-format msgid "Operating System specific: %lx" msgstr "" -#: readelf.c:1169 readelf.c:1677 +#: readelf.c:1207 readelf.c:1748 #, c-format msgid ": %lx" msgstr "" -#: readelf.c:1183 +#: readelf.c:1221 msgid "NONE (None)" msgstr "" -#: readelf.c:1184 +#: readelf.c:1222 msgid "REL (Relocatable file)" msgstr "" -#: readelf.c:1185 +#: readelf.c:1223 msgid "EXEC (Executable file)" msgstr "" -#: readelf.c:1186 +#: readelf.c:1224 msgid "DYN (Shared object file)" msgstr "" -#: readelf.c:1187 +#: readelf.c:1225 msgid "CORE (Core file)" msgstr "" -#: readelf.c:1191 +#: readelf.c:1229 #, c-format msgid "Processor Specific: (%x)" msgstr "" -#: readelf.c:1193 +#: readelf.c:1231 #, c-format msgid "OS Specific: (%x)" msgstr "" -#: readelf.c:1195 readelf.c:1281 readelf.c:1811 +#: readelf.c:1233 readelf.c:1319 readelf.c:1899 #, c-format msgid ": %x" msgstr "" -#: readelf.c:1208 +#: readelf.c:1246 msgid "None" msgstr "" -#: readelf.c:1849 +#: readelf.c:1938 msgid "Usage: readelf {options} elf-file(s)\n" msgstr "" -#: readelf.c:1850 +#: readelf.c:1939 msgid " Options are:\n" msgstr "" -#: readelf.c:1851 +#: readelf.c:1940 msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" msgstr "" -#: readelf.c:1852 +#: readelf.c:1941 msgid " -h or --file-header Display the ELF file header\n" msgstr "" -#: readelf.c:1853 +#: readelf.c:1942 msgid " -l or --program-headers or --segments\n" msgstr "" -#: readelf.c:1854 +#: readelf.c:1943 msgid " Display the program headers\n" msgstr "" -#: readelf.c:1855 +#: readelf.c:1944 msgid " -S or --section-headers or --sections\n" msgstr "" -#: readelf.c:1856 +#: readelf.c:1945 msgid " Display the sections' header\n" msgstr "" -#: readelf.c:1857 +#: readelf.c:1946 msgid " -e or --headers Equivalent to: -h -l -S\n" msgstr "" -#: readelf.c:1858 +#: readelf.c:1947 msgid " -s or --syms or --symbols Display the symbol table\n" msgstr "" -#: readelf.c:1859 +#: readelf.c:1948 msgid " -n or --notes Display the core notes (if present)\n" msgstr "" -#: readelf.c:1860 +#: readelf.c:1949 msgid " -r or --relocs Display the relocations (if present)\n" msgstr "" -#: readelf.c:1861 +#: readelf.c:1950 +msgid " -u or --unwind Display the unwind info (if present)\n" +msgstr "" + +#: readelf.c:1951 msgid " -d or --dynamic Display the dynamic segment (if present)\n" msgstr "" -#: readelf.c:1862 +#: readelf.c:1952 msgid " -V or --version-info Display the version sections (if present)\n" msgstr "" -#: readelf.c:1863 +#: readelf.c:1953 msgid "" " -A or --arch-specific Display architecture specific information (if " "any).\n" msgstr "" -#: readelf.c:1864 +#: readelf.c:1954 msgid "" " -D or --use-dynamic Use the dynamic section info when displaying " "symbols\n" msgstr "" -#: readelf.c:1865 +#: readelf.c:1955 msgid " -x or --hex-dump=\n" msgstr "" -#: readelf.c:1866 +#: readelf.c:1956 msgid " Dump the contents of section \n" msgstr "" -#: readelf.c:1867 +#: readelf.c:1957 msgid "" " -w[liaprf] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]\n" msgstr "" -#: readelf.c:1868 +#: readelf.c:1958 msgid "" " Display the contents of DWARF2 debug sections\n" msgstr "" -#: readelf.c:1870 +#: readelf.c:1960 msgid " -i or --instruction-dump=\n" msgstr "" -#: readelf.c:1871 +#: readelf.c:1961 msgid "" " Disassemble the contents of section \n" msgstr "" -#: readelf.c:1873 +#: readelf.c:1963 msgid " -I or --histogram Display histogram of bucket list lengths\n" msgstr "" -#: readelf.c:1874 +#: readelf.c:1964 msgid " -v or --version Display the version number of readelf\n" msgstr "" -#: readelf.c:1875 +#: readelf.c:1965 msgid " -H or --help Display this information\n" msgstr "" -#: readelf.c:1893 +#: readelf.c:1983 msgid "Out of memory allocating dump request table." msgstr "" -#: readelf.c:2033 +#: readelf.c:2127 #, c-format msgid "Unrecognised debug option '%s'\n" msgstr "" -#: readelf.c:2058 +#: readelf.c:2152 #, c-format msgid "Invalid option '-%c'\n" msgstr "" -#: readelf.c:2071 +#: readelf.c:2165 msgid "Nothing to do.\n" msgstr "" -#: readelf.c:2084 readelf.c:2101 readelf.c:3740 +#: readelf.c:2178 readelf.c:2195 readelf.c:4192 msgid "none" msgstr "" -#: readelf.c:2085 +#: readelf.c:2179 msgid "ELF32" msgstr "" -#: readelf.c:2086 +#: readelf.c:2180 msgid "ELF64" msgstr "" -#: readelf.c:2088 readelf.c:2105 readelf.c:2133 +#: readelf.c:2182 readelf.c:2199 readelf.c:2227 #, c-format msgid "" msgstr "" -#: readelf.c:2102 +#: readelf.c:2196 msgid "2's complement, little endian" msgstr "" -#: readelf.c:2103 +#: readelf.c:2197 msgid "2's complement, big endian" msgstr "" -#: readelf.c:2118 +#: readelf.c:2212 msgid "UNIX - System V" msgstr "" -#: readelf.c:2119 +#: readelf.c:2213 msgid "UNIX - HP-UX" msgstr "" -#: readelf.c:2120 +#: readelf.c:2214 msgid "UNIX - NetBSD" msgstr "" -#: readelf.c:2121 +#: readelf.c:2215 msgid "UNIX - Linux" msgstr "" -#: readelf.c:2122 +#: readelf.c:2216 msgid "GNU/Hurd" msgstr "" -#: readelf.c:2123 +#: readelf.c:2217 msgid "UNIX - Solaris" msgstr "" -#: readelf.c:2124 +#: readelf.c:2218 msgid "UNIX - AIX" msgstr "" -#: readelf.c:2125 +#: readelf.c:2219 msgid "UNIX - IRIX" msgstr "" -#: readelf.c:2126 +#: readelf.c:2220 msgid "UNIX - FreeBSD" msgstr "" -#: readelf.c:2127 +#: readelf.c:2221 msgid "UNIX - TRU64" msgstr "" -#: readelf.c:2128 +#: readelf.c:2222 msgid "Novell - Modesto" msgstr "" -#: readelf.c:2129 +#: readelf.c:2223 msgid "UNIX - OpenBSD" msgstr "" -#: readelf.c:2130 +#: readelf.c:2224 msgid "Standalone App" msgstr "" -#: readelf.c:2131 +#: readelf.c:2225 msgid "ARM" msgstr "" -#: readelf.c:2148 +#: readelf.c:2242 msgid "Not an ELF file - it has the wrong magic bytes at the start\n" msgstr "" -#: readelf.c:2156 +#: readelf.c:2250 msgid "ELF Header:\n" msgstr "" -#: readelf.c:2157 +#: readelf.c:2251 msgid " Magic: " msgstr "" -#: readelf.c:2161 +#: readelf.c:2255 #, c-format msgid " Class: %s\n" msgstr "" -#: readelf.c:2163 +#: readelf.c:2257 #, c-format msgid " Data: %s\n" msgstr "" -#: readelf.c:2165 +#: readelf.c:2259 #, c-format msgid " Version: %d %s\n" msgstr "" -#: readelf.c:2172 +#: readelf.c:2266 #, c-format msgid " OS/ABI: %s\n" msgstr "" -#: readelf.c:2174 +#: readelf.c:2268 #, c-format msgid " ABI Version: %d\n" msgstr "" -#: readelf.c:2176 +#: readelf.c:2270 #, c-format msgid " Type: %s\n" msgstr "" -#: readelf.c:2178 +#: readelf.c:2272 #, c-format msgid " Machine: %s\n" msgstr "" -#: readelf.c:2180 +#: readelf.c:2274 #, c-format msgid " Version: 0x%lx\n" msgstr "" -#: readelf.c:2183 +#: readelf.c:2277 msgid " Entry point address: " msgstr "" -#: readelf.c:2185 +#: readelf.c:2279 msgid "" "\n" " Start of program headers: " msgstr "" -#: readelf.c:2187 +#: readelf.c:2281 msgid "" " (bytes into file)\n" " Start of section headers: " msgstr "" -#: readelf.c:2189 +#: readelf.c:2283 msgid " (bytes into file)\n" msgstr "" -#: readelf.c:2191 +#: readelf.c:2285 #, c-format msgid " Flags: 0x%lx%s\n" msgstr "" -#: readelf.c:2194 +#: readelf.c:2288 #, c-format msgid " Size of this header: %ld (bytes)\n" msgstr "" -#: readelf.c:2196 +#: readelf.c:2290 #, c-format msgid " Size of program headers: %ld (bytes)\n" msgstr "" -#: readelf.c:2198 +#: readelf.c:2292 #, c-format msgid " Number of program headers: %ld\n" msgstr "" -#: readelf.c:2200 +#: readelf.c:2294 #, c-format msgid " Size of section headers: %ld (bytes)\n" msgstr "" -#: readelf.c:2202 +#: readelf.c:2296 #, c-format msgid " Number of section headers: %ld\n" msgstr "" -#: readelf.c:2204 +#: readelf.c:2298 #, c-format msgid " Section header string table index: %ld\n" msgstr "" -#: readelf.c:2289 +#: readelf.c:2383 msgid "" "\n" "There are no program headers in this file.\n" msgstr "" -#: readelf.c:2295 +#: readelf.c:2389 #, c-format msgid "" "\n" "Elf file type is %s\n" msgstr "" -#: readelf.c:2296 +#: readelf.c:2390 msgid "Entry point " msgstr "" -#: readelf.c:2298 +#: readelf.c:2392 #, c-format msgid "" "\n" "There are %d program headers, starting at offset " msgstr "" -#: readelf.c:2309 readelf.c:2485 readelf.c:2527 readelf.c:2570 readelf.c:2611 -#: readelf.c:3133 readelf.c:3174 readelf.c:3350 readelf.c:4358 readelf.c:4372 -#: readelf.c:7741 readelf.c:7781 +#: readelf.c:2403 readelf.c:2579 readelf.c:2621 readelf.c:2664 readelf.c:2705 +#: readelf.c:3585 readelf.c:3626 readelf.c:3802 readelf.c:4723 readelf.c:4737 +#: readelf.c:8108 readelf.c:8148 msgid "Out of memory\n" msgstr "" -#: readelf.c:2327 +#: readelf.c:2421 #, c-format msgid "" "\n" "Program Header%s:\n" msgstr "" -#: readelf.c:2331 +#: readelf.c:2425 msgid "" " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" msgstr "" -#: readelf.c:2335 +#: readelf.c:2429 msgid " Type Offset VirtAddr PhysAddr\n" msgstr "" -#: readelf.c:2337 +#: readelf.c:2431 msgid " FileSiz MemSiz Flags Align\n" msgstr "" -#: readelf.c:2395 +#: readelf.c:2489 msgid "more than one dynamic segment\n" msgstr "" -#: readelf.c:2403 +#: readelf.c:2497 msgid "Unable to find program interpreter name\n" msgstr "" -#: readelf.c:2410 +#: readelf.c:2504 #, c-format msgid "" "\n" " [Requesting program interpreter: %s]" msgstr "" -#: readelf.c:2428 +#: readelf.c:2522 msgid "" "\n" " Section to Segment mapping:\n" msgstr "" -#: readelf.c:2429 +#: readelf.c:2523 msgid " Segment Sections...\n" msgstr "" -#: readelf.c:2693 +#: readelf.c:2787 msgid "" "\n" "There are no sections in this file.\n" msgstr "" -#: readelf.c:2699 +#: readelf.c:2793 #, c-format msgid "There are %d section headers, starting at offset 0x%lx:\n" msgstr "" -#: readelf.c:2739 +#: readelf.c:2831 msgid "File contains multiple dynamic symbol tables\n" msgstr "" -#: readelf.c:2752 +#: readelf.c:2844 msgid "File contains multiple dynamic string tables\n" msgstr "" -#: readelf.c:2786 +#: readelf.c:2878 #, c-format msgid "" "\n" "Section Header%s:\n" msgstr "" -#: readelf.c:2790 +#: readelf.c:2882 msgid "" " [Nr] Name Type Addr Off Size ES Flg Lk " "Inf Al\n" msgstr "" -#: readelf.c:2793 +#: readelf.c:2885 msgid " [Nr] Name Type Address Offset\n" msgstr "" -#: readelf.c:2794 +#: readelf.c:2886 msgid " Size EntSize Flags Link Info Align\n" msgstr "" -#: readelf.c:2841 +#: readelf.c:2933 msgid "Key to Flags:\n" msgstr "" -#: readelf.c:2842 +#: readelf.c:2934 msgid " W (write), A (alloc), X (execute), M (merge), S (strings)\n" msgstr "" -#: readelf.c:2843 +#: readelf.c:2935 msgid " I (info), L (link order), G (group), x (unknown)\n" msgstr "" -#: readelf.c:2844 +#: readelf.c:2936 msgid "" " O (extra OS processing required) o (OS specific), p (processor specific)\n" msgstr "" -#: readelf.c:2902 +#: readelf.c:2994 #, c-format msgid "" "\n" "Relocation section at offset 0x%lx contains %ld bytes:\n" msgstr "" -#: readelf.c:2909 +#: readelf.c:3001 msgid "" "\n" "There are no dynamic relocations in this file.\n" msgstr "" -#: readelf.c:2937 +#: readelf.c:3029 msgid "" "\n" "Relocation section " msgstr "" -#: readelf.c:2944 +#: readelf.c:3036 readelf.c:3407 #, c-format msgid " at offset 0x%lx contains %lu entries:\n" msgstr "" -#: readelf.c:2972 +#: readelf.c:3064 msgid "" "\n" "There are no relocations in this file.\n" msgstr "" -#: readelf.c:3227 +#: readelf.c:3308 readelf.c:3320 +#, c-format +msgid "Skipping unexpected symbol type %u" +msgstr "" + +#: readelf.c:3328 +#, c-format +msgid "Skipping unexpected relocation type %s" +msgstr "" + +#: readelf.c:3400 +msgid "" +"\n" +"Unwind section " +msgstr "" + +#: readelf.c:3416 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" + +#: readelf.c:3679 msgid "" "\n" "There is no dynamic segment in this file.\n" msgstr "" -#: readelf.c:3261 +#: readelf.c:3713 msgid "Unable to seek to end of file!" msgstr "" -#: readelf.c:3270 +#: readelf.c:3722 msgid "Unable to determine the number of symbols to load\n" msgstr "" -#: readelf.c:3300 +#: readelf.c:3752 msgid "Unable to seek to end of file\n" msgstr "" -#: readelf.c:3306 +#: readelf.c:3758 msgid "Unable to determine the length of the dynamic string table\n" msgstr "" -#: readelf.c:3367 +#: readelf.c:3819 #, c-format msgid "" "\n" "Dynamic segment at offset 0x%x contains %ld entries:\n" msgstr "" -#: readelf.c:3370 +#: readelf.c:3822 msgid " Tag Type Name/Value\n" msgstr "" -#: readelf.c:3406 +#: readelf.c:3858 msgid "Auxiliary library" msgstr "" -#: readelf.c:3410 +#: readelf.c:3862 msgid "Filter library" msgstr "" -#: readelf.c:3414 +#: readelf.c:3866 msgid "Configuration file" msgstr "" -#: readelf.c:3418 +#: readelf.c:3870 msgid "Dependency audit library" msgstr "" -#: readelf.c:3422 +#: readelf.c:3874 msgid "Audit library" msgstr "" -#: readelf.c:3440 readelf.c:3466 readelf.c:3492 +#: readelf.c:3892 readelf.c:3918 readelf.c:3944 msgid "Flags:" msgstr "" -#: readelf.c:3442 readelf.c:3468 readelf.c:3494 +#: readelf.c:3894 readelf.c:3920 readelf.c:3946 msgid " None\n" msgstr "" -#: readelf.c:3613 +#: readelf.c:4065 #, c-format msgid "Shared library: [%s]" msgstr "" -#: readelf.c:3616 +#: readelf.c:4068 msgid " program interpreter" msgstr "" -#: readelf.c:3620 +#: readelf.c:4072 #, c-format msgid "Library soname: [%s]" msgstr "" -#: readelf.c:3624 +#: readelf.c:4076 #, c-format msgid "Library rpath: [%s]" msgstr "" -#: readelf.c:3628 +#: readelf.c:4080 #, c-format msgid "Library runpath: [%s]" msgstr "" -#: readelf.c:3689 +#: readelf.c:4141 #, c-format msgid "Not needed object: [%s]\n" msgstr "" -#: readelf.c:3786 +#: readelf.c:4238 #, c-format msgid "" "\n" "Version definition section '%s' contains %ld entries:\n" msgstr "" -#: readelf.c:3789 +#: readelf.c:4241 msgid " Addr: 0x" msgstr "" -#: readelf.c:3791 readelf.c:3979 +#: readelf.c:4243 readelf.c:4431 #, c-format msgid " Offset: %#08lx Link: %lx (%s)\n" msgstr "" -#: readelf.c:3821 +#: readelf.c:4273 #, c-format msgid " %#06x: Rev: %d Flags: %s" msgstr "" -#: readelf.c:3824 +#: readelf.c:4276 #, c-format msgid " Index: %d Cnt: %d " msgstr "" -#: readelf.c:3835 +#: readelf.c:4287 #, c-format msgid "Name: %s\n" msgstr "" -#: readelf.c:3837 +#: readelf.c:4289 #, c-format msgid "Name index: %ld\n" msgstr "" -#: readelf.c:3852 +#: readelf.c:4304 #, c-format msgid " %#06x: Parent %d: %s\n" msgstr "" -#: readelf.c:3855 +#: readelf.c:4307 #, c-format msgid " %#06x: Parent %d, name index: %ld\n" msgstr "" -#: readelf.c:3874 +#: readelf.c:4326 #, c-format msgid "" "\n" "Version needs section '%s' contains %ld entries:\n" msgstr "" -#: readelf.c:3877 +#: readelf.c:4329 msgid " Addr: 0x" msgstr "" -#: readelf.c:3879 +#: readelf.c:4331 #, c-format msgid " Offset: %#08lx Link to section: %ld (%s)\n" msgstr "" -#: readelf.c:3905 +#: readelf.c:4357 #, c-format msgid " %#06x: Version: %d" msgstr "" -#: readelf.c:3908 +#: readelf.c:4360 #, c-format msgid " File: %s" msgstr "" -#: readelf.c:3910 +#: readelf.c:4362 #, c-format msgid " File: %lx" msgstr "" -#: readelf.c:3912 +#: readelf.c:4364 #, c-format msgid " Cnt: %d\n" msgstr "" -#: readelf.c:3930 +#: readelf.c:4382 #, c-format msgid " %#06x: Name: %s" msgstr "" -#: readelf.c:3933 +#: readelf.c:4385 #, c-format msgid " %#06x: Name index: %lx" msgstr "" -#: readelf.c:3936 +#: readelf.c:4388 #, c-format msgid " Flags: %s Version: %d\n" msgstr "" -#: readelf.c:3974 +#: readelf.c:4426 #, c-format msgid "" "\n" "Version symbols section '%s' contains %d entries:\n" msgstr "" -#: readelf.c:3977 +#: readelf.c:4429 msgid " Addr: " msgstr "" -#: readelf.c:4007 +#: readelf.c:4460 msgid " 0 (*local*) " msgstr "" -#: readelf.c:4011 +#: readelf.c:4464 msgid " 1 (*global*) " msgstr "" -#: readelf.c:4233 +#: readelf.c:4598 msgid "" "\n" "No version information found in this file.\n" msgstr "" -#: readelf.c:4251 readelf.c:4286 +#: readelf.c:4616 readelf.c:4651 #, c-format msgid ": %d" msgstr "" -#: readelf.c:4253 readelf.c:4298 +#: readelf.c:4618 readelf.c:4663 #, c-format msgid ": %d" msgstr "" -#: readelf.c:4255 readelf.c:4301 +#: readelf.c:4620 readelf.c:4666 #, c-format msgid ": %d" msgstr "" -#: readelf.c:4364 +#: readelf.c:4729 msgid "Unable to read in dynamic data\n" msgstr "" -#: readelf.c:4406 +#: readelf.c:4771 msgid "Unable to seek to start of dynamic information" msgstr "" -#: readelf.c:4412 +#: readelf.c:4777 msgid "Failed to read in number of buckets\n" msgstr "" -#: readelf.c:4418 +#: readelf.c:4783 msgid "Failed to read in number of chains\n" msgstr "" -#: readelf.c:4438 +#: readelf.c:4803 msgid "" "\n" "Symbol table for image:\n" msgstr "" -#: readelf.c:4440 +#: readelf.c:4805 msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:4442 +#: readelf.c:4807 msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:4486 +#: readelf.c:4851 #, c-format msgid "" "\n" "Symbol table '%s' contains %lu entries:\n" msgstr "" -#: readelf.c:4490 +#: readelf.c:4855 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:4492 +#: readelf.c:4857 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:4601 +#: readelf.c:4967 msgid "bad dynamic symbol" msgstr "" -#: readelf.c:4660 +#: readelf.c:5027 msgid "" "\n" "Dynamic symbol information is not available for displaying symbols.\n" msgstr "" -#: readelf.c:4672 +#: readelf.c:5039 #, c-format msgid "" "\n" "Histogram for bucket list length (total of %d buckets):\n" msgstr "" -#: readelf.c:4674 +#: readelf.c:5041 msgid " Length Number %% of total Coverage\n" msgstr "" -#: readelf.c:4679 readelf.c:4698 readelf.c:7423 readelf.c:7616 +#: readelf.c:5046 readelf.c:5065 readelf.c:7790 readelf.c:7983 msgid "Out of memory" msgstr "" -#: readelf.c:4747 +#: readelf.c:5114 #, c-format msgid "" "\n" "Dynamic info segment at offset 0x%lx contains %d entries:\n" msgstr "" -#: readelf.c:4750 +#: readelf.c:5117 msgid " Num: Name BoundTo Flags\n" msgstr "" -#: readelf.c:4798 +#: readelf.c:5165 #, c-format msgid "" "\n" "Assembly dump of section %s\n" msgstr "" -#: readelf.c:4821 +#: readelf.c:5188 #, c-format msgid "" "\n" "Section '%s' has no data to dump.\n" msgstr "" -#: readelf.c:4826 +#: readelf.c:5193 #, c-format msgid "" "\n" "Hex dump of section '%s':\n" msgstr "" -#: readelf.c:4978 +#: readelf.c:5345 msgid "badly formed extended line op encountered!" msgstr "" -#: readelf.c:4985 +#: readelf.c:5352 #, c-format msgid " Extended opcode %d: " msgstr "" -#: readelf.c:4990 +#: readelf.c:5357 msgid "" "End of Sequence\n" "\n" msgstr "" -#: readelf.c:4996 +#: readelf.c:5363 #, c-format msgid "set Address to 0x%lx\n" msgstr "" -#: readelf.c:5001 +#: readelf.c:5368 msgid " define new File Table entry\n" msgstr "" -#: readelf.c:5002 readelf.c:5124 +#: readelf.c:5369 readelf.c:5491 msgid " Entry\tDir\tTime\tSize\tName\n" msgstr "" -#: readelf.c:5004 +#: readelf.c:5371 #, c-format msgid " %d\t" msgstr "" -#: readelf.c:5007 readelf.c:5009 readelf.c:5011 readelf.c:5136 readelf.c:5138 -#: readelf.c:5140 +#: readelf.c:5374 readelf.c:5376 readelf.c:5378 readelf.c:5503 readelf.c:5505 +#: readelf.c:5507 #, c-format msgid "%lu\t" msgstr "" -#: readelf.c:5012 +#: readelf.c:5379 #, c-format msgid "" "%s\n" "\n" msgstr "" -#: readelf.c:5016 +#: readelf.c:5383 #, c-format msgid "UNKNOWN: length %d\n" msgstr "" -#: readelf.c:5042 +#: readelf.c:5409 #, c-format msgid "" "\n" @@ -2981,503 +3011,503 @@ msgid "" "\n" msgstr "" -#: readelf.c:5054 +#: readelf.c:5421 msgid "The line info appears to be corrupt - the section is too small\n" msgstr "" -#: readelf.c:5062 +#: readelf.c:5429 msgid "Only DWARF version 2 line info is currently supported.\n" msgstr "" -#: readelf.c:5077 +#: readelf.c:5444 #, c-format msgid " Length: %ld\n" msgstr "" -#: readelf.c:5078 +#: readelf.c:5445 #, c-format msgid " DWARF Version: %d\n" msgstr "" -#: readelf.c:5079 +#: readelf.c:5446 #, c-format msgid " Prolgue Length: %d\n" msgstr "" -#: readelf.c:5080 +#: readelf.c:5447 #, c-format msgid " Minimum Instruction Length: %d\n" msgstr "" -#: readelf.c:5081 +#: readelf.c:5448 #, c-format msgid " Initial value of 'is_stmt': %d\n" msgstr "" -#: readelf.c:5082 +#: readelf.c:5449 #, c-format msgid " Line Base: %d\n" msgstr "" -#: readelf.c:5083 +#: readelf.c:5450 #, c-format msgid " Line Range: %d\n" msgstr "" -#: readelf.c:5084 +#: readelf.c:5451 #, c-format msgid " Opcode Base: %d\n" msgstr "" -#: readelf.c:5093 +#: readelf.c:5460 msgid "" "\n" " Opcodes:\n" msgstr "" -#: readelf.c:5096 +#: readelf.c:5463 #, c-format msgid " Opcode %d has %d args\n" msgstr "" -#: readelf.c:5102 +#: readelf.c:5469 msgid "" "\n" " The Directory Table is empty.\n" msgstr "" -#: readelf.c:5105 +#: readelf.c:5472 msgid "" "\n" " The Directory Table:\n" msgstr "" -#: readelf.c:5109 +#: readelf.c:5476 #, c-format msgid " %s\n" msgstr "" -#: readelf.c:5120 +#: readelf.c:5487 msgid "" "\n" " The File Name Table is empty.\n" msgstr "" -#: readelf.c:5123 +#: readelf.c:5490 msgid "" "\n" " The File Name Table:\n" msgstr "" -#: readelf.c:5131 +#: readelf.c:5498 #, c-format msgid " %d\t" msgstr "" -#: readelf.c:5142 +#: readelf.c:5509 #, c-format msgid "%s\n" msgstr "" #. Now display the statements. -#: readelf.c:5150 +#: readelf.c:5517 msgid "" "\n" " Line Number Statements:\n" msgstr "" -#: readelf.c:5169 +#: readelf.c:5536 msgid " Copy\n" msgstr "" -#: readelf.c:5176 +#: readelf.c:5543 #, c-format msgid " Advance PC by %d to %lx\n" msgstr "" -#: readelf.c:5184 +#: readelf.c:5551 #, c-format msgid " Advance Line by %d to %d\n" msgstr "" -#: readelf.c:5191 +#: readelf.c:5558 #, c-format msgid " Set File Name to entry %d in the File Name Table\n" msgstr "" -#: readelf.c:5199 +#: readelf.c:5566 #, c-format msgid " Set column to %d\n" msgstr "" -#: readelf.c:5206 +#: readelf.c:5573 #, c-format msgid " Set is_stmt to %d\n" msgstr "" -#: readelf.c:5211 +#: readelf.c:5578 msgid " Set basic block\n" msgstr "" -#: readelf.c:5219 +#: readelf.c:5586 #, c-format msgid " Advance PC by constant %d to 0x%lx\n" msgstr "" -#: readelf.c:5227 +#: readelf.c:5594 #, c-format msgid " Advance PC by fixed size amount %d to 0x%lx\n" msgstr "" -#: readelf.c:5235 +#: readelf.c:5602 #, c-format msgid " Special opcode %d: advance Address by %d to 0x%lx" msgstr "" -#: readelf.c:5239 +#: readelf.c:5606 #, c-format msgid " and Line by %d to %d\n" msgstr "" -#: readelf.c:5262 readelf.c:5691 +#: readelf.c:5629 readelf.c:6058 #, c-format msgid "" "Contents of the %s section:\n" "\n" msgstr "" -#: readelf.c:5285 +#: readelf.c:5652 msgid "Only DWARF 2 pubnames are currently supported\n" msgstr "" -#: readelf.c:5292 +#: readelf.c:5659 #, c-format msgid " Length: %ld\n" msgstr "" -#: readelf.c:5294 +#: readelf.c:5661 #, c-format msgid " Version: %d\n" msgstr "" -#: readelf.c:5296 +#: readelf.c:5663 #, c-format msgid " Offset into .debug_info section: %ld\n" msgstr "" -#: readelf.c:5298 +#: readelf.c:5665 #, c-format msgid " Size of area in .debug_info section: %ld\n" msgstr "" -#: readelf.c:5301 +#: readelf.c:5668 msgid "" "\n" " Offset\tName\n" msgstr "" -#: readelf.c:5383 +#: readelf.c:5750 #, c-format msgid "Unknown TAG value: %lx" msgstr "" -#: readelf.c:5478 +#: readelf.c:5845 #, c-format msgid "Unknown AT value: %lx" msgstr "" -#: readelf.c:5515 +#: readelf.c:5882 #, c-format msgid "Unknown FORM value: %lx" msgstr "" -#: readelf.c:5697 +#: readelf.c:6064 msgid " Number TAG\n" msgstr "" -#: readelf.c:5703 +#: readelf.c:6070 #, c-format msgid " %ld %s [%s]\n" msgstr "" -#: readelf.c:5706 +#: readelf.c:6073 msgid "has children" msgstr "" -#: readelf.c:5706 +#: readelf.c:6073 msgid "no children" msgstr "" -#: readelf.c:5710 +#: readelf.c:6077 #, c-format msgid " %-18s %s\n" msgstr "" -#: readelf.c:5729 +#: readelf.c:6096 #, c-format msgid " %lu byte block: " msgstr "" -#: readelf.c:6036 +#: readelf.c:6403 msgid "(User defined location op)" msgstr "" -#: readelf.c:6038 +#: readelf.c:6405 msgid "(Unknown location op)" msgstr "" -#: readelf.c:6165 +#: readelf.c:6532 #, c-format msgid "Unable to handle FORM: %d" msgstr "" -#: readelf.c:6169 +#: readelf.c:6536 #, c-format msgid "Unrecognised form: %d" msgstr "" -#: readelf.c:6182 +#: readelf.c:6549 msgid "(not inlined)" msgstr "" -#: readelf.c:6183 +#: readelf.c:6550 msgid "(inlined)" msgstr "" -#: readelf.c:6184 +#: readelf.c:6551 msgid "(declared as inline but ignored)" msgstr "" -#: readelf.c:6185 +#: readelf.c:6552 msgid "(declared as inline and inlined)" msgstr "" -#: readelf.c:6186 +#: readelf.c:6553 #, c-format msgid " (Unknown inline attribute value: %lx)" msgstr "" -#: readelf.c:6315 readelf.c:6441 +#: readelf.c:6682 readelf.c:6808 #, c-format msgid "" "The section %s contains:\n" "\n" msgstr "" -#: readelf.c:6337 +#: readelf.c:6704 #, c-format msgid " Compilation Unit @ %lx:\n" msgstr "" -#: readelf.c:6338 +#: readelf.c:6705 #, c-format msgid " Length: %ld\n" msgstr "" -#: readelf.c:6339 +#: readelf.c:6706 #, c-format msgid " Version: %d\n" msgstr "" -#: readelf.c:6340 +#: readelf.c:6707 #, c-format msgid " Abbrev Offset: %ld\n" msgstr "" -#: readelf.c:6341 +#: readelf.c:6708 #, c-format msgid " Pointer Size: %d\n" msgstr "" -#: readelf.c:6345 +#: readelf.c:6712 msgid "Only version 2 DWARF debug information is currently supported.\n" msgstr "" -#: readelf.c:6367 +#: readelf.c:6734 msgid "Unable to locate .debug_abbrev section!\n" msgstr "" -#: readelf.c:6407 +#: readelf.c:6774 #, c-format msgid "Unable to locate entry %lu in the abbreviation table\n" msgstr "" -#: readelf.c:6412 +#: readelf.c:6779 #, c-format msgid " <%d><%x>: Abbrev Number: %lu (%s)\n" msgstr "" -#: readelf.c:6462 +#: readelf.c:6829 msgid "Only DWARF 2 aranges are currently supported.\n" msgstr "" -#: readelf.c:6466 +#: readelf.c:6833 #, c-format msgid " Length: %ld\n" msgstr "" -#: readelf.c:6467 +#: readelf.c:6834 #, c-format msgid " Version: %d\n" msgstr "" -#: readelf.c:6468 +#: readelf.c:6835 #, c-format msgid " Offset into .debug_info: %lx\n" msgstr "" -#: readelf.c:6469 +#: readelf.c:6836 #, c-format msgid " Pointer Size: %d\n" msgstr "" -#: readelf.c:6470 +#: readelf.c:6837 #, c-format msgid " Segment Size: %d\n" msgstr "" -#: readelf.c:6472 +#: readelf.c:6839 msgid "" "\n" " Address Length\n" msgstr "" -#: readelf.c:6634 +#: readelf.c:7001 #, c-format msgid "The section %s contains:\n" msgstr "" -#: readelf.c:7109 +#: readelf.c:7476 #, c-format msgid "Displaying the debug contents of section %s is not yet supported.\n" msgstr "" -#: readelf.c:7173 +#: readelf.c:7540 #, c-format msgid "" "\n" "Section '%s' has no debugging data.\n" msgstr "" -#: readelf.c:7192 +#: readelf.c:7559 #, c-format msgid "Unrecognised debug section: %s\n" msgstr "" -#: readelf.c:7264 +#: readelf.c:7631 msgid "Some sections were not dumped because they do not exist!\n" msgstr "" -#: readelf.c:7447 +#: readelf.c:7814 #, c-format msgid "" "\n" "Section '%s' contains %d entries:\n" msgstr "" -#: readelf.c:7609 +#: readelf.c:7976 msgid "conflict list with without table" msgstr "" -#: readelf.c:7637 +#: readelf.c:8004 #, c-format msgid "" "\n" "Section '.conflict' contains %d entries:\n" msgstr "" -#: readelf.c:7638 +#: readelf.c:8005 msgid " Num: Index Value Name" msgstr "" -#: readelf.c:7663 +#: readelf.c:8030 msgid "NT_PRSTATUS (prstatus structure)" msgstr "" -#: readelf.c:7664 +#: readelf.c:8031 msgid "NT_FPREGSET (floating point registers)" msgstr "" -#: readelf.c:7665 +#: readelf.c:8032 msgid "NT_PRPSINFO (prpsinfo structure)" msgstr "" -#: readelf.c:7666 +#: readelf.c:8033 msgid "NT_TASKSTRUCT (task structure)" msgstr "" -#: readelf.c:7667 +#: readelf.c:8034 msgid "NT_PRXFPREG (user_xfpregs structure)" msgstr "" -#: readelf.c:7668 +#: readelf.c:8035 msgid "NT_PSTATUS (pstatus structure)" msgstr "" -#: readelf.c:7669 +#: readelf.c:8036 msgid "NT_FPREGS (floating point registers)" msgstr "" -#: readelf.c:7670 +#: readelf.c:8037 msgid "NT_PSINFO (psinfo structure)" msgstr "" -#: readelf.c:7671 +#: readelf.c:8038 msgid "NT_LWPSTATUS (lwpstatus_t structure)" msgstr "" -#: readelf.c:7672 +#: readelf.c:8039 msgid "NT_LWPSINFO (lwpsinfo_t structure)" msgstr "" -#: readelf.c:7673 +#: readelf.c:8040 msgid "NT_WIN32PSTATUS (win32_pstatus strcuture)" msgstr "" -#: readelf.c:7675 +#: readelf.c:8042 #, c-format msgid "Unknown note type: (0x%08x)" msgstr "" -#: readelf.c:7713 +#: readelf.c:8080 #, c-format msgid "" "\n" "Notes at offset 0x%08lx with length 0x%08lx:\n" msgstr "" -#: readelf.c:7715 +#: readelf.c:8082 msgid " Owner\t\tData size\tDescription\n" msgstr "" -#: readelf.c:7826 +#: readelf.c:8193 msgid "No note segments present in the core file.\n" msgstr "" -#: readelf.c:7904 +#: readelf.c:8271 msgid "This instance of readelf has been built without support for a\n" msgstr "" -#: readelf.c:7905 +#: readelf.c:8272 msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" msgstr "" -#: readelf.c:7940 +#: readelf.c:8307 #, c-format msgid "Cannot stat input file %s.\n" msgstr "" -#: readelf.c:7947 +#: readelf.c:8314 #, c-format msgid "Input file %s not found.\n" msgstr "" -#: readelf.c:7953 +#: readelf.c:8320 #, c-format msgid "%s: Failed to read file header\n" msgstr "" -#: readelf.c:7967 +#: readelf.c:8334 #, c-format msgid "" "\n" @@ -3907,98 +3937,98 @@ msgstr "" msgid "unable to open output file %s" msgstr "" -#: stabs.c:349 stabs.c:1770 +#: stabs.c:343 stabs.c:1760 msgid "numeric overflow" msgstr "" -#: stabs.c:360 +#: stabs.c:354 #, c-format msgid "Bad stab: %s\n" msgstr "" -#: stabs.c:370 +#: stabs.c:364 #, c-format msgid "Warning: %s: %s\n" msgstr "" -#: stabs.c:492 +#: stabs.c:486 msgid "N_LBRAC not within function\n" msgstr "" -#: stabs.c:531 +#: stabs.c:525 msgid "Too many N_RBRACs\n" msgstr "" -#: stabs.c:780 +#: stabs.c:770 msgid "unknown C++ encoded name" msgstr "" #. Complain and keep going, so compilers can invent new #. cross-reference types. -#: stabs.c:1307 +#: stabs.c:1297 msgid "unrecognized cross reference type" msgstr "" #. Does this actually ever happen? Is that why we are worrying #. about dealing with it rather than just calling error_type? -#: stabs.c:1862 +#: stabs.c:1852 msgid "missing index type" msgstr "" -#: stabs.c:2189 +#: stabs.c:2179 msgid "unknown virtual character for baseclass" msgstr "" -#: stabs.c:2207 +#: stabs.c:2197 msgid "unknown visibility character for baseclass" msgstr "" -#: stabs.c:2399 +#: stabs.c:2389 msgid "unnamed $vb type" msgstr "" -#: stabs.c:2405 +#: stabs.c:2395 msgid "unrecognized C++ abbreviation" msgstr "" -#: stabs.c:2485 +#: stabs.c:2475 msgid "unknown visibility character for field" msgstr "" -#: stabs.c:2741 +#: stabs.c:2731 msgid "const/volatile indicator missing" msgstr "" -#: stabs.c:2981 +#: stabs.c:2971 #, c-format msgid "No mangling for \"%s\"\n" msgstr "" -#: stabs.c:3294 +#: stabs.c:3284 msgid "Undefined N_EXCL" msgstr "" -#: stabs.c:3382 +#: stabs.c:3372 #, c-format msgid "Type file number %d out of range\n" msgstr "" -#: stabs.c:3387 +#: stabs.c:3377 #, c-format msgid "Type index number %d out of range\n" msgstr "" -#: stabs.c:3474 +#: stabs.c:3464 #, c-format msgid "Unrecognized XCOFF type %d\n" msgstr "" -#: stabs.c:3773 +#: stabs.c:3763 #, c-format msgid "bad mangled name `%s'\n" msgstr "" -#: stabs.c:3869 +#: stabs.c:3859 msgid "no argument types in mangled string\n" msgstr "" @@ -4031,7 +4061,7 @@ msgid "cannot open input file %s" msgstr "" #: version.c:39 -msgid "Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.\n" +msgid "Copyright 1997, 98, 99, 2000, 2001 Free Software Foundation, Inc.\n" msgstr "" #: version.c:40 diff --git a/binutils/readelf.c b/binutils/readelf.c index d5069251be1..cb346f67d54 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -104,6 +104,7 @@ int do_syms; int do_reloc; int do_sections; int do_segments; +int do_unwind; int do_using_dynamic; int do_header; int do_dump; @@ -150,6 +151,8 @@ static const char * get_mips_dynamic_type PARAMS ((unsigned long)); static const char * get_sparc64_dynamic_type PARAMS ((unsigned long)); static const char * get_parisc_dynamic_type PARAMS ((unsigned long)); static const char * get_dynamic_type PARAMS ((unsigned long)); +static int slurp_rela_relocs PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Rela **, unsigned long *)); +static int slurp_rel_relocs PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Rel **, unsigned long *)); static int dump_relocations PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Sym *, unsigned long, char *, int)); static char * get_file_type PARAMS ((unsigned)); static char * get_machine_name PARAMS ((unsigned)); @@ -157,9 +160,11 @@ static void decode_ARM_machine_flags PARAMS ((unsigned, char [])); static char * get_machine_flags PARAMS ((unsigned, unsigned)); static const char * get_mips_segment_type PARAMS ((unsigned long)); static const char * get_parisc_segment_type PARAMS ((unsigned long)); +static const char * get_ia64_segment_type PARAMS ((unsigned long)); static const char * get_segment_type PARAMS ((unsigned long)); static const char * get_mips_section_type_name PARAMS ((unsigned int)); static const char * get_parisc_section_type_name PARAMS ((unsigned int)); +static const char * get_ia64_section_type_name PARAMS ((unsigned int)); static const char * get_section_type_name PARAMS ((unsigned int)); static const char * get_symbol_binding PARAMS ((unsigned int)); static const char * get_symbol_type PARAMS ((unsigned int)); @@ -171,6 +176,7 @@ static void parse_args PARAMS ((int, char **)); static int process_file_header PARAMS ((void)); static int process_program_headers PARAMS ((FILE *)); static int process_section_headers PARAMS ((FILE *)); +static int process_unwind PARAMS ((FILE *)); static void dynamic_segment_mips_val PARAMS ((Elf_Internal_Dyn *)); static void dynamic_segment_parisc_val PARAMS ((Elf_Internal_Dyn *)); static int process_dynamic_segment PARAMS ((FILE *)); @@ -187,6 +193,7 @@ static int get_64bit_program_headers PARAMS ((FILE *, Elf_Internal_Phdr *)) static int get_file_header PARAMS ((FILE *)); static Elf_Internal_Sym * get_32bit_elf_symbols PARAMS ((FILE *, unsigned long, unsigned long)); static Elf_Internal_Sym * get_64bit_elf_symbols PARAMS ((FILE *, unsigned long, unsigned long)); +static const char * get_elf_section_flags PARAMS ((bfd_vma)); static int * get_dynamic_data PARAMS ((FILE *, unsigned int)); static int get_32bit_dynamic_segment PARAMS ((FILE *)); static int get_64bit_dynamic_segment PARAMS ((FILE *)); @@ -244,7 +251,7 @@ typedef int Elf32_Word; /* If we can support a 64 bit data type then BFD64 should be defined and sizeof (bfd_vma) == 8. In this case when translating from an external 8 byte field to an internal field, we can assume that the - internal field is also 8 bytes wide and so we can extact all the data. + internal field is also 8 bytes wide and so we can extract all the data. If, however, BFD64 is not defined, then we must assume that the internal data structure only has 4 byte wide fields that are the equivalent of the 8 byte wide external counterparts, and so we must @@ -602,144 +609,172 @@ guess_is_rela (e_machine) } } -/* Display the contents of the relocation data found at the specified offset. */ static int -dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela) - FILE * file; - unsigned long rel_offset; - unsigned long rel_size; - Elf_Internal_Sym * symtab; - unsigned long nsyms; - char * strtab; - int is_rela; +slurp_rela_relocs (file, rel_offset, rel_size, relasp, nrelasp) + FILE *file; + unsigned long rel_offset; + unsigned long rel_size; + Elf_Internal_Rela **relasp; + unsigned long *nrelasp; { - unsigned int i; - Elf_Internal_Rel * rels; - Elf_Internal_Rela * relas; + Elf_Internal_Rela *relas; + unsigned long nrelas; + unsigned int i; + if (is_32bit_elf) + { + Elf32_External_Rela * erelas; - if (is_rela == UNKNOWN) - is_rela = guess_is_rela (elf_header.e_machine); + GET_DATA_ALLOC (rel_offset, rel_size, erelas, + Elf32_External_Rela *, "relocs"); - if (is_rela) - { - if (is_32bit_elf) - { - Elf32_External_Rela * erelas; + nrelas = rel_size / sizeof (Elf32_External_Rela); - GET_DATA_ALLOC (rel_offset, rel_size, erelas, - Elf32_External_Rela *, "relocs"); + relas = (Elf_Internal_Rela *) + malloc (nrelas * sizeof (Elf_Internal_Rela)); - rel_size = rel_size / sizeof (Elf32_External_Rela); + if (relas == NULL) + { + error(_("out of memory parsing relocs")); + return 0; + } - relas = (Elf_Internal_Rela *) - malloc (rel_size * sizeof (Elf_Internal_Rela)); + for (i = 0; i < nrelas; i++) + { + relas[i].r_offset = BYTE_GET (erelas[i].r_offset); + relas[i].r_info = BYTE_GET (erelas[i].r_info); + relas[i].r_addend = BYTE_GET (erelas[i].r_addend); + } - if (relas == NULL) - { - error(_("out of memory parsing relocs")); - return 0; - } + free (erelas); + } + else + { + Elf64_External_Rela * erelas; - for (i = 0; i < rel_size; i++) - { - relas[i].r_offset = BYTE_GET (erelas[i].r_offset); - relas[i].r_info = BYTE_GET (erelas[i].r_info); - relas[i].r_addend = BYTE_GET (erelas[i].r_addend); - } + GET_DATA_ALLOC (rel_offset, rel_size, erelas, + Elf64_External_Rela *, "relocs"); + + nrelas = rel_size / sizeof (Elf64_External_Rela); - free (erelas); + relas = (Elf_Internal_Rela *) + malloc (nrelas * sizeof (Elf_Internal_Rela)); - rels = (Elf_Internal_Rel *) relas; + if (relas == NULL) + { + error(_("out of memory parsing relocs")); + return 0; } - else + + for (i = 0; i < nrelas; i++) { - Elf64_External_Rela * erelas; + relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset); + relas[i].r_info = BYTE_GET8 (erelas[i].r_info); + relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend); + } - GET_DATA_ALLOC (rel_offset, rel_size, erelas, - Elf64_External_Rela *, "relocs"); + free (erelas); + } + *relasp = relas; + *nrelasp = nrelas; + return 1; +} - rel_size = rel_size / sizeof (Elf64_External_Rela); +static int +slurp_rel_relocs (file, rel_offset, rel_size, relsp, nrelsp) + FILE *file; + unsigned long rel_offset; + unsigned long rel_size; + Elf_Internal_Rel **relsp; + unsigned long *nrelsp; +{ + Elf_Internal_Rel *rels; + unsigned long nrels; + unsigned int i; - relas = (Elf_Internal_Rela *) - malloc (rel_size * sizeof (Elf_Internal_Rela)); + if (is_32bit_elf) + { + Elf32_External_Rel * erels; - if (relas == NULL) - { - error(_("out of memory parsing relocs")); - return 0; - } + GET_DATA_ALLOC (rel_offset, rel_size, erels, + Elf32_External_Rel *, "relocs"); - for (i = 0; i < rel_size; i++) - { - relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset); - relas[i].r_info = BYTE_GET8 (erelas[i].r_info); - relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend); - } + nrels = rel_size / sizeof (Elf32_External_Rel); - free (erelas); + rels = (Elf_Internal_Rel *) malloc (nrels * sizeof (Elf_Internal_Rel)); - rels = (Elf_Internal_Rel *) relas; + if (rels == NULL) + { + error(_("out of memory parsing relocs")); + return 0; + } + + for (i = 0; i < nrels; i++) + { + rels[i].r_offset = BYTE_GET (erels[i].r_offset); + rels[i].r_info = BYTE_GET (erels[i].r_info); } + + free (erels); } else { - if (is_32bit_elf) - { - Elf32_External_Rel * erels; + Elf64_External_Rel * erels; - GET_DATA_ALLOC (rel_offset, rel_size, erels, - Elf32_External_Rel *, "relocs"); + GET_DATA_ALLOC (rel_offset, rel_size, erels, + Elf64_External_Rel *, "relocs"); - rel_size = rel_size / sizeof (Elf32_External_Rel); + nrels = rel_size / sizeof (Elf64_External_Rel); - rels = (Elf_Internal_Rel *) - malloc (rel_size * sizeof (Elf_Internal_Rel)); + rels = (Elf_Internal_Rel *) malloc (nrels * sizeof (Elf_Internal_Rel)); - if (rels == NULL) - { - error(_("out of memory parsing relocs")); - return 0; - } - - for (i = 0; i < rel_size; i++) - { - rels[i].r_offset = BYTE_GET (erels[i].r_offset); - rels[i].r_info = BYTE_GET (erels[i].r_info); - } - - free (erels); - - relas = (Elf_Internal_Rela *) rels; - } - else + if (rels == NULL) { - Elf64_External_Rel * erels; - - GET_DATA_ALLOC (rel_offset, rel_size, erels, - Elf64_External_Rel *, "relocs"); + error(_("out of memory parsing relocs")); + return 0; + } - rel_size = rel_size / sizeof (Elf64_External_Rel); + for (i = 0; i < nrels; i++) + { + rels[i].r_offset = BYTE_GET8 (erels[i].r_offset); + rels[i].r_info = BYTE_GET8 (erels[i].r_info); + } - rels = (Elf_Internal_Rel *) - malloc (rel_size * sizeof (Elf_Internal_Rel)); + free (erels); + } + *relsp = rels; + *nrelsp = nrels; + return 1; +} - if (rels == NULL) - { - error(_("out of memory parsing relocs")); - return 0; - } +/* Display the contents of the relocation data found at the specified offset. */ +static int +dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela) + FILE * file; + unsigned long rel_offset; + unsigned long rel_size; + Elf_Internal_Sym * symtab; + unsigned long nsyms; + char * strtab; + int is_rela; +{ + unsigned int i; + Elf_Internal_Rel * rels; + Elf_Internal_Rela * relas; - for (i = 0; i < rel_size; i++) - { - rels[i].r_offset = BYTE_GET8 (erels[i].r_offset); - rels[i].r_info = BYTE_GET8 (erels[i].r_info); - } - free (erels); + if (is_rela == UNKNOWN) + is_rela = guess_is_rela (elf_header.e_machine); - relas = (Elf_Internal_Rela *) rels; - } + if (is_rela) + { + if (!slurp_rela_relocs (file, rel_offset, rel_size, &relas, &rel_size)) + return 0; + } + else + { + if (!slurp_rel_relocs (file, rel_offset, rel_size, &rels, &rel_size)) + return 0; } if (is_rela) @@ -1565,6 +1600,21 @@ get_machine_flags (e_flags, e_machine) if ((e_flags & EF_PICOJAVA_GNUCALLS) == EF_PICOJAVA_GNUCALLS) strcat (buf, ", gnu calling convention"); break; + + case EM_IA_64: + if ((e_flags & EF_IA_64_ABI64)) + strcat (buf, ", 64-bit"); + else + strcat (buf, ", 32-bit"); + if ((e_flags & EF_IA_64_REDUCEDFP)) + strcat (buf, ", reduced fp model"); + if ((e_flags & EF_IA_64_NOFUNCDESC_CONS_GP)) + strcat (buf, ", no function descriptors, constant gp"); + else if ((e_flags & EF_IA_64_CONS_GP)) + strcat (buf, ", constant gp"); + if ((e_flags & EF_IA_64_ABSOLUTE)) + strcat (buf, ", absolute"); + break; } } @@ -1617,6 +1667,21 @@ get_parisc_segment_type (type) return NULL; } +static const char * +get_ia64_segment_type (type) + unsigned long type; +{ + switch (type) + { + case PT_IA_64_ARCHEXT: return "IA_64_ARCHEXT"; + case PT_IA_64_UNWIND: return "IA_64_UNWIND"; + default: + break; + } + + return NULL; +} + static const char * get_segment_type (p_type) unsigned long p_type; @@ -1647,6 +1712,9 @@ get_segment_type (p_type) case EM_PARISC: result = get_parisc_segment_type (p_type); break; + case EM_IA_64: + result = get_ia64_segment_type (p_type); + break; default: result = NULL; break; @@ -1749,6 +1817,20 @@ get_parisc_section_type_name (sh_type) return NULL; } +static const char * +get_ia64_section_type_name (sh_type) + unsigned int sh_type; +{ + switch (sh_type) + { + case SHT_IA_64_EXT: return "IA_64_EXT"; + case SHT_IA_64_UNWIND: return "IA_64_UNWIND"; + default: + break; + } + return NULL; +} + static const char * get_section_type_name (sh_type) unsigned int sh_type; @@ -1796,6 +1878,9 @@ get_section_type_name (sh_type) case EM_PARISC: result = get_parisc_section_type_name (sh_type); break; + case EM_IA_64: + result = get_ia64_section_type_name (sh_type); + break; default: result = NULL; break; @@ -1837,6 +1922,7 @@ struct option options [] = {"use-dynamic", no_argument, 0, 'D'}, {"hex-dump", required_argument, 0, 'x'}, {"debug-dump", optional_argument, 0, 'w'}, + {"unwind", no_argument, 0, 'u'}, #ifdef SUPPORT_DISASSEMBLY {"instruction-dump", required_argument, 0, 'i'}, #endif @@ -1861,6 +1947,7 @@ usage () fprintf (stdout, _(" -s or --syms or --symbols Display the symbol table\n")); fprintf (stdout, _(" -n or --notes Display the core notes (if present)\n")); fprintf (stdout, _(" -r or --relocs Display the relocations (if present)\n")); + fprintf (stdout, _(" -u or --unwind Display the unwind info (if present)\n")); fprintf (stdout, _(" -d or --dynamic Display the dynamic segment (if present)\n")); fprintf (stdout, _(" -V or --version-info Display the version sections (if present)\n")); fprintf (stdout, _(" -A or --arch-specific Display architecture specific information (if any).\n")); @@ -1923,7 +2010,7 @@ parse_args (argc, argv) usage (); while ((c = getopt_long - (argc, argv, "ersahnldSDAIw::x:i:vV", options, NULL)) != EOF) + (argc, argv, "ersuahnldSDAIw::x:i:vV", options, NULL)) != EOF) { char * cp; int section; @@ -1940,6 +2027,7 @@ parse_args (argc, argv) case 'a': do_syms ++; do_reloc ++; + do_unwind ++; do_dynamic ++; do_header ++; do_sections ++; @@ -1963,6 +2051,9 @@ parse_args (argc, argv) case 'r': do_reloc ++; break; + case 'u': + do_unwind ++; + break; case 'h': do_header ++; break; @@ -2065,7 +2156,7 @@ parse_args (argc, argv) } } - if (!do_dynamic && !do_syms && !do_reloc && !do_sections + if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections && !do_segments && !do_header && !do_dump && !do_version && !do_histogram && !do_debugging && !do_arch && !do_notes) usage (); @@ -2976,6 +3067,366 @@ process_relocs (file) return 1; } +#include "unwind-ia64.h" + +/* An absolute address consists of a section and an offset. If the + section is NULL, the offset itself is the address, otherwise, the + address equals to LOAD_ADDRESS(section) + offset. */ + +struct absaddr + { + unsigned short section; + bfd_vma offset; + }; + +struct unw_aux_info + { + struct unw_table_entry + { + struct absaddr start; + struct absaddr end; + struct absaddr info; + } + *table; /* Unwind table. */ + unsigned long table_len; /* Length of unwind table. */ + const unsigned char * info; /* Unwind info. */ + unsigned long info_size; /* Size of unwind info. */ + bfd_vma info_addr; /* starting address of unwind info. */ + bfd_vma seg_base; /* Starting address of segment. */ + Elf_Internal_Sym * symtab; /* The symbol table. */ + unsigned long nsyms; /* Number of symbols. */ + const char * strtab; /* The string table. */ + unsigned long strtab_size; /* Size of string table. */ + }; + +static void find_symbol_for_address PARAMS ((struct unw_aux_info *, + struct absaddr, const char **, + bfd_vma *)); +static void dump_ia64_unwind PARAMS ((struct unw_aux_info *)); +static int slurp_ia64_unwind_table PARAMS ((FILE *file, struct unw_aux_info *, + Elf32_Internal_Shdr *)); + +static void +find_symbol_for_address (aux, addr, symname, offset) + struct unw_aux_info *aux; + struct absaddr addr; + const char **symname; + bfd_vma *offset; +{ + bfd_vma dist = (bfd_vma) 0x100000; + Elf_Internal_Sym *sym, *best = NULL; + unsigned long i; + + for (i = 0, sym = aux->symtab; i < aux->nsyms; ++i, ++sym) + { + if (ELF_ST_TYPE (sym->st_info) == STT_FUNC + && sym->st_name != 0 + && (addr.section == SHN_UNDEF || addr.section == sym->st_shndx) + && addr.offset >= sym->st_value + && addr.offset - sym->st_value < dist) + { + best = sym; + dist = addr.offset - sym->st_value; + if (!dist) + break; + } + } + if (best) + { + *symname = (best->st_name >= aux->strtab_size + ? "" : aux->strtab + best->st_name); + *offset = dist; + return; + } + *symname = NULL; + *offset = addr.offset; +} + +static void +dump_ia64_unwind (aux) + struct unw_aux_info *aux; +{ + bfd_vma addr_size; + struct unw_table_entry * tp; + int in_body; + + addr_size = is_32bit_elf ? 4 : 8; + + for (tp = aux->table; tp < aux->table + aux->table_len; ++tp) + { + bfd_vma stamp; + bfd_vma offset; + const unsigned char * dp; + const unsigned char * head; + const char * procname; + + find_symbol_for_address (aux, tp->start, &procname, &offset); + + fputs ("\n<", stdout); + + if (procname) + { + fputs (procname, stdout); + + if (offset) + printf ("+%lx", (unsigned long) offset); + } + + fputs (">: [", stdout); + print_vma (tp->start.offset, PREFIX_HEX); + fputc ('-', stdout); + print_vma (tp->end.offset, PREFIX_HEX); + printf ("), info at +0x%lx\n", + (unsigned long) (tp->info.offset - aux->seg_base)); + + head = aux->info + (tp->info.offset - aux->info_addr); + stamp = BYTE_GET8 ((unsigned char *) head); + + printf (" v%u, flags=0x%lx (%s%s ), len=%lu bytes\n", + (unsigned) UNW_VER (stamp), + (unsigned long) ((stamp & UNW_FLAG_MASK) >> 32), + UNW_FLAG_EHANDLER (stamp) ? " ehandler" : "", + UNW_FLAG_UHANDLER (stamp) ? " uhandler" : "", + (unsigned long) (addr_size * UNW_LENGTH (stamp))); + + if (UNW_VER (stamp) != 1) + { + printf ("\tUnknown version.\n"); + continue; + } + + in_body = 0; + for (dp = head + 8; dp < head + 8 + addr_size * UNW_LENGTH (stamp);) + dp = unw_decode (dp, in_body, & in_body); + } +} + +static int +slurp_ia64_unwind_table (file, aux, sec) + FILE *file; + struct unw_aux_info *aux; + Elf32_Internal_Shdr *sec; +{ + unsigned long size, addr_size, nrelas, i; + Elf_Internal_Phdr *prog_hdrs, *seg; + struct unw_table_entry *tep; + Elf32_Internal_Shdr *relsec; + Elf_Internal_Rela *rela, *rp; + unsigned char *table, *tp; + Elf_Internal_Sym *sym; + const char *relname; + int result; + + addr_size = is_32bit_elf ? 4 : 8; + + /* First, find the starting address of the segment that includes + this section: */ + + if (elf_header.e_phnum) + { + prog_hdrs = (Elf_Internal_Phdr *) + xmalloc (elf_header.e_phnum * sizeof (Elf_Internal_Phdr)); + + if (is_32bit_elf) + result = get_32bit_program_headers (file, prog_hdrs); + else + result = get_64bit_program_headers (file, prog_hdrs); + + if (!result) + { + free (prog_hdrs); + return 0; + } + + for (seg = prog_hdrs; seg < prog_hdrs + elf_header.e_phnum; ++seg) + { + if (seg->p_type != PT_LOAD) + continue; + + if (sec->sh_addr >= seg->p_vaddr + && (sec->sh_addr + sec->sh_size <= seg->p_vaddr + seg->p_memsz)) + { + aux->seg_base = seg->p_vaddr; + break; + } + } + + free (prog_hdrs); + } + + /* Second, build the unwind table from the contents of the unwind section: */ + size = sec->sh_size; + GET_DATA_ALLOC (sec->sh_offset, size, table, char *, "unwind table"); + + tep = aux->table = xmalloc (size / (3 * addr_size) * sizeof (aux->table[0])); + for (tp = table; tp < table + size; tp += 3 * addr_size, ++ tep) + { + tep->start.section = SHN_UNDEF; + tep->end.section = SHN_UNDEF; + tep->info.section = SHN_UNDEF; + if (is_32bit_elf) + { + tep->start.offset = byte_get ((unsigned char *) tp + 0, 4); + tep->end.offset = byte_get ((unsigned char *) tp + 4, 4); + tep->info.offset = byte_get ((unsigned char *) tp + 8, 4); + } + else + { + tep->start.offset = BYTE_GET8 ((unsigned char *) tp + 0); + tep->end.offset = BYTE_GET8 ((unsigned char *) tp + 8); + tep->info.offset = BYTE_GET8 ((unsigned char *) tp + 16); + } + tep->start.offset += aux->seg_base; + tep->end.offset += aux->seg_base; + tep->info.offset += aux->seg_base; + } + free (table); + + /* Third, apply any relocations to the unwind table: */ + + for (relsec = section_headers; + relsec < section_headers + elf_header.e_shnum; + ++relsec) + { + if (relsec->sh_type != SHT_RELA + || section_headers + relsec->sh_info != sec) + continue; + + if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, + & rela, & nrelas)) + return 0; + + for (rp = rela; rp < rela + nrelas; ++rp) + { + if (is_32bit_elf) + { + relname = elf_ia64_reloc_type (ELF32_R_TYPE (rp->r_info)); + sym = aux->symtab + ELF32_R_SYM (rp->r_info); + + if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION) + { + warn (_("Skipping unexpected symbol type %u"), + ELF32_ST_TYPE (sym->st_info)); + continue; + } + } + else + { + relname = elf_ia64_reloc_type (ELF64_R_TYPE (rp->r_info)); + sym = aux->symtab + ELF64_R_SYM (rp->r_info); + + if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION) + { + warn (_("Skipping unexpected symbol type %u"), + ELF64_ST_TYPE (sym->st_info)); + continue; + } + } + + if (strncmp (relname, "R_IA64_SEGREL", 13) != 0) + { + warn (_("Skipping unexpected relocation type %s"), relname); + continue; + } + + i = rp->r_offset / (3 * addr_size); + + switch (rp->r_offset/addr_size % 3) + { + case 0: + aux->table[i].start.section = sym->st_shndx; + aux->table[i].start.offset += rp->r_addend; + break; + case 1: + aux->table[i].end.section = sym->st_shndx; + aux->table[i].end.offset += rp->r_addend; + break; + case 2: + aux->table[i].info.section = sym->st_shndx; + aux->table[i].info.offset += rp->r_addend; + break; + default: + break; + } + } + + free (rela); + } + + aux->table_len = size / (3 * addr_size); + return 1; +} + +static int +process_unwind (file) + FILE * file; +{ + Elf32_Internal_Shdr *sec, *unwsec = NULL, *strsec; + unsigned long i, addr_size; + struct unw_aux_info aux; + + memset (& aux, 0, sizeof (aux)); + + addr_size = is_32bit_elf ? 4 : 8; + + if (!do_unwind) + return 1; + + for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) + { + if (sec->sh_type == SHT_SYMTAB) + { + aux.nsyms = sec->sh_size / sec->sh_entsize; + aux.symtab = GET_ELF_SYMBOLS (file, sec->sh_offset, aux.nsyms); + + strsec = section_headers + sec->sh_link; + aux.strtab_size = strsec->sh_size; + GET_DATA_ALLOC (strsec->sh_offset, aux.strtab_size, + (char *) aux.strtab, char *, "string table"); + } + else if (sec->sh_type == SHT_IA_64_UNWIND) + unwsec = sec; + else if (strcmp (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info) == 0) + { + aux.info_size = sec->sh_size; + aux.info_addr = sec->sh_addr; + GET_DATA_ALLOC (sec->sh_offset, aux.info_size, (char *) aux.info, + char *, "unwind info"); + } + } + + if (unwsec) + { + printf (_("\nUnwind section ")); + + if (string_table == NULL) + printf ("%d", unwsec->sh_name); + else + printf ("'%s'", SECTION_NAME (unwsec)); + + printf (_(" at offset 0x%lx contains %lu entries:\n"), + unwsec->sh_offset, unwsec->sh_size / (3 * addr_size)); + + (void) slurp_ia64_unwind_table (file, & aux, unwsec); + + if (aux.table_len > 0) + dump_ia64_unwind (& aux); + } + else + printf (_("\nThere are no unwind sections in this file.\n")); + + if (aux.table) + free ((char *) aux.table); + if (aux.info) + free ((char *) aux.info); + if (aux.symtab) + free (aux.symtab); + if (aux.strtab) + free ((char *) aux.strtab); + + return 1; +} + static void dynamic_segment_mips_val (entry) @@ -7896,6 +8347,8 @@ process_file (file_name) process_relocs (file); + process_unwind (file); + process_symbol_table (file); process_syminfo (file); diff --git a/binutils/unwind-ia64.c b/binutils/unwind-ia64.c new file mode 100644 index 00000000000..f29afe29527 --- /dev/null +++ b/binutils/unwind-ia64.c @@ -0,0 +1,1111 @@ +/* unwind-ia64.c -- utility routines to dump IA-64 unwind info for readelf. + Copyright (c) 2000, 2001 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang + +This file is part of GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "unwind-ia64.h" +#include +#include + +#if __GNUC__ >= 2 +/* Define BFD64 here, even if our default architecture is 32 bit ELF + as this will allow us to read in and parse 64bit and 32bit ELF files. + Only do this if we belive that the compiler can support a 64 bit + data type. For now we only rely on GCC being able to do this. */ +#define BFD64 +#endif +#include "bfd.h" + +static bfd_vma unw_rlen = 0; + +static void +unw_print_brmask (cp, mask) + char * cp; + unsigned char mask; +{ + char *sep = ""; + int i; + + for (i = 0; mask && (i < 5); ++i) + { + if (mask & 1) + { + cp += sprintf (cp, "%sb%u", sep, i + 1); + sep = ","; + } + mask >>= 1; + } + *cp = '\0'; +} + +static void +unw_print_grmask (cp, mask) + char * cp; + unsigned char mask; +{ + char *sep = ""; + int i; + + *cp = '\0'; + for (i = 0; i < 4; ++i) + { + if (mask & 1) + { + cp += sprintf (cp, "%sr%u", sep, i + 4); + sep = ","; + } + mask >>= 1; + } +} + +static void +unw_print_frmask (cp, mask) + char * cp; + unsigned long mask; +{ + char *sep = ""; + int i; + + *cp = '\0'; + for (i = 0; i < 20; ++i) + { + if (mask & 1) + { + cp += sprintf (cp, "%sf%u", sep, (i < 4) ? (i + 2) : (i + 12)); + sep = ","; + } + mask >>= 1; + } +} + +static void +unw_print_abreg (cp, abreg) + char * cp; + unsigned char abreg; +{ + static const char *special_reg[16] = + { + "pr", "psp", "@priunat", "rp", "ar.bsp", "ar.bspstore", "ar.rnat", + "ar.unat", "ar.fpsr", "ar.pfs", "ar.lc", + "Unknown11", "Unknown12", "Unknown13", "Unknown14", "Unknown15" + }; + + switch ((abreg >> 5) & 0x3) + { + case 0: /* gr */ + sprintf (cp, "r%u", (abreg & 0x1f)); + break; + + case 1: /* fr */ + sprintf (cp, "f%u", (abreg & 0x1f)); + break; + + case 2: /* br */ + sprintf (cp, "b%u", (abreg & 0x1f)); + break; + + case 3: /* special */ + strcpy (cp, special_reg[abreg & 0xf]); + break; + } +} + +static void +unw_print_xyreg (cp, x, ytreg) + char * cp; + unsigned char x; + unsigned char ytreg; +{ + switch ((x << 1) | ((ytreg >> 7) & 1)) + { + case 0: /* gr */ + sprintf (cp, "r%u", (ytreg & 0x1f)); + break; + + case 1: /* fr */ + sprintf (cp, "f%u", (ytreg & 0x1f)); + break; + + case 2: /* br */ + sprintf (cp, "b%u", (ytreg & 0x1f)); + break; + } +} + +#define UNW_REG_BSP "bsp" +#define UNW_REG_BSPSTORE "bspstore" +#define UNW_REG_FPSR "fpsr" +#define UNW_REG_LC "lc" +#define UNW_REG_PFS "pfs" +#define UNW_REG_PR "pr" +#define UNW_REG_PSP "psp" +#define UNW_REG_RNAT "rnat" +#define UNW_REG_RP "rp" +#define UNW_REG_UNAT "unat" + +typedef bfd_vma unw_word; + +#define STR(x) #x + +#define UNW_DEC_BAD_CODE(code) \ + printf ("Unknown code 0x%02x\n", code) + +#define UNW_DEC_PROLOGUE(fmt, body, rlen, arg) \ + do \ + { \ + unw_rlen = rlen; \ + *(int *)arg = body; \ + printf (" "STR(fmt)":%s(rlen=%lu)\n", \ + body ? "body" : "prologue", (unsigned long) rlen); \ + } \ + while (0) + +#define UNW_DEC_PROLOGUE_GR(fmt, rlen, mask, grsave, arg) \ + do \ + { \ + char regname[16], maskstr[64], *sep; \ + \ + unw_rlen = rlen; \ + *(int *)arg = 0; \ + \ + maskstr[0] = '\0'; \ + sep = ""; \ + if (mask & 0x8) \ + { \ + strcat (maskstr, "rp"); \ + sep = ","; \ + } \ + if (mask & 0x4) \ + { \ + strcat (maskstr, sep); \ + strcat (maskstr, "ar.pfs"); \ + sep = ","; \ + } \ + if (mask & 0x2) \ + { \ + strcat (maskstr, sep); \ + strcat (maskstr, "psp"); \ + sep = ","; \ + } \ + if (mask & 0x1) \ + { \ + strcat (maskstr, sep); \ + strcat (maskstr, "pr"); \ + } \ + sprintf (regname, "r%u", grsave); \ + printf (" "STR(fmt)":prologue_gr(mask=[%s],grsave=%s,rlen=%lu)\n", \ + maskstr, regname, (unsigned long) rlen); \ + } \ + while (0) + +#define UNW_DEC_FR_MEM(fmt, frmask, arg) \ + do \ + { \ + char frstr[200]; \ + \ + unw_print_frmask (frstr, frmask); \ + printf ("\t"STR(fmt)":fr_mem(frmask=[%s])\n", frstr); \ + } \ + while (0) + +#define UNW_DEC_GR_MEM(fmt, grmask, arg) \ + do \ + { \ + char grstr[200]; \ + \ + unw_print_grmask (grstr, grmask); \ + printf ("\t"STR(fmt)":gr_mem(grmask=[%s])\n", grstr); \ + } \ + while (0) + +#define UNW_DEC_FRGR_MEM(fmt, grmask, frmask, arg) \ + do \ + { \ + char frstr[200], grstr[20]; \ + \ + unw_print_grmask (grstr, grmask); \ + unw_print_frmask (frstr, frmask); \ + printf ("\t"STR(fmt)":frgr_mem(grmask=[%s],frmask=[%s])\n", grstr, frstr);\ + } \ + while (0) + +#define UNW_DEC_BR_MEM(fmt, brmask, arg) \ + do \ + { \ + char brstr[20]; \ + \ + unw_print_brmask (brstr, brmask); \ + printf ("\t"STR(fmt)":br_mem(brmask=[%s])\n", brstr); \ + } \ + while (0) + +#define UNW_DEC_BR_GR(fmt, brmask, gr, arg) \ + do \ + { \ + char brstr[20]; \ + \ + unw_print_brmask (brstr, brmask); \ + printf ("\t"STR(fmt)":br_gr(brmask=[%s],gr=r%u)\n", brstr, gr); \ + } \ + while (0) + +#define UNW_DEC_REG_GR(fmt, src, dst, arg) \ + printf ("\t"STR(fmt)":%s_gr(reg=r%u)\n", src, dst) + +#define UNW_DEC_RP_BR(fmt, dst, arg) \ + printf ("\t"STR(fmt)":rp_br(reg=b%u)\n", dst) + +#define UNW_DEC_REG_WHEN(fmt, reg, t, arg) \ + printf ("\t"STR(fmt)":%s_when(t=%lu)\n", reg, (unsigned long) t) + +#define UNW_DEC_REG_SPREL(fmt, reg, spoff, arg) \ + printf ("\t"STR(fmt)":%s_sprel(spoff=0x%lx)\n", \ + reg, 4*(unsigned long)spoff) + +#define UNW_DEC_REG_PSPREL(fmt, reg, pspoff, arg) \ + printf ("\t"STR(fmt)":%s_psprel(pspoff=0x10-0x%lx)\n", \ + reg, 4*(unsigned long)pspoff) + +#define UNW_DEC_GR_GR(fmt, grmask, gr, arg) \ + do \ + { \ + char grstr[20]; \ + \ + unw_print_grmask (grstr, grmask); \ + printf ("\t"STR(fmt)":gr_gr(grmask=[%s],r%u)\n", grstr, gr); \ + } \ + while (0) + +#define UNW_DEC_ABI(fmt, abi, context, arg) \ + do \ + { \ + static const char *abiname[] = \ + { \ + "@svr4", "@hpux", "@nt" \ + }; \ + char buf[20]; \ + const char *abistr = buf; \ + \ + if (abi < 3) \ + abistr = abiname[abi]; \ + else \ + sprintf (buf, "0x%x", abi); \ + printf ("\t"STR(fmt)":unwabi(abi=%s,context=0x%02x)\n", \ + abistr, context); \ + } \ + while (0) + +#define UNW_DEC_PRIUNAT_GR(fmt, r, arg) \ + printf ("\t"STR(fmt)":priunat_gr(reg=r%u)\n", r) + +#define UNW_DEC_PRIUNAT_WHEN_GR(fmt, t, arg) \ + printf ("\t"STR(fmt)":priunat_when_gr(t=%lu)\n", (unsigned long) t) + +#define UNW_DEC_PRIUNAT_WHEN_MEM(fmt, t, arg) \ + printf ("\t"STR(fmt)":priunat_when_mem(t=%lu)\n", (unsigned long) t) + +#define UNW_DEC_PRIUNAT_PSPREL(fmt, pspoff, arg) \ + printf ("\t"STR(fmt)":priunat_psprel(pspoff=0x10-0x%lx)\n", \ + 4*(unsigned long)pspoff) + +#define UNW_DEC_PRIUNAT_SPREL(fmt, spoff, arg) \ + printf ("\t"STR(fmt)":priunat_sprel(spoff=0x%lx)\n", \ + 4*(unsigned long)spoff) + +#define UNW_DEC_MEM_STACK_F(fmt, t, size, arg) \ + printf ("\t"STR(fmt)":mem_stack_f(t=%lu,size=%lu)\n", \ + (unsigned long) t, 16*(unsigned long)size) + +#define UNW_DEC_MEM_STACK_V(fmt, t, arg) \ + printf ("\t"STR(fmt)":mem_stack_v(t=%lu)\n", (unsigned long) t) + +#define UNW_DEC_SPILL_BASE(fmt, pspoff, arg) \ + printf ("\t"STR(fmt)":spill_base(pspoff=0x10-0x%lx)\n", \ + 4*(unsigned long)pspoff) + +#define UNW_DEC_SPILL_MASK(fmt, dp, arg) \ + do \ + { \ + static const char * spill_type = "-frb"; \ + unsigned const char * imaskp = dp; \ + unsigned char mask = 0; \ + bfd_vma insn = 0; \ + \ + printf ("\t"STR (fmt)":spill_mask(imask=["); \ + for (insn = 0; insn < unw_rlen; ++insn) \ + { \ + if ((insn % 4) == 0) \ + mask = *imaskp++; \ + if (insn > 0 && (insn % 3) == 0) \ + putchar (','); \ + putchar (spill_type[(mask >> (2 * (3 - (insn & 0x3)))) & 0x3]); \ + } \ + printf ("])\n"); \ + dp = imaskp; \ + } \ + while (0) + +#define UNW_DEC_SPILL_SPREL(fmt, t, abreg, spoff, arg) \ + do \ + { \ + char regname[10]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR(fmt)":spill_sprel(reg=%s,t=%lu,spoff=0x%lx)\n", \ + regname, (unsigned long) t, 4*(unsigned long)off); \ + } \ + while (0) + +#define UNW_DEC_SPILL_PSPREL(fmt, t, abreg, pspoff, arg) \ + do \ + { \ + char regname[10]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR(fmt)":spill_psprel(reg=%s,t=%lu,pspoff=0x10-0x%lx)\n", \ + regname, (unsigned long) t, 4*(unsigned long)pspoff); \ + } \ + while (0) + +#define UNW_DEC_RESTORE(fmt, t, abreg, arg) \ + do \ + { \ + char regname[10]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR(fmt)":restore(t=%lu,reg=%s)\n", \ + (unsigned long) t, regname); \ + } \ + while (0) + +#define UNW_DEC_SPILL_REG(fmt, t, abreg, x, ytreg, arg) \ + do \ + { \ + char abregname[10], tregname[10]; \ + \ + unw_print_abreg (abregname, abreg); \ + unw_print_xyreg (tregname, x, ytreg); \ + printf ("\t"STR(fmt)":spill_reg(t=%lu,reg=%s,treg=%s)\n", \ + (unsigned long) t, abregname, tregname); \ + } \ + while (0) + +#define UNW_DEC_SPILL_SPREL_P(fmt, qp, t, abreg, spoff, arg) \ + do \ + { \ + char regname[20]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR(fmt)":spill_sprel_p(qp=p%u,t=%lu,reg=%s,spoff=0x%lx)\n", \ + qp, (unsigned long) t, regname, 4 * (unsigned long)spoff); \ + } \ + while (0) + +#define UNW_DEC_SPILL_PSPREL_P(fmt, qp, t, abreg, pspoff, arg) \ + do \ + { \ + char regname[20]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR (fmt) \ + ":spill_psprel_p(qp=p%u,t=%lu,reg=%s,pspoff=0x10-0x%lx)\n",\ + qp, (unsigned long) t, regname, 4*(unsigned long)pspoff); \ + } \ + while (0) + +#define UNW_DEC_RESTORE_P(fmt, qp, t, abreg, arg) \ + do \ + { \ + char regname[20]; \ + \ + unw_print_abreg (regname, abreg); \ + printf ("\t"STR(fmt)":restore_p(qp=p%u,t=%lu,reg=%s)\n", \ + qp, (unsigned long) t, regname); \ + } \ + while (0) + +#define UNW_DEC_SPILL_REG_P(fmt, qp, t, abreg, x, ytreg, arg) \ + do \ + { \ + char regname[20], tregname[20]; \ + \ + unw_print_abreg (regname, abreg); \ + unw_print_xyreg (tregname, x, ytreg); \ + printf ("\t"STR(fmt)":spill_reg_p(qp=p%u,t=%lu,reg=%s,treg=%s)\n",\ + qp, (unsigned long) t, regname, tregname); \ + } \ + while (0) + +#define UNW_DEC_LABEL_STATE(fmt, label, arg) \ + printf ("\t"STR(fmt)":label_state(label=%lu)\n", (unsigned long) label) + +#define UNW_DEC_COPY_STATE(fmt, label, arg) \ + printf ("\t"STR(fmt)":copy_state(label=%lu)\n", (unsigned long) label) + +#define UNW_DEC_EPILOGUE(fmt, t, ecount, arg) \ + printf ("\t"STR(fmt)":epilogue(t=%lu,ecount=%lu)\n", \ + (unsigned long) t, (unsigned long) ecount) + +/* + * Generic IA-64 unwind info decoder. + * + * This file is used both by the Linux kernel and objdump. Please + * keep the two copies of this file in sync (modulo differences in the + * prototypes...). + * + * You need to customize the decoder by defining the following + * macros/constants before including this file: + * + * Types: + * unw_word Unsigned integer type with at least 64 bits + * + * Register names: + * UNW_REG_BSP + * UNW_REG_BSPSTORE + * UNW_REG_FPSR + * UNW_REG_LC + * UNW_REG_PFS + * UNW_REG_PR + * UNW_REG_RNAT + * UNW_REG_PSP + * UNW_REG_RP + * UNW_REG_UNAT + * + * Decoder action macros: + * UNW_DEC_BAD_CODE(code) + * UNW_DEC_ABI(fmt,abi,context,arg) + * UNW_DEC_BR_GR(fmt,brmask,gr,arg) + * UNW_DEC_BR_MEM(fmt,brmask,arg) + * UNW_DEC_COPY_STATE(fmt,label,arg) + * UNW_DEC_EPILOGUE(fmt,t,ecount,arg) + * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg) + * UNW_DEC_FR_MEM(fmt,frmask,arg) + * UNW_DEC_GR_GR(fmt,grmask,gr,arg) + * UNW_DEC_GR_MEM(fmt,grmask,arg) + * UNW_DEC_LABEL_STATE(fmt,label,arg) + * UNW_DEC_MEM_STACK_F(fmt,t,size,arg) + * UNW_DEC_MEM_STACK_V(fmt,t,arg) + * UNW_DEC_PRIUNAT_GR(fmt,r,arg) + * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg) + * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg) + * UNW_DEC_PROLOGUE(fmt,body,rlen,arg) + * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg) + * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg) + * UNW_DEC_REG_REG(fmt,src,dst,arg) + * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg) + * UNW_DEC_REG_WHEN(fmt,reg,t,arg) + * UNW_DEC_RESTORE(fmt,t,abreg,arg) + * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg) + * UNW_DEC_SPILL_BASE(fmt,pspoff,arg) + * UNW_DEC_SPILL_MASK(fmt,imaskp,arg) + * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg) + * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg) + */ + +static unw_word unw_decode_uleb128 PARAMS ((const unsigned char **)); +static const unsigned char *unw_decode_x1 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_x2 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_x3 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_x4 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_r1 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_r2 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_r3 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_p1 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_p2_p5 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_p6 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_p7_p10 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_b1 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_b2 PARAMS ((const unsigned char *, + unsigned char, void *)); +static const unsigned char *unw_decode_b3_x4 PARAMS ((const unsigned char *, + unsigned char, void *)); + +static unw_word +unw_decode_uleb128 (dpp) + const unsigned char **dpp; +{ + unsigned shift = 0; + unw_word byte, result = 0; + const unsigned char *bp = *dpp; + + while (1) + { + byte = *bp++; + result |= (byte & 0x7f) << shift; + + if ((byte & 0x80) == 0) + break; + + shift += 7; + } + + *dpp = bp; + + return result; +} + +static const unsigned char * +unw_decode_x1 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unsigned char byte1, abreg; + unw_word t, off; + + byte1 = *dp++; + t = unw_decode_uleb128 (&dp); + off = unw_decode_uleb128 (&dp); + abreg = (byte1 & 0x7f); + if (byte1 & 0x80) + UNW_DEC_SPILL_SPREL (X1, t, abreg, off, arg); + else + UNW_DEC_SPILL_PSPREL (X1, t, abreg, off, arg); + return dp; +} + +static const unsigned char * +unw_decode_x2 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unsigned char byte1, byte2, abreg, x, ytreg; + unw_word t; + + byte1 = *dp++; + byte2 = *dp++; + t = unw_decode_uleb128 (&dp); + abreg = (byte1 & 0x7f); + ytreg = byte2; + x = (byte1 >> 7) & 1; + if ((byte1 & 0x80) == 0 && ytreg == 0) + UNW_DEC_RESTORE (X2, t, abreg, arg); + else + UNW_DEC_SPILL_REG (X2, t, abreg, x, ytreg, arg); + return dp; +} + +static const unsigned char * +unw_decode_x3 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unsigned char byte1, byte2, abreg, qp; + unw_word t, off; + + byte1 = *dp++; + byte2 = *dp++; + t = unw_decode_uleb128 (&dp); + off = unw_decode_uleb128 (&dp); + + qp = (byte1 & 0x3f); + abreg = (byte2 & 0x7f); + + if (byte1 & 0x80) + UNW_DEC_SPILL_SPREL_P (X3, qp, t, abreg, off, arg); + else + UNW_DEC_SPILL_PSPREL_P (X3, qp, t, abreg, off, arg); + return dp; +} + +static const unsigned char * +unw_decode_x4 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unsigned char byte1, byte2, byte3, qp, abreg, x, ytreg; + unw_word t; + + byte1 = *dp++; + byte2 = *dp++; + byte3 = *dp++; + t = unw_decode_uleb128 (&dp); + + qp = (byte1 & 0x3f); + abreg = (byte2 & 0x7f); + x = (byte2 >> 7) & 1; + ytreg = byte3; + + if ((byte2 & 0x80) == 0 && byte3 == 0) + UNW_DEC_RESTORE_P (X4, qp, t, abreg, arg); + else + UNW_DEC_SPILL_REG_P (X4, qp, t, abreg, x, ytreg, arg); + return dp; +} + +static const unsigned char * +unw_decode_r1 (dp, code, arg) + const unsigned char *dp; + unsigned char code; + void *arg; +{ + int body = (code & 0x20) != 0; + unw_word rlen; + + rlen = (code & 0x1f); + UNW_DEC_PROLOGUE (R1, body, rlen, arg); + return dp; +} + +static const unsigned char * +unw_decode_r2 (dp, code, arg) + const unsigned char *dp; + unsigned char code; + void *arg; +{ + unsigned char byte1, mask, grsave; + unw_word rlen; + + byte1 = *dp++; + + mask = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); + grsave = (byte1 & 0x7f); + rlen = unw_decode_uleb128 (& dp); + UNW_DEC_PROLOGUE_GR (R2, rlen, mask, grsave, arg); + return dp; +} + +static const unsigned char * +unw_decode_r3 (dp, code, arg) + const unsigned char *dp; + unsigned char code; + void *arg; +{ + unw_word rlen; + + rlen = unw_decode_uleb128 (& dp); + UNW_DEC_PROLOGUE (R3, ((code & 0x3) == 1), rlen, arg); + return dp; +} + +static const unsigned char * +unw_decode_p1 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unsigned char brmask = (code & 0x1f); + + UNW_DEC_BR_MEM (P1, brmask, arg); + return dp; +} + +static const unsigned char * +unw_decode_p2_p5 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + if ((code & 0x10) == 0) + { + unsigned char byte1 = *dp++; + + UNW_DEC_BR_GR (P2, ((code & 0xf) << 1) | ((byte1 >> 7) & 1), + (byte1 & 0x7f), arg); + } + else if ((code & 0x08) == 0) + { + unsigned char byte1 = *dp++, r, dst; + + r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); + dst = (byte1 & 0x7f); + switch (r) + { + case 0: + UNW_DEC_REG_GR (P3, UNW_REG_PSP, dst, arg); + break; + case 1: + UNW_DEC_REG_GR (P3, UNW_REG_RP, dst, arg); + break; + case 2: + UNW_DEC_REG_GR (P3, UNW_REG_PFS, dst, arg); + break; + case 3: + UNW_DEC_REG_GR (P3, UNW_REG_PR, dst, arg); + break; + case 4: + UNW_DEC_REG_GR (P3, UNW_REG_UNAT, dst, arg); + break; + case 5: + UNW_DEC_REG_GR (P3, UNW_REG_LC, dst, arg); + break; + case 6: + UNW_DEC_RP_BR (P3, dst, arg); + break; + case 7: + UNW_DEC_REG_GR (P3, UNW_REG_RNAT, dst, arg); + break; + case 8: + UNW_DEC_REG_GR (P3, UNW_REG_BSP, dst, arg); + break; + case 9: + UNW_DEC_REG_GR (P3, UNW_REG_BSPSTORE, dst, arg); + break; + case 10: + UNW_DEC_REG_GR (P3, UNW_REG_FPSR, dst, arg); + break; + case 11: + UNW_DEC_PRIUNAT_GR (P3, dst, arg); + break; + default: + UNW_DEC_BAD_CODE (r); + break; + } + } + else if ((code & 0x7) == 0) + UNW_DEC_SPILL_MASK (P4, dp, arg); + else if ((code & 0x7) == 1) + { + unw_word grmask, frmask, byte1, byte2, byte3; + + byte1 = *dp++; + byte2 = *dp++; + byte3 = *dp++; + grmask = ((byte1 >> 4) & 0xf); + frmask = ((byte1 & 0xf) << 16) | (byte2 << 8) | byte3; + UNW_DEC_FRGR_MEM (P5, grmask, frmask, arg); + } + else + UNW_DEC_BAD_CODE (code); + + return dp; +} + +static const unsigned char * +unw_decode_p6 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + int gregs = (code & 0x10) != 0; + unsigned char mask = (code & 0x0f); + + if (gregs) + UNW_DEC_GR_MEM (P6, mask, arg); + else + UNW_DEC_FR_MEM (P6, mask, arg); + return dp; +} + +static const unsigned char * +unw_decode_p7_p10 (dp, code, arg) + const unsigned char *dp; + unsigned char code; + void *arg; +{ + unsigned char r, byte1, byte2; + unw_word t, size; + + if ((code & 0x10) == 0) + { + r = (code & 0xf); + t = unw_decode_uleb128 (&dp); + switch (r) + { + case 0: + size = unw_decode_uleb128 (&dp); + UNW_DEC_MEM_STACK_F (P7, t, size, arg); + break; + + case 1: + UNW_DEC_MEM_STACK_V (P7, t, arg); + break; + case 2: + UNW_DEC_SPILL_BASE (P7, t, arg); + break; + case 3: + UNW_DEC_REG_SPREL (P7, UNW_REG_PSP, t, arg); + break; + case 4: + UNW_DEC_REG_WHEN (P7, UNW_REG_RP, t, arg); + break; + case 5: + UNW_DEC_REG_PSPREL (P7, UNW_REG_RP, t, arg); + break; + case 6: + UNW_DEC_REG_WHEN (P7, UNW_REG_PFS, t, arg); + break; + case 7: + UNW_DEC_REG_PSPREL (P7, UNW_REG_PFS, t, arg); + break; + case 8: + UNW_DEC_REG_WHEN (P7, UNW_REG_PR, t, arg); + break; + case 9: + UNW_DEC_REG_PSPREL (P7, UNW_REG_PR, t, arg); + break; + case 10: + UNW_DEC_REG_WHEN (P7, UNW_REG_LC, t, arg); + break; + case 11: + UNW_DEC_REG_PSPREL (P7, UNW_REG_LC, t, arg); + break; + case 12: + UNW_DEC_REG_WHEN (P7, UNW_REG_UNAT, t, arg); + break; + case 13: + UNW_DEC_REG_PSPREL (P7, UNW_REG_UNAT, t, arg); + break; + case 14: + UNW_DEC_REG_WHEN (P7, UNW_REG_FPSR, t, arg); + break; + case 15: + UNW_DEC_REG_PSPREL (P7, UNW_REG_FPSR, t, arg); + break; + default: + UNW_DEC_BAD_CODE (r); + break; + } + } + else + { + switch (code & 0xf) + { + case 0x0: /* p8 */ + { + r = *dp++; + t = unw_decode_uleb128 (&dp); + switch (r) + { + case 1: + UNW_DEC_REG_SPREL (P8, UNW_REG_RP, t, arg); + break; + case 2: + UNW_DEC_REG_SPREL (P8, UNW_REG_PFS, t, arg); + break; + case 3: + UNW_DEC_REG_SPREL (P8, UNW_REG_PR, t, arg); + break; + case 4: + UNW_DEC_REG_SPREL (P8, UNW_REG_LC, t, arg); + break; + case 5: + UNW_DEC_REG_SPREL (P8, UNW_REG_UNAT, t, arg); + break; + case 6: + UNW_DEC_REG_SPREL (P8, UNW_REG_FPSR, t, arg); + break; + case 7: + UNW_DEC_REG_WHEN (P8, UNW_REG_BSP, t, arg); + break; + case 8: + UNW_DEC_REG_PSPREL (P8, UNW_REG_BSP, t, arg); + break; + case 9: + UNW_DEC_REG_SPREL (P8, UNW_REG_BSP, t, arg); + break; + case 10: + UNW_DEC_REG_WHEN (P8, UNW_REG_BSPSTORE, t, arg); + break; + case 11: + UNW_DEC_REG_PSPREL (P8, UNW_REG_BSPSTORE, t, arg); + break; + case 12: + UNW_DEC_REG_SPREL (P8, UNW_REG_BSPSTORE, t, arg); + break; + case 13: + UNW_DEC_REG_WHEN (P8, UNW_REG_RNAT, t, arg); + break; + case 14: + UNW_DEC_REG_PSPREL (P8, UNW_REG_RNAT, t, arg); + break; + case 15: + UNW_DEC_REG_SPREL (P8, UNW_REG_RNAT, t, arg); + break; + case 16: + UNW_DEC_PRIUNAT_WHEN_GR (P8, t, arg); + break; + case 17: + UNW_DEC_PRIUNAT_PSPREL (P8, t, arg); + break; + case 18: + UNW_DEC_PRIUNAT_SPREL (P8, t, arg); + break; + case 19: + UNW_DEC_PRIUNAT_WHEN_MEM (P8, t, arg); + break; + default: + UNW_DEC_BAD_CODE (r); + break; + } + } + break; + + case 0x1: + byte1 = *dp++; + byte2 = *dp++; + UNW_DEC_GR_GR (P9, (byte1 & 0xf), (byte2 & 0x7f), arg); + break; + + case 0xf: /* p10 */ + byte1 = *dp++; + byte2 = *dp++; + UNW_DEC_ABI (P10, byte1, byte2, arg); + break; + + case 0x9: + return unw_decode_x1 (dp, code, arg); + + case 0xa: + return unw_decode_x2 (dp, code, arg); + + case 0xb: + return unw_decode_x3 (dp, code, arg); + + case 0xc: + return unw_decode_x4 (dp, code, arg); + + default: + UNW_DEC_BAD_CODE (code); + break; + } + } + return dp; +} + +static const unsigned char * +unw_decode_b1 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unw_word label = (code & 0x1f); + + if ((code & 0x20) != 0) + UNW_DEC_COPY_STATE (B1, label, arg); + else + UNW_DEC_LABEL_STATE (B1, label, arg); + return dp; +} + +static const unsigned char * +unw_decode_b2 (dp, code, arg) + const unsigned char * dp; + unsigned char code; + void * arg ATTRIBUTE_UNUSED; +{ + unw_word t; + + t = unw_decode_uleb128 (& dp); + UNW_DEC_EPILOGUE (B2, t, (code & 0x1f), arg); + return dp; +} + +static const unsigned char * +unw_decode_b3_x4 (dp, code, arg) + const unsigned char *dp; + unsigned char code; + void *arg; +{ + unw_word t, ecount, label; + + if ((code & 0x10) == 0) + { + t = unw_decode_uleb128 (&dp); + ecount = unw_decode_uleb128 (&dp); + UNW_DEC_EPILOGUE (B3, t, ecount, arg); + } + else if ((code & 0x07) == 0) + { + label = unw_decode_uleb128 (&dp); + if ((code & 0x08) != 0) + UNW_DEC_COPY_STATE (B4, label, arg); + else + UNW_DEC_LABEL_STATE (B4, label, arg); + } + else + switch (code & 0x7) + { + case 1: + return unw_decode_x1 (dp, code, arg); + case 2: + return unw_decode_x2 (dp, code, arg); + case 3: + return unw_decode_x3 (dp, code, arg); + case 4: + return unw_decode_x4 (dp, code, arg); + default: + UNW_DEC_BAD_CODE (code); + break; + } + return dp; +} + +typedef const unsigned char *(*unw_decoder) + PARAMS ((const unsigned char *, unsigned char, void *)); + +static unw_decoder unw_decode_table[2][8] = + { + /* prologue table: */ + { + unw_decode_r1, /* 0 */ + unw_decode_r1, + unw_decode_r2, + unw_decode_r3, + unw_decode_p1, /* 4 */ + unw_decode_p2_p5, + unw_decode_p6, + unw_decode_p7_p10 + }, + { + unw_decode_r1, /* 0 */ + unw_decode_r1, + unw_decode_r2, + unw_decode_r3, + unw_decode_b1, /* 4 */ + unw_decode_b1, + unw_decode_b2, + unw_decode_b3_x4 + } + }; + +/* Decode one descriptor and return address of next descriptor. */ +const unsigned char * +unw_decode (dp, inside_body, ptr_inside_body) + const unsigned char * dp; + int inside_body; + void * ptr_inside_body; +{ + unw_decoder decoder; + unsigned char code; + + code = *dp++; + decoder = unw_decode_table[inside_body][code >> 5]; + return (*decoder) (dp, code, ptr_inside_body); +} diff --git a/binutils/unwind-ia64.h b/binutils/unwind-ia64.h new file mode 100644 index 00000000000..6cb5a8c5e90 --- /dev/null +++ b/binutils/unwind-ia64.h @@ -0,0 +1,31 @@ +/* unwind-ia64.h -- dump IA-64 unwind info. + Copyright (c) 2000, 2001 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang + +This file is part of GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include +#include + +#define UNW_VER(x) ((x) >> 48) +#define UNW_FLAG_MASK 0x0000ffff00000000 +#define UNW_FLAG_OSMASK 0x0000f00000000000 +#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L) +#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L) +#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL) + +extern const unsigned char * unw_decode PARAMS ((const unsigned char *, int, void *)); -- 2.39.2