From 9b838f86043783a5b17b2a54a066fda56af5f9f3 Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 30 Nov 2002 18:41:53 +0000 Subject: [PATCH] Initial revision CVS patchset: 5903 CVS date: 2002/11/30 18:41:53 --- elfutils/libdw/Makefile.am | 70 +++++ elfutils/libdw/Makefile.in | 533 ++++++++++++++++++++++++++++++++++ elfutils/libdw/dwarf.h | 549 ++++++++++++++++++++++++++++++++++++ elfutils/libdw/dwarf_begin.c | 83 ++++++ elfutils/libdw/dwarf_begin_elf.c | 241 ++++++++++++++++ elfutils/libdw/dwarf_end.c | 36 +++ elfutils/libdw/dwarf_error.c | 73 +++++ elfutils/libdw/dwarf_get_elf.c | 36 +++ elfutils/libdw/libdw.h | 55 ++++ elfutils/libdw/libdw.map | 12 + elfutils/libdw/libdwP.h | 84 ++++++ elfutils/libdw/memory-access.h | 210 ++++++++++++++ elfutils/libebl/alpha_destr.c | 27 ++ elfutils/libebl/alpha_init.c | 40 +++ elfutils/libebl/alpha_symbol.c | 91 ++++++ elfutils/libebl/arm_destr.c | 27 ++ elfutils/libebl/arm_init.c | 40 +++ elfutils/libebl/arm_symbol.c | 113 ++++++++ elfutils/libebl/ia64_destr.c | 27 ++ elfutils/libebl/ia64_init.c | 40 +++ elfutils/libebl/ia64_symbol.c | 139 +++++++++ elfutils/libebl/libebl_alpha.h | 33 +++ elfutils/libebl/libebl_alpha.map | 11 + elfutils/libebl/libebl_arm.h | 33 +++ elfutils/libebl/libebl_arm.map | 11 + elfutils/libebl/libebl_ia64.h | 33 +++ elfutils/libebl/libebl_ia64.map | 11 + elfutils/libelf/libelf_crc32.c | 20 ++ elfutils/libelf/libelf_next_prime.c | 18 ++ 29 files changed, 2696 insertions(+) create mode 100644 elfutils/libdw/Makefile.am create mode 100644 elfutils/libdw/Makefile.in create mode 100644 elfutils/libdw/dwarf.h create mode 100644 elfutils/libdw/dwarf_begin.c create mode 100644 elfutils/libdw/dwarf_begin_elf.c create mode 100644 elfutils/libdw/dwarf_end.c create mode 100644 elfutils/libdw/dwarf_error.c create mode 100644 elfutils/libdw/dwarf_get_elf.c create mode 100644 elfutils/libdw/libdw.h create mode 100644 elfutils/libdw/libdw.map create mode 100644 elfutils/libdw/libdwP.h create mode 100644 elfutils/libdw/memory-access.h create mode 100644 elfutils/libebl/alpha_destr.c create mode 100644 elfutils/libebl/alpha_init.c create mode 100644 elfutils/libebl/alpha_symbol.c create mode 100644 elfutils/libebl/arm_destr.c create mode 100644 elfutils/libebl/arm_init.c create mode 100644 elfutils/libebl/arm_symbol.c create mode 100644 elfutils/libebl/ia64_destr.c create mode 100644 elfutils/libebl/ia64_init.c create mode 100644 elfutils/libebl/ia64_symbol.c create mode 100644 elfutils/libebl/libebl_alpha.h create mode 100644 elfutils/libebl/libebl_alpha.map create mode 100644 elfutils/libebl/libebl_arm.h create mode 100644 elfutils/libebl/libebl_arm.map create mode 100644 elfutils/libebl/libebl_ia64.h create mode 100644 elfutils/libebl/libebl_ia64.map create mode 100644 elfutils/libelf/libelf_crc32.c create mode 100644 elfutils/libelf/libelf_next_prime.c diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am new file mode 100644 index 0000000..9798aa9 --- /dev/null +++ b/elfutils/libdw/Makefile.am @@ -0,0 +1,70 @@ +## Process this file with automake to create Makefile.in +## Configure input file for elfutils. +## +## Copyright (C) 2002 Red Hat, Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License version 2 as +## published by the Free Software Foundation. +## +## his 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, +## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +AM_CFLAGS = -Wall -Werror +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib + +lib_LIBRARIES = libdw.a +noinst_LIBRARIES = libdw_pic.a +noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) + +include_HEADERS = dwarf.h +euincludedir = ${includedir}/elfutils +euinclude_HEADERS = libdw.h + +libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_get_elf.c \ + dwarf_error.c + +libdw_pic_a_SOURCES = +am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) + +libdw_so_SOURCES = +libdw.so: libdw_pic.a libdw.map + $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + -Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \ + -Wl,--soname,$@.$(VERSION) \ + ../libelf/libelf.so + ln -fs $@ $@.$(VERSION) + + +%.os: %.c %.o + if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ + rm -f "$(DEPDIR)/$*.Tpo"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + +install: install-am libdw.so + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so + ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION) + ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so + +uninstall: uninstall-am + rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so + rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION) + rm -f $(DESTDIR)$(libdir)/libdw.so + rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils + +noinst_HEADERS = libdwP.h memory-access.h + +EXTRA_DIST = libdw.map + +CLEANFILES = $(am_libdw_pic_a_OBJECTS) diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in new file mode 100644 index 0000000..6976b60 --- /dev/null +++ b/elfutils/libdw/Makefile.in @@ -0,0 +1,533 @@ +# Makefile.in generated by automake 1.7 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBS = @LIBS@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = -Wall -Werror +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib + +lib_LIBRARIES = libdw.a +noinst_LIBRARIES = libdw_pic.a +noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) + +include_HEADERS = dwarf.h +euincludedir = ${includedir}/elfutils +euinclude_HEADERS = libdw.h + +libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_get_elf.c \ + dwarf_error.c + + +libdw_pic_a_SOURCES = +am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) + +libdw_so_SOURCES = + +noinst_HEADERS = libdwP.h memory-access.h + +EXTRA_DIST = libdw.map + +CLEANFILES = $(am_libdw_pic_a_OBJECTS) +subdir = libdw +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) + +libdw_a_AR = $(AR) cru +libdw_a_LIBADD = +am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ + dwarf_end.$(OBJEXT) dwarf_get_elf.$(OBJEXT) \ + dwarf_error.$(OBJEXT) +libdw_a_OBJECTS = $(am_libdw_a_OBJECTS) +libdw_pic_a_AR = $(AR) cru +libdw_pic_a_LIBADD = +libdw_pic_a_OBJECTS = $(am_libdw_pic_a_OBJECTS) +noinst_PROGRAMS = libdw.so$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +am_libdw_so_OBJECTS = +libdw_so_OBJECTS = $(am_libdw_so_OBJECTS) +libdw_so_LDADD = $(LDADD) +libdw_so_DEPENDENCIES = +libdw_so_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dwarf_begin.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dwarf_begin_elf.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dwarf_end.Po ./$(DEPDIR)/dwarf_error.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dwarf_get_elf.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \ + $(libdw_so_SOURCES) +HEADERS = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) + +DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) \ + Makefile.am Makefile.in +SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) $(libdw_so_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits libdw/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar +libLIBRARIES_INSTALL = $(INSTALL_DATA) +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdw.a: $(libdw_a_OBJECTS) $(libdw_a_DEPENDENCIES) + -rm -f libdw.a + $(libdw_a_AR) libdw.a $(libdw_a_OBJECTS) $(libdw_a_LIBADD) + $(RANLIB) libdw.a +libdw_pic.a: $(libdw_pic_a_OBJECTS) $(libdw_pic_a_DEPENDENCIES) + -rm -f libdw_pic.a + $(libdw_pic_a_AR) libdw_pic.a $(libdw_pic_a_OBJECTS) $(libdw_pic_a_LIBADD) + $(RANLIB) libdw_pic.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_begin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_begin_elf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_end.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_get_elf.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'` +uninstall-info-am: +euincludeHEADERS_INSTALL = $(INSTALL_HEADER) +install-euincludeHEADERS: $(euinclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(euincludedir) + @list='$(euinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(euincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(euincludedir)/$$f"; \ + $(euincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(euincludedir)/$$f; \ + done + +uninstall-euincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(euinclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(euincludedir)/$$f"; \ + rm -f $(DESTDIR)$(euincludedir)/$$f; \ + done +includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ + $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ + rm -f $(DESTDIR)$(includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(euincludedir) $(DESTDIR)$(includedir) +install-exec: install-exec-am +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-euincludeHEADERS install-includeHEADERS + +install-exec-am: install-libLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ + uninstall-info-am uninstall-libLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ + ctags distclean distclean-compile distclean-depend \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-euincludeHEADERS install-exec install-exec-am \ + install-includeHEADERS install-info install-info-am \ + install-libLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-euincludeHEADERS \ + uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLIBRARIES + +libdw.so: libdw_pic.a libdw.map + $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + -Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \ + -Wl,--soname,$@.$(VERSION) \ + ../libelf/libelf.so + ln -fs $@ $@.$(VERSION) + +%.os: %.c %.o + if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ + rm -f "$(DEPDIR)/$*.Tpo"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + +install: install-am libdw.so + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so + ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION) + ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so + +uninstall: uninstall-am + rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so + rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION) + rm -f $(DESTDIR)$(libdir)/libdw.so + rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/elfutils/libdw/dwarf.h b/elfutils/libdw/dwarf.h new file mode 100644 index 0000000..81bdcc4 --- /dev/null +++ b/elfutils/libdw/dwarf.h @@ -0,0 +1,549 @@ +/* This file defines standard DWARF types, structures, and macros. + Copyright (C) 2000, 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifndef _DWARF_H +#define _DWARF_H 1 + +/* DWARF tags. */ +enum + { + DW_TAG_array_type = 0x01, + DW_TAG_class_type = 0x02, + DW_TAG_entry_point = 0x03, + DW_TAG_enumeration_type = 0x04, + DW_TAG_formal_parameter = 0x05, + DW_TAG_imported_declaration = 0x08, + DW_TAG_label = 0x0a, + DW_TAG_lexical_block = 0x0b, + DW_TAG_member = 0x0d, + DW_TAG_pointer_type = 0x0f, + DW_TAG_reference_type = 0x10, + DW_TAG_compile_unit = 0x11, + DW_TAG_string_type = 0x12, + DW_TAG_structure_type = 0x13, + DW_TAG_subroutine_type = 0x15, + DW_TAG_typedef = 0x16, + DW_TAG_union_type = 0x17, + DW_TAG_unspecified_parameters = 0x18, + DW_TAG_variant = 0x19, + DW_TAG_common_block = 0x1a, + DW_TAG_common_inclusion = 0x1b, + DW_TAG_inheritance = 0x1c, + DW_TAG_inlined_subroutine = 0x1d, + DW_TAG_module = 0x1e, + DW_TAG_ptr_to_member_type = 0x1f, + DW_TAG_set_type = 0x20, + DW_TAG_subrange_type = 0x21, + DW_TAG_with_stmt = 0x22, + DW_TAG_access_declaration = 0x23, + DW_TAG_base_type = 0x24, + DW_TAG_catch_block = 0x25, + DW_TAG_const_type = 0x26, + DW_TAG_constant = 0x27, + DW_TAG_enumerator = 0x28, + DW_TAG_file_type = 0x29, + DW_TAG_friend = 0x2a, + DW_TAG_namelist = 0x2b, + DW_TAG_namelist_item = 0x2c, + DW_TAG_packed_type = 0x2d, + DW_TAG_subprogram = 0x2e, + DW_TAG_template_type_param = 0x2f, + DW_TAG_template_value_param = 0x30, + DW_TAG_thrown_type = 0x31, + DW_TAG_try_block = 0x32, + DW_TAG_variant_part = 0x33, + DW_TAG_variable = 0x34, + DW_TAG_volatile_type = 0x35, + DW_TAG_lo_user = 0x4080, + DW_TAG_MIPS_loop = 0x4081, + DW_TAG_format_label = 0x4101, + DW_TAG_function_template = 0x4102, + DW_TAG_class_template = 0x4103, + DW_TAG_hi_user = 0xffff + }; + + +/* Children determination encodings. */ +enum + { + DW_CHILDREN_no = 0, + DW_CHILDREN_yes = 1 + }; + + +/* DWARF attributes encodings. */ +enum + { + DW_AT_sibling = 0x01, + DW_AT_location = 0x02, + DW_AT_name = 0x03, + DW_AT_ordering = 0x09, + DW_AT_subscr_data = 0x0a, + DW_AT_byte_size = 0x0b, + DW_AT_bit_offset = 0x0c, + DW_AT_bit_size = 0x0d, + DW_AT_element_list = 0x0f, + DW_AT_stmt_list = 0x10, + DW_AT_low_pc = 0x11, + DW_AT_high_pc = 0x12, + DW_AT_language = 0x13, + DW_AT_member = 0x14, + DW_AT_discr = 0x15, + DW_AT_discr_value = 0x16, + DW_AT_visibility = 0x17, + DW_AT_import = 0x18, + DW_AT_string_length = 0x19, + DW_AT_common_reference = 0x1a, + DW_AT_comp_dir = 0x1b, + DW_AT_const_value = 0x1c, + DW_AT_containing_type = 0x1d, + DW_AT_default_value = 0x1e, + DW_AT_inline = 0x20, + DW_AT_is_optional = 0x21, + DW_AT_lower_bound = 0x22, + DW_AT_producer = 0x25, + DW_AT_prototyped = 0x27, + DW_AT_return_addr = 0x2a, + DW_AT_start_scope = 0x2c, + DW_AT_stride_size = 0x2e, + DW_AT_upper_bound = 0x2f, + DW_AT_abstract_origin = 0x31, + DW_AT_accessibility = 0x32, + DW_AT_address_class = 0x33, + DW_AT_artificial = 0x34, + DW_AT_base_types = 0x35, + DW_AT_calling_convention = 0x36, + DW_AT_count = 0x37, + DW_AT_data_member_location = 0x38, + DW_AT_decl_column = 0x39, + DW_AT_decl_file = 0x3a, + DW_AT_decl_line = 0x3b, + DW_AT_declaration = 0x3c, + DW_AT_discr_list = 0x3d, + DW_AT_encoding = 0x3e, + DW_AT_external = 0x3f, + DW_AT_frame_base = 0x40, + DW_AT_friend = 0x41, + DW_AT_identifier_case = 0x42, + DW_AT_macro_info = 0x43, + DW_AT_namelist_items = 0x44, + DW_AT_priority = 0x45, + DW_AT_segment = 0x46, + DW_AT_specification = 0x47, + DW_AT_static_link = 0x48, + DW_AT_type = 0x49, + DW_AT_use_location = 0x4a, + DW_AT_variable_parameter = 0x4b, + DW_AT_virtuality = 0x4c, + DW_AT_vtable_elem_location = 0x4d, + DW_AT_lo_user = 0x2000, + DW_AT_MIPS_fde = 0x2001, + DW_AT_MIPS_loop_begin = 0x2002, + DW_AT_MIPS_tail_loop_begin = 0x2003, + DW_AT_MIPS_epilog_begin = 0x2004, + DW_AT_MIPS_loop_unroll_factor = 0x2005, + DW_AT_MIPS_software_pipeline_depth = 0x2006, + DW_AT_MIPS_linkage_name = 0x2007, + DW_AT_MIPS_stride = 0x2008, + DW_AT_MIPS_abstract_name = 0x2009, + DW_AT_MIPS_clone_origin = 0x200a, + DW_AT_MIPS_has_inlines = 0x200b, + DW_AT_MIPS_stride_byte = 0x200c, + DW_AT_MIPS_stride_elem = 0x200d, + DW_AT_MIPS_ptr_dopetype = 0x200e, + DW_AT_MIPS_allocatable_dopetype = 0x200f, + DW_AT_MIPS_assumed_shape_dopetype = 0x2010, + DW_AT_MIPS_assumed_size = 0x2011, + DW_AT_sf_names = 0x2101, + DW_AT_src_info = 0x2102, + DW_AT_mac_info = 0x2103, + DW_AT_src_coords = 0x2104, + DW_AT_body_begin = 0x2105, + DW_AT_body_end = 0x2106, + DW_AT_hi_user = 0x3fff + }; + + +/* DWARF form encodings. */ +enum + { + DW_FORM_addr = 0x01, + DW_FORM_block2 = 0x03, + DW_FORM_block4 = 0x04, + DW_FORM_data2 = 0x05, + DW_FORM_data4 = 0x06, + DW_FORM_data8 = 0x07, + DW_FORM_string = 0x08, + DW_FORM_block = 0x09, + DW_FORM_block1 = 0x0a, + DW_FORM_data1 = 0x0b, + DW_FORM_flag = 0x0c, + DW_FORM_sdata = 0x0d, + DW_FORM_strp = 0x0e, + DW_FORM_udata = 0x0f, + DW_FORM_ref_addr = 0x10, + DW_FORM_ref1 = 0x11, + DW_FORM_ref2 = 0x12, + DW_FORM_ref4 = 0x13, + DW_FORM_ref8 = 0x14, + DW_FORM_ref_udata = 0x15, + DW_FORM_indirect = 0x16 + }; + + +/* DWARF location operation encodings. */ +enum + { + DW_OP_addr = 0x03, /* Constant address. */ + DW_OP_deref = 0x06, + DW_OP_const1u = 0x08, /* Unsigned 1-byte constant. */ + DW_OP_const1s = 0x09, /* Signed 1-byte constant. */ + DW_OP_const2u = 0x0a, /* Unsigned 2-byte constant. */ + DW_OP_const2s = 0x0b, /* Signed 2-byte constant. */ + DW_OP_const4u = 0x0c, /* Unsigned 4-byte constant. */ + DW_OP_const4s = 0x0d, /* Signed 4-byte constant. */ + DW_OP_const8u = 0x0e, /* Unsigned 8-byte constant. */ + DW_OP_const8s = 0x0f, /* Signed 8-byte constant. */ + DW_OP_constu = 0x10, /* Unsigned LEB128 constant. */ + DW_OP_consts = 0x11, /* Signed LEB128 constant. */ + DW_OP_dup = 0x12, + DW_OP_drop = 0x13, + DW_OP_over = 0x14, + DW_OP_pick = 0x15, /* 1-byte stack index. */ + DW_OP_swap = 0x16, + DW_OP_rot = 0x17, + DW_OP_xderef = 0x18, + DW_OP_abs = 0x19, + DW_OP_and = 0x1a, + DW_OP_div = 0x1b, + DW_OP_minus = 0x1c, + DW_OP_mod = 0x1d, + DW_OP_mul = 0x1e, + DW_OP_neg = 0x1f, + DW_OP_not = 0x20, + DW_OP_or = 0x21, + DW_OP_plus = 0x22, + DW_OP_plus_uconst = 0x23, /* Unsigned LEB128 addend. */ + DW_OP_shl = 0x24, + DW_OP_shr = 0x25, + DW_OP_shra = 0x26, + DW_OP_xor = 0x27, + DW_OP_bra = 0x28, /* Signed 2-byte constant. */ + DW_OP_eq = 0x29, + DW_OP_ge = 0x2a, + DW_OP_gt = 0x2b, + DW_OP_le = 0x2c, + DW_OP_lt = 0x2d, + DW_OP_ne = 0x2e, + DW_OP_skip = 0x2f, /* Signed 2-byte constant. */ + DW_OP_lit0 = 0x30, /* Literal 0. */ + DW_OP_lit1 = 0x31, /* Literal 1. */ + DW_OP_lit2 = 0x32, /* Literal 2. */ + DW_OP_lit3 = 0x33, /* Literal 3. */ + DW_OP_lit4 = 0x34, /* Literal 4. */ + DW_OP_lit5 = 0x35, /* Literal 5. */ + DW_OP_lit6 = 0x36, /* Literal 6. */ + DW_OP_lit7 = 0x37, /* Literal 7. */ + DW_OP_lit8 = 0x38, /* Literal 8. */ + DW_OP_lit9 = 0x39, /* Literal 9. */ + DW_OP_lit10 = 0x3a, /* Literal 10. */ + DW_OP_lit11 = 0x3b, /* Literal 11. */ + DW_OP_lit12 = 0x3c, /* Literal 12. */ + DW_OP_lit13 = 0x3d, /* Literal 13. */ + DW_OP_lit14 = 0x3e, /* Literal 14. */ + DW_OP_lit15 = 0x3f, /* Literal 15. */ + DW_OP_lit16 = 0x40, /* Literal 16. */ + DW_OP_lit17 = 0x41, /* Literal 17. */ + DW_OP_lit18 = 0x42, /* Literal 18. */ + DW_OP_lit19 = 0x43, /* Literal 19. */ + DW_OP_lit20 = 0x44, /* Literal 20. */ + DW_OP_lit21 = 0x45, /* Literal 21. */ + DW_OP_lit22 = 0x46, /* Literal 22. */ + DW_OP_lit23 = 0x47, /* Literal 23. */ + DW_OP_lit24 = 0x48, /* Literal 24. */ + DW_OP_lit25 = 0x49, /* Literal 25. */ + DW_OP_lit26 = 0x4a, /* Literal 26. */ + DW_OP_lit27 = 0x4b, /* Literal 27. */ + DW_OP_lit28 = 0x4c, /* Literal 28. */ + DW_OP_lit29 = 0x4d, /* Literal 29. */ + DW_OP_lit30 = 0x4e, /* Literal 30. */ + DW_OP_lit31 = 0x4f, /* Literal 31. */ + DW_OP_reg0 = 0x50, /* Register 0. */ + DW_OP_reg1 = 0x51, /* Register 1. */ + DW_OP_reg2 = 0x52, /* Register 2. */ + DW_OP_reg3 = 0x53, /* Register 3. */ + DW_OP_reg4 = 0x54, /* Register 4. */ + DW_OP_reg5 = 0x55, /* Register 5. */ + DW_OP_reg6 = 0x56, /* Register 6. */ + DW_OP_reg7 = 0x57, /* Register 7. */ + DW_OP_reg8 = 0x58, /* Register 8. */ + DW_OP_reg9 = 0x59, /* Register 9. */ + DW_OP_reg10 = 0x5a, /* Register 10. */ + DW_OP_reg11 = 0x5b, /* Register 11. */ + DW_OP_reg12 = 0x5c, /* Register 12. */ + DW_OP_reg13 = 0x5d, /* Register 13. */ + DW_OP_reg14 = 0x5e, /* Register 14. */ + DW_OP_reg15 = 0x5f, /* Register 15. */ + DW_OP_reg16 = 0x60, /* Register 16. */ + DW_OP_reg17 = 0x61, /* Register 17. */ + DW_OP_reg18 = 0x62, /* Register 18. */ + DW_OP_reg19 = 0x63, /* Register 19. */ + DW_OP_reg20 = 0x64, /* Register 20. */ + DW_OP_reg21 = 0x65, /* Register 21. */ + DW_OP_reg22 = 0x66, /* Register 22. */ + DW_OP_reg23 = 0x67, /* Register 24. */ + DW_OP_reg24 = 0x68, /* Register 24. */ + DW_OP_reg25 = 0x69, /* Register 25. */ + DW_OP_reg26 = 0x6a, /* Register 26. */ + DW_OP_reg27 = 0x6b, /* Register 27. */ + DW_OP_reg28 = 0x6c, /* Register 28. */ + DW_OP_reg29 = 0x6d, /* Register 29. */ + DW_OP_reg30 = 0x6e, /* Register 30. */ + DW_OP_reg31 = 0x6f, /* Register 31. */ + DW_OP_breg0 = 0x70, /* Base register 0. */ + DW_OP_breg1 = 0x71, /* Base register 1. */ + DW_OP_breg2 = 0x72, /* Base register 2. */ + DW_OP_breg3 = 0x73, /* Base register 3. */ + DW_OP_breg4 = 0x74, /* Base register 4. */ + DW_OP_breg5 = 0x75, /* Base register 5. */ + DW_OP_breg6 = 0x76, /* Base register 6. */ + DW_OP_breg7 = 0x77, /* Base register 7. */ + DW_OP_breg8 = 0x78, /* Base register 8. */ + DW_OP_breg9 = 0x79, /* Base register 9. */ + DW_OP_breg10 = 0x7a, /* Base register 10. */ + DW_OP_breg11 = 0x7b, /* Base register 11. */ + DW_OP_breg12 = 0x7c, /* Base register 12. */ + DW_OP_breg13 = 0x7d, /* Base register 13. */ + DW_OP_breg14 = 0x7e, /* Base register 14. */ + DW_OP_breg15 = 0x7f, /* Base register 15. */ + DW_OP_breg16 = 0x80, /* Base register 16. */ + DW_OP_breg17 = 0x81, /* Base register 17. */ + DW_OP_breg18 = 0x82, /* Base register 18. */ + DW_OP_breg19 = 0x83, /* Base register 19. */ + DW_OP_breg20 = 0x84, /* Base register 20. */ + DW_OP_breg21 = 0x85, /* Base register 21. */ + DW_OP_breg22 = 0x86, /* Base register 22. */ + DW_OP_breg23 = 0x87, /* Base register 23. */ + DW_OP_breg24 = 0x88, /* Base register 24. */ + DW_OP_breg25 = 0x89, /* Base register 25. */ + DW_OP_breg26 = 0x8a, /* Base register 26. */ + DW_OP_breg27 = 0x8b, /* Base register 27. */ + DW_OP_breg28 = 0x8c, /* Base register 28. */ + DW_OP_breg29 = 0x8d, /* Base register 29. */ + DW_OP_breg30 = 0x8e, /* Base register 30. */ + DW_OP_breg31 = 0x8f, /* Base register 31. */ + DW_OP_regx = 0x90, /* Unsigned LEB128 register. */ + DW_OP_fbreg = 0x91, /* Signed LEB128 register. */ + DW_OP_bregx = 0x92, /* ULEB128 register followed by SLEB128 off. */ + DW_OP_piece = 0x93, /* ULEB128 size of piece addressed. */ + DW_OP_deref_size = 0x94, /* 1-byte size of data retrieved. */ + DW_OP_xderef_size = 0x95, /* 1-byte size of data retrieved. */ + DW_OP_nop = 0x96, + DW_OP_push_object_address = 0x97, + DW_OP_call2 = 0x98, + DW_OP_call4 = 0x99, + DW_OP_call_ref = 0x9a, + + DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */ + DW_OP_hi_user = 0xff /* Implementation-defined range end. */ + }; + + +/* DWARF base type encodings. */ +enum + { + DW_ATE_void = 0x0, + DW_ATE_address = 0x1, + DW_ATE_boolean = 0x2, + DW_ATE_complex_float = 0x3, + DW_ATE_float = 0x4, + DW_ATE_signed = 0x5, + DW_ATE_signed_char = 0x6, + DW_ATE_unsigned = 0x7, + DW_ATE_unsigned_char = 0x8, + + DW_ATE_lo_user = 0x80, + DW_ATE_hi_user = 0xff + }; + + +/* DWARF accessibility encodings. */ +enum + { + DW_ACCESS_public = 1, + DW_ACCESS_protected = 2, + DW_ACCESS_private = 3 + }; + + +/* DWARF visibility encodings. */ +enum + { + DW_VIS_local = 1, + DW_VIS_exported = 2, + DW_VIS_qualified = 3 + }; + + +/* DWARF virtuality encodings. */ +enum + { + DW_VIRTUALITY_none = 0, + DW_VIRTUALITY_virtual = 1, + DW_VIRTUALITY_pure_virtual = 2 + }; + + +/* DWARF language encodings. */ +enum + { + DW_LANG_C89 = 0x0001, + DW_LANG_C = 0x0002, + DW_LANG_Ada83 = 0x0003, + DW_LANG_C_plus_plus = 0x0004, + DW_LANG_Cobol74 = 0x0005, + DW_LANG_Cobol85 = 0x0006, + DW_LANG_Fortran77 = 0x0007, + DW_LANG_Fortran90 = 0x0008, + DW_LANG_Pascal83 = 0x0009, + DW_LANG_Modula2 = 0x000a, + DW_LANG_Java = 0x000b, + DW_LANG_C99 = 0x000c, + DW_LANG_Ada95 = 0x000d, + DW_LANG_Fortran95 = 0x000e, + DW_LANG_PL1 = 0x000f, + DW_LANG_lo_user = 0x8000, + DW_LANG_Mips_Assembler = 0x8001, + DW_LANG_hi_user = 0xffff + }; + + +/* DWARF identifier case encodings. */ +enum + { + DW_ID_case_sensitive = 0, + DW_ID_up_case = 1, + DW_ID_down_case = 2, + DW_ID_case_insensitive = 3 + }; + + +/* DWARF calling conventions encodings. */ +enum + { + DW_CC_normal = 0x1, + DW_CC_program = 0x2, + DW_CC_nocall = 0x3, + DW_CC_lo_user = 0x40, + DW_CC_hi_user = 0xff + }; + + +/* DWARF inline encodings. */ +enum + { + DW_INL_not_inlined = 0, + DW_INL_inlined = 1, + DW_INL_declared_not_inlined = 2, + DW_INL_declared_inlined = 3 + }; + + +/* DWARF ordering encodings. */ +enum + { + DW_ORD_row_major = 0, + DW_ORD_col_major = 1 + }; + + +/* DWARF discriminant descriptor encodings. */ +enum + { + DW_DSC_label = 0, + DW_DSC_range = 1 + }; + + +/* DWARF standard opcode encodings. */ +enum + { + DW_LNS_copy = 1, + DW_LNS_advance_pc = 2, + DW_LNS_advance_line = 3, + DW_LNS_set_file = 4, + DW_LNS_set_column = 5, + DW_LNS_negate_stmt = 6, + DW_LNS_set_basic_block = 7, + DW_LNS_const_add_pc = 8, + DW_LNS_fixed_advance_pc = 9, + DW_LNS_set_prologue_end = 10, + DW_LNS_set_epilog_begin = 11 + }; + + +/* DWARF extended opcide encodings. */ +enum + { + DW_LNE_end_sequence = 1, + DW_LNE_set_address = 2, + DW_LNE_define_file = 3 + }; + + +/* DWARF macinfo type encodings. */ +enum + { + DW_MACINFO_define = 1, + DW_MACINFO_undef = 2, + DW_MACINFO_start_file = 3, + DW_MACINFO_end_file = 4, + DW_MACINFO_vendor_ext = 255 + }; + + +/* DWARF call frame instruction encodings. */ +enum + { + DW_CFA_advance_loc = 0x40, + DW_CFA_offset = 0x80, + DW_CFA_restore = 0xc0, + DW_CFA_extended = 0, + + DW_CFA_nop = 0x00, + DW_CFA_set_loc = 0x01, + DW_CFA_advance_loc1 = 0x02, + DW_CFA_advance_loc2 = 0x03, + DW_CFA_advance_loc4 = 0x04, + DW_CFA_offset_extended = 0x05, + DW_CFA_restore_extended = 0x06, + DW_CFA_undefined = 0x07, + DW_CFA_same_value = 0x08, + DW_CFA_register = 0x09, + DW_CFA_remember_state = 0x0a, + DW_CFA_restore_state = 0x0b, + DW_CFA_def_cfa = 0x0c, + DW_CFA_def_cfa_register = 0x0d, + DW_CFA_def_cfa_offset = 0x0e, + DW_CFA_low_user = 0x1c, + DW_CFA_MIPS_advance_loc8 = 0x1d, + DW_CFA_GNU_window_save = 0x2d, + DW_CFA_GNU_args_size = 0x2e, + DW_CFA_high_user = 0x3f + }; + + +/* DWARF XXX. */ +#define DW_ADDR_none 0 + +#endif /* dwarf.h */ diff --git a/elfutils/libdw/dwarf_begin.c b/elfutils/libdw/dwarf_begin.c new file mode 100644 index 0000000..946ef2d --- /dev/null +++ b/elfutils/libdw/dwarf_begin.c @@ -0,0 +1,83 @@ +/* Create descriptor from file descriptor for processing file. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + + +Dwarf * +dwarf_begin (fd, cmd) + int fd; + Dwarf_Cmd cmd; +{ + Elf *elf; + Elf_Cmd elfcmd; + Dwarf *result = NULL; + + switch (cmd) + { + case DWARF_C_READ: + elfcmd = ELF_C_READ_MMAP; + break; + case DWARF_C_WRITE: + elfcmd = ELF_C_WRITE; + break; + case DWARF_C_RDWR: + elfcmd = ELF_C_RDWR; + break; + default: + /* No valid mode. */ + __libdwarf_seterrno (DWARF_E_INVALID_ACCESS); + return NULL; + } + + /* We have to call `elf_version' here since the user might have not + done it or initialized libelf with a different version. This + would break libdwarf since we are using the ELF data structures + in a certain way. */ + elf_version (EV_CURRENT); + + /* Get an ELF descriptor. */ + elf = elf_begin (fd, elfcmd, NULL); + if (elf == NULL) + { + /* Test why the `elf_begin" call failed. */ + struct stat64 st; + + if (fstat64 (fd, &st) == 0 && ! S_ISREG (st.st_mode)) + __libdwarf_seterrno (DWARF_E_NO_REGFILE); + else + __libdwarf_seterrno (DWARF_E_IO_ERROR); + } + else + { + /* Do the real work now that we have an ELF descriptor. */ + result = dwarf_begin_elf (elf, cmd, NULL); + + /* If this failed, free the resources. */ + if (result == NULL) + elf_end (elf); + } + + return result; +} diff --git a/elfutils/libdw/dwarf_begin_elf.c b/elfutils/libdw/dwarf_begin_elf.c new file mode 100644 index 0000000..7523aa2 --- /dev/null +++ b/elfutils/libdw/dwarf_begin_elf.c @@ -0,0 +1,241 @@ +/* Create descriptor from ELF descriptor for processing file. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include "libdwP.h" + + +/* Section names. */ +static const char dwarf_scnnames[IDX_last][17] = +{ + [IDX_debug_info] = ".debug_info", + [IDX_debug_abbrev] = ".debug_abbrev", + [IDX_debug_aranges] = ".debug_aranges", + [IDX_debug_line] = ".debug_line", + [IDX_debug_frame] = ".debug_frame", + [IDX_eh_frame] = ".eh_frame", + [IDX_debug_loc] = ".debug_loc", + [IDX_debug_pubnames] = ".debug_pubnames", + [IDX_debug_str] = ".debug_str", + [IDX_debug_funcnames] = ".debug_funcnames", + [IDX_debug_typenames] = ".debug_typenames", + [IDX_debug_varnames] = ".debug_varnames", + [IDX_debug_weaknames] = ".debug_weaknames", + [IDX_debug_macinfo] = ".debug_macinfo" +}; +#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0])) + + +static void +check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) +{ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + /* Get the section header data. */ + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + /* This should never happen. If it does something is + wrong in the libelf library. */ + abort (); + + + /* Make sure the section is part of a section group only iff we + really need it. If we are looking for the global (= non-section + group debug info) we have to ignore all the info in section + groups. If we are looking into a section group we cannot look at + a section which isn't part of the section group. */ + if (! inscngrp && (shdr->sh_flags & SHF_GROUP) != 0) + /* Ignore the section. */ + return; + + + /* We recognize the DWARF section by their names. This is not very + safe and stable but the best we can do. */ + const char *scnname = elf_strptr (result->elf, ehdr->e_shstrndx, + shdr->sh_name); + if (scnname == NULL) + { + /* The section name must be valid. Otherwise is the ELF file + invalid. */ + __libdwarf_seterrno (DWARF_E_INVALID_ELF); + free (result); + return; + } + + + /* Recognize the various sections. Most names start with .debug_. */ + int cnt; + for (cnt = 0; cnt < ndwarf_scnnames; ++cnt) + if (strcmp (scnname, dwarf_scnnames[cnt]) == 0) + { + /* Found it. Remember where the data is. */ + if (unlikely (result->sectiondata[cnt] != NULL)) + /* A section appears twice. That's bad. We ignore the section. */ + break; + + /* Get the section data. */ + Elf_Data *data = elf_getdata (scn, NULL); + if (data != NULL && data->d_size != 0) + /* Yep, there is actually data available. */ + result->sectiondata[cnt] = data; + + break; + } +} + + +/* Check whether all the necessary DWARF information is available. */ +static Dwarf * +valid_p (Dwarf *result) +{ + /* We looked at all the sections. Now determine whether all the + sections with debugging information we need are there. + + XXX Which sections are absolutely necessary? Add tests if + necessary. For now we require only .debug_info. Hopefully this + is correct. */ + if (unlikely (result->sectiondata[IDX_debug_info] == NULL)) + { + __libdwarf_seterrno (DWARF_E_NO_DWARF); + result = NULL; + } + + return result; +} + + +static Dwarf * +global_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd) +{ + Elf_Scn *scn = NULL; + + while ((scn = elf_nextscn (elf, scn)) != NULL) + check_section (result, ehdr, scn, false); + + return valid_p (result); +} + + +static Dwarf * +scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd, + Elf_Scn *scngrp) +{ + /* SCNGRP is the section descriptor for a section group which might + contain debug sections. */ + Elf_Data *data = elf_getdata (scngrp, NULL); + if (data == NULL) + { + /* We cannot read the section content. Fail! */ + free (result); + return NULL; + } + + /* The content of the section is a number of 32-bit words which + represent section indices. The first word is a flag word. */ + Elf32_Word *scnidx = (Elf32_Word *) data->d_buf; + size_t cnt; + for (cnt = 1; cnt * sizeof (Elf32_Word) <= data->d_size; ++cnt) + { + Elf_Scn *scn = elf_getscn (elf, scnidx[cnt]); + if (scn == NULL) + { + /* A section group refers to a non-existing section. Should + never happen. */ + __libdwarf_seterrno (DWARF_E_INVALID_ELF); + free (result); + return NULL; + } + + check_section (result, ehdr, scn, true); + } + + return valid_p (result); +} + + +Dwarf * +dwarf_begin_elf (elf, cmd, scngrp) + Elf *elf; + Dwarf_Cmd cmd; + Elf_Scn *scngrp; +{ + GElf_Ehdr *ehdr; + GElf_Ehdr ehdr_mem; + + /* Get the ELF header of the file. We need various pieces of + information from it. */ + ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + if (elf_kind (elf) != ELF_K_ELF) + __libdwarf_seterrno (DWARF_E_NOELF); + else + __libdwarf_seterrno (DWARF_E_GETEHDR_ERROR); + + return NULL; + } + + + /* Allocate the data structure. */ + Dwarf *result = (Dwarf *) calloc (1, sizeof (Dwarf)); + if (result == NULL) + { + __libdwarf_seterrno (DWARF_E_NOMEM); + return NULL; + } + + /* Fill in some values. */ + if ((BYTE_ORDER == LITTLE_ENDIAN && ehdr->e_ident[EI_DATA] == ELFDATA2MSB) + || (BYTE_ORDER == BIG_ENDIAN && ehdr->e_ident[EI_DATA] == ELFDATA2LSB)) + result->other_byte_order = true; + + result->elf = elf; + + + if (cmd == DWARF_C_READ || cmd == DWARF_C_RDWR) + { + /* If the caller provides a section group we get the DWARF + sections only from this setion group. Otherwise we search + for the first section with the required name. Further + sections with the name are ignored. The DWARF specification + does not really say this is allowed. */ + if (scngrp == NULL) + return global_read (result, elf, ehdr, cmd); + else + return scngrp_read (result, elf, ehdr, cmd, scngrp); + } + else if (cmd == DWARF_C_WRITE) + { + __libdwarf_seterrno (DWARF_E_UNIMPL); + free (result); + return NULL; + } + + __libdwarf_seterrno (DWARF_E_INVALIDCMD); + free (result); + return NULL; +} diff --git a/elfutils/libdw/dwarf_end.c b/elfutils/libdw/dwarf_end.c new file mode 100644 index 0000000..e04c6f3 --- /dev/null +++ b/elfutils/libdw/dwarf_end.c @@ -0,0 +1,36 @@ +/* Release debugging handling context. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "libdwP.h" + + +int +dwarf_end (dwarf) + Dwarf *dwarf; +{ + if (dwarf != NULL) + /* Free the context descriptor. */ + free (dwarf); + + return 0; +} diff --git a/elfutils/libdw/dwarf_error.c b/elfutils/libdw/dwarf_error.c new file mode 100644 index 0000000..850f5bb --- /dev/null +++ b/elfutils/libdw/dwarf_error.c @@ -0,0 +1,73 @@ +/* Retrieve ELF descriptor used for DWARF access. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "libdwP.h" + + +/* This is the key for the thread specific memory. */ +static tls_key_t key; + +/* The error number. Used in non-threaded programs. */ +static int global_error; +static bool threaded; +/* We need to initialize the thread-specific data. */ +once_define (static, once); + +/* The initialization and destruction functions. */ +static void init (void); +static void free_key_mem (void *mem); + + + +void +__libdwarf_seterrno (value) + int value; +{ + /* If we have not yet initialized the buffer do it now. */ + once_execute (once, init); + + if (threaded) + /* We do not allocate memory for the data. It is only a word. + We can store it in place of the pointer. */ + setspecific (key, (void *) (intptr_t) value); + + global_error = value; +} + + +/* Free the thread specific data, this is done if a thread terminates. */ +static void +free_key_mem (void *mem) +{ + setspecific (key, NULL); +} + + +/* Initialize the key for the global variable. */ +static void +init (void) +{ + if (key_create (&key, free_key_mem) == 0) + /* Creating the key succeeded. */ + threaded = true; +} diff --git a/elfutils/libdw/dwarf_get_elf.c b/elfutils/libdw/dwarf_get_elf.c new file mode 100644 index 0000000..ee06c82 --- /dev/null +++ b/elfutils/libdw/dwarf_get_elf.c @@ -0,0 +1,36 @@ +/* Retrieve ELF descriptor used for DWARF access. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "libdwP.h" + + +Elf * +dwarf_get_elf (dwarf) + Dwarf *dwarf; +{ + if (dwarf == NULL) + /* Some error occurred before. */ + return NULL; + + return dwarf->elf; +} diff --git a/elfutils/libdw/libdw.h b/elfutils/libdw/libdw.h new file mode 100644 index 0000000..fef61e9 --- /dev/null +++ b/elfutils/libdw/libdw.h @@ -0,0 +1,55 @@ +/* Interfaces for libdw. + Copyright (C) 2002 Red Hat, Inc. + Contributed by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifndef _LIBDW_H +#define _LIBDW_H 1 + +#include + + +/* Mode for the session. */ +typedef enum + { + DWARF_C_READ, /* Read .. */ + DWARF_C_RDWR, /* Read and write .. */ + DWARF_C_WRITE, /* Write .. */ + } +Dwarf_Cmd; + + +/* Type for offset in DWARF file. */ +typedef GElf_Off Dwarf_Off; + +/* Handle for debug sessions. */ +typedef struct Dwarf Dwarf; + + +/* Create a handle for a new debug session. */ +extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd); + +/* Create a handle for a new debug session for an ELF file. */ +extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp); + +/* Retrieve ELF descriptor used for DWARF access. */ +extern Elf *dwarf_get_elf (Dwarf *dwarf); + + +/* Get the data block for the .debug_info section. */ +extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf); + +/* Read the header for the DWARF CU header. */ +extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off, + size_t header_size); + +#endif /* libdw.h */ diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map new file mode 100644 index 0000000..971af69 --- /dev/null +++ b/elfutils/libdw/libdw.map @@ -0,0 +1,12 @@ +ELFUTILS_1.0 { + global: + dwarf_begin; + dwarf_begin_elf; + dwarf_end; + dwarf_get_elf; + dwarf_getscn_info; + dwarf_nextcu; + + local: + *; +}; diff --git a/elfutils/libdw/libdwP.h b/elfutils/libdw/libdwP.h new file mode 100644 index 0000000..161501b --- /dev/null +++ b/elfutils/libdw/libdwP.h @@ -0,0 +1,84 @@ +/* Internal definitions for libdwarf. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _LIBDWP_H +#define _LIBDWP_H 1 + +#include + +#include + + +/* Valid indeces for the section data. */ +enum + { + IDX_debug_info = 0, + IDX_debug_abbrev, + IDX_debug_aranges, + IDX_debug_line, + IDX_debug_frame, + IDX_eh_frame, + IDX_debug_loc, + IDX_debug_pubnames, + IDX_debug_str, + IDX_debug_funcnames, + IDX_debug_typenames, + IDX_debug_varnames, + IDX_debug_weaknames, + IDX_debug_macinfo, + IDX_last + }; + + +/* Error values. */ +enum +{ + DWARF_E_NOERROR = 0, + DWARF_E_INVALID_ACCESS, + DWARF_E_NO_REGFILE, + DWARF_E_IO_ERROR, + DWARF_E_INVALID_ELF, + DWARF_E_NO_DWARF, + DWARF_E_NOELF, + DWARF_E_GETEHDR_ERROR, + DWARF_E_NOMEM, + DWARF_E_UNIMPL, + DWARF_E_INVALIDCMD, +}; + + +/* This is the structure representing the debugging state. */ +struct Dwarf +{ + /* The underlying ELF file. */ + Elf *elf; + + /* The section data. */ + Elf_Data *sectiondata[IDX_last]; + + /* True if the file has a byte order different from the host. */ + bool other_byte_order; +}; + + + + +/* Set error value. */ +extern void __libdwarf_seterrno (int value) internal_function; + + +#endif /* libdwP.h */ diff --git a/elfutils/libdw/memory-access.h b/elfutils/libdw/memory-access.h new file mode 100644 index 0000000..0e7071f --- /dev/null +++ b/elfutils/libdw/memory-access.h @@ -0,0 +1,210 @@ +/* Unaligned memory access functionality. + Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2000. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _MEMORY_ACCESS_H +#define _MEMORY_ACCESS_H 1 + +#include +#include + + +/* Number decoding macros. See 7.6 Variable Length Data. */ +#define get_uleb128(var, addr) \ + do { \ + Dwarf_Small __b = *addr++; \ + var = __b & 0x7f; \ + if (__b & 0x80) \ + { \ + __b = *addr++; \ + var |= (__b & 0x7f) << 7; \ + if (__b & 0x80) \ + { \ + __b = *addr++; \ + var |= (__b & 0x7f) << 14; \ + if (__b & 0x80) \ + { \ + __b = *addr++; \ + var |= (__b & 0x7f) << 21; \ + if (__b & 0x80) \ + /* Other implementation set VALUE to UINT_MAX in this \ + case. So we better do this as well. */ \ + var = UINT_MAX; \ + } \ + } \ + } \ + } while (0) + +/* The signed case is a big more complicated. */ +#define get_sleb128(var, addr) \ + do { \ + Dwarf_Small __b = *addr++; \ + int32_t __res = __b & 0x7f; \ + if ((__b & 0x80) == 0) \ + { \ + if (__b & 0x40) \ + __res |= 0xffffff80; \ + } \ + else \ + { \ + __b = *addr++; \ + __res |= (__b & 0x7f) << 7; \ + if ((__b & 0x80) == 0) \ + { \ + if (__b & 0x40) \ + __res |= 0xffffc000; \ + } \ + else \ + { \ + __b = *addr++; \ + __res |= (__b & 0x7f) << 14; \ + if ((__b & 0x80) == 0) \ + { \ + if (__b & 0x40) \ + __res |= 0xffe00000; \ + } \ + else \ + { \ + __b = *addr++; \ + __res |= (__b & 0x7f) << 21; \ + if ((__b & 0x80) == 0) \ + { \ + if (__b & 0x40) \ + __res |= 0xf0000000; \ + } \ + else \ + /* Other implementation set VALUE to INT_MAX in this \ + case. So we better do this as well. */ \ + __res = INT_MAX; \ + } \ + } \ + } \ + var = __res; \ + } while (0) + + +/* We use simple memory access functions in case the hardware allows it. + The caller has to make sure we don't have alias problems. */ +#if ALLOW_UNALIGNED + +# define read_2ubyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? bswap_16 (*((uint16_t *) (Addr))) \ + : *((uint16_t *) (Addr))) +# define read_2sbyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? (int16_t) bswap_16 (*((int16_t *) (Addr))) \ + : *((int16_t *) (Addr))) + +# define read_4ubyte_unaligned_noncvt(Addr) \ + *((uint32_t *) (Addr)) +# define read_4ubyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? bswap_32 (*((uint32_t *) (Addr))) \ + : *((uint32_t *) (Addr))) +# define read_4sbyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? (int32_t) bswap_32 (*((int32_t *) (Addr))) \ + : *((int32_t *) (Addr))) + +# define read_8ubyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? bswap_64 (*((uint64_t *) (Addr))) \ + : *((uint64_t *) (Addr))) +# define read_8sbyte_unaligned(Dbg, Addr) \ + ((Dbg)->other_byte_order \ + ? (int64_t) bswap_64 (*((int64_t *) (Addr))) \ + : *((int64_t *) (Addr))) + +#else + +# if __GNUC__ + +union unaligned + { + void *p; + uint16_t u2; + uint32_t u4; + uint64_t u8; + int16_t s2; + int32_t s4; + int64_t s8; + } __attribute__ ((packed)); + +static inline uint16_t +read_2ubyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return bswap_16 (up->u2); + return up->u2; +} +static inline int16_t +read_2sbyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return (int16_t) bswap_16 (up->u2); + return up->s2; +} + +static inline uint32_t +read_4ubyte_unaligned_noncvt (void *p) +{ + union unaligned *up = p; + return up->u4; +} +static inline uint32_t +read_4ubyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return bswap_32 (up->u4); + return up->u4; +} +static inline int32_t +read_4sbyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return (int32_t) bswap_32 (up->u4); + return up->s4; +} + +static inline uint64_t +read_8ubyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return bswap_64 (up->u8); + return up->u8; +} +static inline int64_t +read_8sbyte_unaligned (Dwarf_Debug dbg, void *p) +{ + union unaligned *up = p; + if (dbg->other_byte_order) + return (int64_t) bswap_64 (up->u8); + return up->s8; +} + +# else +# error "TODO" +# endif + +#endif + +#endif /* memory-access.h */ diff --git a/elfutils/libebl/alpha_destr.c b/elfutils/libebl/alpha_destr.c new file mode 100644 index 0000000..c599d59 --- /dev/null +++ b/elfutils/libebl/alpha_destr.c @@ -0,0 +1,27 @@ +/* Destructor for Alpha specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +void +alpha_destr (bh) + Ebl *bh; +{ + /* Nothing to do so far. */ +} diff --git a/elfutils/libebl/alpha_init.c b/elfutils/libebl/alpha_init.c new file mode 100644 index 0000000..b688bb7 --- /dev/null +++ b/elfutils/libebl/alpha_init.c @@ -0,0 +1,40 @@ +/* Initialization of Alpha specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +int +alpha_init (elf, machine, eh, ehlen) + Elf *elf; + GElf_Half machine; + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return 1; + + /* We handle it. */ + eh->name = "Alpha"; + eh->reloc_type_name = alpha_reloc_type_name; + eh->reloc_type_check = alpha_reloc_type_check; + eh->destr = alpha_destr; + + return 0; +} diff --git a/elfutils/libebl/alpha_symbol.c b/elfutils/libebl/alpha_symbol.c new file mode 100644 index 0000000..9699c2e --- /dev/null +++ b/elfutils/libebl/alpha_symbol.c @@ -0,0 +1,91 @@ +/* Alpha specific symbolic name handling. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + + +/* Return of the backend. */ +const char * +alpha_backend_name (void) +{ + return "alpha"; +} + + +/* Relocation mapping table. */ +static const char *reloc_map_table[] = + { + [R_ALPHA_NONE] = "R_ALPHA_NONE", + [R_ALPHA_REFLONG] = "R_ALPHA_REFLONG", + [R_ALPHA_REFQUAD] = "R_ALPHA_REFQUAD", + [R_ALPHA_GPREL32] = "R_ALPHA_GPREL32", + [R_ALPHA_LITERAL] = "R_ALPHA_LITERAL", + [R_ALPHA_LITUSE] = "R_ALPHA_LITUSE", + [R_ALPHA_GPDISP] = "R_ALPHA_GPDISP", + [R_ALPHA_BRADDR] = "R_ALPHA_BRADDR", + [R_ALPHA_HINT] = "R_ALPHA_HINT", + [R_ALPHA_SREL16] = "R_ALPHA_SREL16", + [R_ALPHA_SREL32] = "R_ALPHA_SREL32", + [R_ALPHA_SREL64] = "R_ALPHA_SREL64", + [R_ALPHA_GPRELHIGH] = "R_ALPHA_GPRELHIGH", + [R_ALPHA_GPRELLOW] = "R_ALPHA_GPRELLOW", + [R_ALPHA_GPREL16] = "R_ALPHA_GPREL16", + [R_ALPHA_COPY] = "R_ALPHA_COPY", + [R_ALPHA_GLOB_DAT] = "R_ALPHA_GLOB_DAT", + [R_ALPHA_JMP_SLOT] = "R_ALPHA_JMP_SLOT", + [R_ALPHA_RELATIVE] = "R_ALPHA_RELATIVE", + [R_ALPHA_TLS_GD_HI] = "R_ALPHA_TLS_GD_HI", + [R_ALPHA_TLSGD] = "R_ALPHA_TLSGD", + [R_ALPHA_TLS_LDM] = "R_ALPHA_TLS_LDM", + [R_ALPHA_DTPMOD64] = "R_ALPHA_DTPMOD64", + [R_ALPHA_GOTDTPREL] = "R_ALPHA_GOTDTPREL", + [R_ALPHA_DTPREL64] = "R_ALPHA_DTPREL64", + [R_ALPHA_DTPRELHI] = "R_ALPHA_DTPRELHI", + [R_ALPHA_DTPRELLO] = "R_ALPHA_DTPRELLO", + [R_ALPHA_DTPREL16] = "R_ALPHA_DTPREL16", + [R_ALPHA_GOTTPREL] = "R_ALPHA_GOTTPREL", + [R_ALPHA_TPREL64] = "R_ALPHA_TPREL64", + [R_ALPHA_TPRELHI] = "R_ALPHA_TPRELHI", + [R_ALPHA_TPRELLO] = "R_ALPHA_TPRELLO", + [R_ALPHA_TPREL16] = "R_ALPHA_TPREL16" + }; + + +/* Determine relocation type string for Alpha. */ +const char * +alpha_reloc_type_name (int type, char *buf, size_t len) +{ + if (type < 0 + || type >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0])) + return NULL; + + return reloc_map_table[type]; +} + + +/* Check for correct relocation type. */ +bool +alpha_reloc_type_check (int type) +{ + return (type >= R_ALPHA_NONE + && type < sizeof (reloc_map_table) / sizeof (reloc_map_table[0]) + && reloc_map_table[type] != NULL) ? true : false; +} diff --git a/elfutils/libebl/arm_destr.c b/elfutils/libebl/arm_destr.c new file mode 100644 index 0000000..3851240 --- /dev/null +++ b/elfutils/libebl/arm_destr.c @@ -0,0 +1,27 @@ +/* Destructor for Arm specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +void +arm_destr (bh) + Ebl *bh; +{ + /* Nothing to do so far. */ +} diff --git a/elfutils/libebl/arm_init.c b/elfutils/libebl/arm_init.c new file mode 100644 index 0000000..3dee75a --- /dev/null +++ b/elfutils/libebl/arm_init.c @@ -0,0 +1,40 @@ +/* Initialization of Arm specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +int +arm_init (elf, machine, eh, ehlen) + Elf *elf; + GElf_Half machine; + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return 1; + + /* We handle it. */ + eh->name = "Arm"; + eh->reloc_type_name = arm_reloc_type_name; + eh->reloc_type_check = arm_reloc_type_check; + eh->destr = arm_destr; + + return 0; +} diff --git a/elfutils/libebl/arm_symbol.c b/elfutils/libebl/arm_symbol.c new file mode 100644 index 0000000..224beea --- /dev/null +++ b/elfutils/libebl/arm_symbol.c @@ -0,0 +1,113 @@ +/* Arm specific symbolic name handling. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + + +/* Return of the backend. */ +const char * +arm_backend_name (void) +{ + return "arm"; +} + + +/* Relocation mapping table. */ +static const char *reloc_map_table[] = + { + [R_ARM_NONE] = "R_ARM_NONE", + [R_ARM_PC24] = "R_ARM_PC24", + [R_ARM_ABS32] = "R_ARM_ABS32", + [R_ARM_REL32] = "R_ARM_REL32", + [R_ARM_PC13] = "R_ARM_PC13", + [R_ARM_ABS16] = "R_ARM_ABS16", + [R_ARM_ABS12] = "R_ARM_ABS12", + [R_ARM_THM_ABS5] = "R_ARM_THM_ABS5", + [R_ARM_ABS8] = "R_ARM_ABS8", + [R_ARM_SBREL32] = "R_ARM_SBREL32", + [R_ARM_THM_PC22] = "R_ARM_THM_PC22", + [R_ARM_THM_PC8] = "R_ARM_THM_PC8", + [R_ARM_AMP_VCALL9] = "R_ARM_AMP_VCALL9", + [R_ARM_SWI24] = "R_ARM_SWI24", + [R_ARM_THM_SWI8] = "R_ARM_THM_SWI8", + [R_ARM_XPC25] = "R_ARM_XPC25", + [R_ARM_THM_XPC22] = "R_ARM_THM_XPC22", + [R_ARM_COPY] = "R_ARM_COPY", + [R_ARM_GLOB_DAT] = "R_ARM_GLOB_DAT", + [R_ARM_JUMP_SLOT] = "R_ARM_JUMP_SLOT", + [R_ARM_RELATIVE] = "R_ARM_RELATIVE", + [R_ARM_GOTOFF] = "R_ARM_GOTOFF", + [R_ARM_GOTPC] = "R_ARM_GOTPC", + [R_ARM_GOT32] = "R_ARM_GOT32", + [R_ARM_PLT32] = "R_ARM_PLT32", + [R_ARM_ALU_PCREL_7_0] = "R_ARM_ALU_PCREL_7_0", + [R_ARM_ALU_PCREL_15_8] = "R_ARM_ALU_PCREL_15_8", + [R_ARM_ALU_PCREL_23_15] = "R_ARM_ALU_PCREL_23_15", + [R_ARM_LDR_SBREL_11_0] = "R_ARM_LDR_SBREL_11_0", + [R_ARM_ALU_SBREL_19_12] = "R_ARM_ALU_SBREL_19_12", + [R_ARM_ALU_SBREL_27_20] = "R_ARM_ALU_SBREL_27_20" + }; + +static const char *reloc_map_table2[] = + { + [R_ARM_GNU_VTENTRY] = "R_ARM_GNU_VTENTRY", + [R_ARM_GNU_VTINHERIT] = "R_ARM_GNU_VTINHERIT", + [R_ARM_THM_PC11] = "R_ARM_THM_PC11", + [R_ARM_THM_PC9] = "R_ARM_THM_PC9" + }; + +static const char *reloc_map_table3[] = + { + [R_ARM_RXPC25] = "R_ARM_RXPC25", + [R_ARM_RSBREL32] = "R_ARM_RSBREL32", + [R_ARM_THM_RPC22] = "R_ARM_THM_RPC22", + [R_ARM_RREL32] = "R_ARM_RREL32", + [R_ARM_RABS22] = "R_ARM_RABS22", + [R_ARM_RPC24] = "R_ARM_RPC24", + [R_ARM_RBASE] = "R_ARM_RBASE" + }; + + +/* Determine relocation type string for Alpha. */ +const char * +arm_reloc_type_name (int type, char *buf, size_t len) +{ + if (type >= R_ARM_NONE && type <= R_ARM_ALU_SBREL_27_20) + return reloc_map_table[type]; + + if (type >= R_ARM_GNU_VTENTRY && type <= R_ARM_THM_PC9) + return reloc_map_table2[type - R_ARM_GNU_VTENTRY]; + + if (type >= R_ARM_RXPC25 && type <= R_ARM_RBASE) + return reloc_map_table3[type - R_ARM_RXPC25]; + + return NULL; +} + + +/* Check for correct relocation type. */ +bool +arm_reloc_type_check (int type) +{ + return ((type >= R_ARM_NONE && type <= R_ARM_ALU_SBREL_27_20) + || (type >= R_ARM_GNU_VTENTRY && type <= R_ARM_THM_PC9) + || (type >= R_ARM_RXPC25 && type <= R_ARM_RBASE)) ? true : false; +} diff --git a/elfutils/libebl/ia64_destr.c b/elfutils/libebl/ia64_destr.c new file mode 100644 index 0000000..a48302c --- /dev/null +++ b/elfutils/libebl/ia64_destr.c @@ -0,0 +1,27 @@ +/* Destructor for IA-64 specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +void +ia64_destr (bh) + Ebl *bh; +{ + /* Nothing to do so far. */ +} diff --git a/elfutils/libebl/ia64_init.c b/elfutils/libebl/ia64_init.c new file mode 100644 index 0000000..2c443a3 --- /dev/null +++ b/elfutils/libebl/ia64_init.c @@ -0,0 +1,40 @@ +/* Initialization of IA-64 specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +int +ia64_init (elf, machine, eh, ehlen) + Elf *elf; + GElf_Half machine; + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return 1; + + /* We handle it. */ + eh->name = "Intel IA-64"; + eh->reloc_type_name = ia64_reloc_type_name; + eh->reloc_type_check = ia64_reloc_type_check; + eh->destr = ia64_destr; + + return 0; +} diff --git a/elfutils/libebl/ia64_symbol.c b/elfutils/libebl/ia64_symbol.c new file mode 100644 index 0000000..410af13 --- /dev/null +++ b/elfutils/libebl/ia64_symbol.c @@ -0,0 +1,139 @@ +/* IA-64 specific symbolic name handling. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 2002. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + + +/* Return of the backend. */ +const char * +ia64_backend_name (void) +{ + return "ia64"; +} + + +/* Relocation mapping table. */ +static const char *reloc_map_table[] = + { + [R_IA64_NONE] = "R_IA64_NONE", + [R_IA64_IMM14] = "R_IA64_IMM14", + [R_IA64_IMM22] = "R_IA64_IMM22", + [R_IA64_IMM64] = "R_IA64_IMM64", + [R_IA64_DIR32MSB] = "R_IA64_DIR32MSB", + [R_IA64_DIR32LSB] = "R_IA64_DIR32LSB", + [R_IA64_DIR64MSB] = "R_IA64_DIR64MSB", + [R_IA64_DIR64LSB] = "R_IA64_DIR64LSB", + [R_IA64_GPREL22] = "R_IA64_GPREL22", + [R_IA64_GPREL64I] = "R_IA64_GPREL64I", + [R_IA64_GPREL32MSB] = "R_IA64_GPREL32MSB", + [R_IA64_GPREL32LSB] = "R_IA64_GPREL32LSB", + [R_IA64_GPREL64MSB] = "R_IA64_GPREL64MSB", + [R_IA64_GPREL64LSB] = "R_IA64_GPREL64LSB", + [R_IA64_LTOFF22] = "R_IA64_LTOFF22", + [R_IA64_LTOFF64I] = "R_IA64_LTOFF64I", + [R_IA64_PLTOFF22] = "R_IA64_PLTOFF22", + [R_IA64_PLTOFF64I] = "R_IA64_PLTOFF64I", + [R_IA64_PLTOFF64MSB] = "R_IA64_PLTOFF64MSB", + [R_IA64_PLTOFF64LSB] = "R_IA64_PLTOFF64LSB", + [R_IA64_FPTR64I] = "R_IA64_FPTR64I", + [R_IA64_FPTR32MSB] = "R_IA64_FPTR32MSB", + [R_IA64_FPTR32LSB] = "R_IA64_FPTR32LSB", + [R_IA64_FPTR64MSB] = "R_IA64_FPTR64MSB", + [R_IA64_FPTR64LSB] = "R_IA64_FPTR64LSB", + [R_IA64_PCREL60B] = "R_IA64_PCREL60B", + [R_IA64_PCREL21B] = "R_IA64_PCREL21B", + [R_IA64_PCREL21M] = "R_IA64_PCREL21M", + [R_IA64_PCREL21F] = "R_IA64_PCREL21F", + [R_IA64_PCREL32MSB] = "R_IA64_PCREL32MSB", + [R_IA64_PCREL32LSB] = "R_IA64_PCREL32LSB", + [R_IA64_PCREL64MSB] = "R_IA64_PCREL64MSB", + [R_IA64_PCREL64LSB] = "R_IA64_PCREL64LSB", + [R_IA64_LTOFF_FPTR22] = "R_IA64_LTOFF_FPTR22", + [R_IA64_LTOFF_FPTR64I] = "R_IA64_LTOFF_FPTR64I", + [R_IA64_LTOFF_FPTR32MSB] = "R_IA64_LTOFF_FPTR32MSB", + [R_IA64_LTOFF_FPTR32LSB] = "R_IA64_LTOFF_FPTR32LSB", + [R_IA64_LTOFF_FPTR64MSB] = "R_IA64_LTOFF_FPTR64MSB", + [R_IA64_LTOFF_FPTR64LSB] = "R_IA64_LTOFF_FPTR64LSB", + [R_IA64_SEGREL32MSB] = "R_IA64_SEGREL32MSB", + [R_IA64_SEGREL32LSB] = "R_IA64_SEGREL32LSB", + [R_IA64_SEGREL64MSB] = "R_IA64_SEGREL64MSB", + [R_IA64_SEGREL64LSB] = "R_IA64_SEGREL64LSB", + [R_IA64_SECREL32MSB] = "R_IA64_SECREL32MSB", + [R_IA64_SECREL32LSB] = "R_IA64_SECREL32LSB", + [R_IA64_SECREL64MSB] = "R_IA64_SECREL64MSB", + [R_IA64_SECREL64LSB] = "R_IA64_SECREL64LSB", + [R_IA64_REL32MSB] = "R_IA64_REL32MSB", + [R_IA64_REL32LSB] = "R_IA64_REL32LSB", + [R_IA64_REL64MSB] = "R_IA64_REL64MSB", + [R_IA64_REL64LSB] = "R_IA64_REL64LSB", + [R_IA64_LTV32MSB] = "R_IA64_LTV32MSB", + [R_IA64_LTV32LSB] = "R_IA64_LTV32LSB", + [R_IA64_LTV64MSB] = "R_IA64_LTV64MSB", + [R_IA64_LTV64LSB] = "R_IA64_LTV64LSB", + [R_IA64_PCREL21BI] = "R_IA64_PCREL21BI", + [R_IA64_PCREL22] = "R_IA64_PCREL22", + [R_IA64_PCREL64I] = "R_IA64_PCREL64I", + [R_IA64_IPLTMSB] = "R_IA64_IPLTMSB", + [R_IA64_IPLTLSB] = "R_IA64_IPLTLSB", + [R_IA64_COPY] = "R_IA64_COPY", + [R_IA64_SUB] = "R_IA64_SUB", + [R_IA64_LTOFF22X] = "R_IA64_LTOFF22X", + [R_IA64_LDXMOV] = "R_IA64_LDXMOV", + [R_IA64_TPREL14] = "R_IA64_TPREL14", + [R_IA64_TPREL22] = "R_IA64_TPREL22", + [R_IA64_TPREL64I] = "R_IA64_TPREL64I", + [R_IA64_TPREL64MSB] = "R_IA64_TPREL64MSB", + [R_IA64_TPREL64LSB] = "R_IA64_TPREL64LSB", + [R_IA64_LTOFF_TPREL22] = "R_IA64_LTOFF_TPREL22", + [R_IA64_DTPMOD64MSB] = "R_IA64_DTPMOD64MSB", + [R_IA64_DTPMOD64LSB] = "R_IA64_DTPMOD64LSB", + [R_IA64_LTOFF_DTPMOD22] = "R_IA64_LTOFF_DTPMOD22", + [R_IA64_DTPREL14] = "R_IA64_DTPREL14", + [R_IA64_DTPREL22] = "R_IA64_DTPREL22", + [R_IA64_DTPREL64I] = "R_IA64_DTPREL64I", + [R_IA64_DTPREL32MSB] = "R_IA64_DTPREL32MSB", + [R_IA64_DTPREL32LSB] = "R_IA64_DTPREL32LSB", + [R_IA64_DTPREL64MSB] = "R_IA64_DTPREL64MSB", + [R_IA64_DTPREL64LSB] = "R_IA64_DTPREL64LSB", + [R_IA64_LTOFF_DTPREL22] = "R_IA64_LTOFF_DTPREL22" + }; + + +/* Determine relocation type string for IA-64. */ +const char * +ia64_reloc_type_name (int type, char *buf, size_t len) +{ + if (type < 0 + || type >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0])) + return NULL; + + return reloc_map_table[type]; +} + + +/* Check for correct relocation type. */ +bool +ia64_reloc_type_check (int type) +{ + return (type >= R_IA64_NONE + && type < sizeof (reloc_map_table) / sizeof (reloc_map_table[0]) + && reloc_map_table[type] != NULL) ? true : false; +} diff --git a/elfutils/libebl/libebl_alpha.h b/elfutils/libebl/libebl_alpha.h new file mode 100644 index 0000000..36d7dad --- /dev/null +++ b/elfutils/libebl/libebl_alpha.h @@ -0,0 +1,33 @@ +/* Interface for libebl_alpha module. + Copyright (C) 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifndef _LIBEBL_ALPHA_H +#define _LIBEBL_ALPHA_H 1 + +#include + + +/* Constructor. */ +extern int alpha_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); + +/* Destructor. */ +extern void alpha_destr (Ebl *bh); + + +/* Function to get relocation type name. */ +extern const char *alpha_reloc_type_name (int type, char *buf, size_t len); + +/* Check relocation type. */ +extern bool alpha_reloc_type_check (int type); + +#endif /* libebl_alpha.h */ diff --git a/elfutils/libebl/libebl_alpha.map b/elfutils/libebl/libebl_alpha.map new file mode 100644 index 0000000..aa66ad7 --- /dev/null +++ b/elfutils/libebl/libebl_alpha.map @@ -0,0 +1,11 @@ +ELFUTILS_1.0 { + global: + alpha_backend_name; + alpha_destr; + alpha_init; + alpha_reloc_type_check; + alpha_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libebl/libebl_arm.h b/elfutils/libebl/libebl_arm.h new file mode 100644 index 0000000..8aade43 --- /dev/null +++ b/elfutils/libebl/libebl_arm.h @@ -0,0 +1,33 @@ +/* Interface for libebl_arm module. + Copyright (C) 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifndef _LIBEBL_ARM_H +#define _LIBEBL_ARM_H 1 + +#include + + +/* Constructor. */ +extern int arm_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); + +/* Destructor. */ +extern void arm_destr (Ebl *bh); + + +/* Function to get relocation type name. */ +extern const char *arm_reloc_type_name (int type, char *buf, size_t len); + +/* Check relocation type. */ +extern bool arm_reloc_type_check (int type); + +#endif /* libebl_arm.h */ diff --git a/elfutils/libebl/libebl_arm.map b/elfutils/libebl/libebl_arm.map new file mode 100644 index 0000000..d389526 --- /dev/null +++ b/elfutils/libebl/libebl_arm.map @@ -0,0 +1,11 @@ +ELFUTILS_1.0 { + global: + arm_backend_name; + arm_destr; + arm_init; + arm_reloc_type_check; + arm_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libebl/libebl_ia64.h b/elfutils/libebl/libebl_ia64.h new file mode 100644 index 0000000..56bbb9e --- /dev/null +++ b/elfutils/libebl/libebl_ia64.h @@ -0,0 +1,33 @@ +/* Interface for libebl_ia64 module. + Copyright (C) 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifndef _LIBEBL_IA64_H +#define _LIBEBL_IA64_H 1 + +#include + + +/* Constructor. */ +extern int ia64_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); + +/* Destructor. */ +extern void ia64_destr (Ebl *bh); + + +/* Function to get relocation type name. */ +extern const char *ia64_reloc_type_name (int type, char *buf, size_t len); + +/* Check relocation type. */ +extern bool ia64_reloc_type_check (int type); + +#endif /* libebl_ia64.h */ diff --git a/elfutils/libebl/libebl_ia64.map b/elfutils/libebl/libebl_ia64.map new file mode 100644 index 0000000..f67042c --- /dev/null +++ b/elfutils/libebl/libebl_ia64.map @@ -0,0 +1,11 @@ +ELFUTILS_1.0 { + global: + ia64_backend_name; + ia64_destr; + ia64_init; + ia64_reloc_type_check; + ia64_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libelf/libelf_crc32.c b/elfutils/libelf/libelf_crc32.c new file mode 100644 index 0000000..a89b9e9 --- /dev/null +++ b/elfutils/libelf/libelf_crc32.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#define crc32 attribute_hidden __libelf_crc32 +#define LIB_SYSTEM_H 1 +#include +#include "../lib/crc32.c" diff --git a/elfutils/libelf/libelf_next_prime.c b/elfutils/libelf/libelf_next_prime.c new file mode 100644 index 0000000..94b2a59 --- /dev/null +++ b/elfutils/libelf/libelf_next_prime.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2002 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#define next_prime attribute_hidden __libelf_next_prime +#include "../lib/next_prime.c" -- 2.7.4