summaryrefslogtreecommitdiffstats
path: root/src/libebl
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-02-15 12:34:33 -0800
committerElliott Hughes <enh@google.com>2015-02-15 16:11:56 -0800
commit41f677100e15f315f638774fbd055e497fc90069 (patch)
tree961dfef28571e02a7d969fbba9bb51991086476b /src/libebl
parentdb42bd18ad7a482e080e506f47121383e19274ef (diff)
downloadandroid_external_elfutils-41f677100e15f315f638774fbd055e497fc90069.tar.gz
android_external_elfutils-41f677100e15f315f638774fbd055e497fc90069.tar.bz2
android_external_elfutils-41f677100e15f315f638774fbd055e497fc90069.zip
Export elfutils headers and lose the version number from the path.
Having the version number in the path just means that diffs for updates are completely unusable. perf refers to libdw.h, libdwfl.h, and version.h as <elfutils/libdw.h> and so on, so we do still need to do some manual work there, but let's use symlinks rather than duplicating the header files. Change-Id: I9fd3c5f5024bde12747fdb1c06d21cdcb3418f03
Diffstat (limited to 'src/libebl')
-rwxr-xr-xsrc/libebl/Android.mk125
-rw-r--r--src/libebl/ChangeLog873
-rw-r--r--src/libebl/Makefile.am60
-rw-r--r--src/libebl/Makefile.in643
-rw-r--r--src/libebl/ebl-hooks.h179
-rw-r--r--src/libebl/ebl_check_special_section.c65
-rw-r--r--src/libebl/ebl_check_special_symbol.c70
-rw-r--r--src/libebl/ebl_syscall_abi.c66
-rw-r--r--src/libebl/eblabicfi.c63
-rw-r--r--src/libebl/eblauxvinfo.c124
-rw-r--r--src/libebl/eblbackendname.c64
-rw-r--r--src/libebl/eblbsspltp.c64
-rw-r--r--src/libebl/eblcheckobjattr.c81
-rw-r--r--src/libebl/eblclosebackend.c75
-rw-r--r--src/libebl/eblcopyrelocp.c64
-rw-r--r--src/libebl/eblcorenote.c107
-rw-r--r--src/libebl/eblcorenotetypename.c114
-rw-r--r--src/libebl/ebldebugscnp.c65
-rw-r--r--src/libebl/ebldynamictagcheck.c77
-rw-r--r--src/libebl/ebldynamictagname.c134
-rw-r--r--src/libebl/eblelfclass.c63
-rw-r--r--src/libebl/eblelfdata.c63
-rw-r--r--src/libebl/eblelfmachine.c63
-rw-r--r--src/libebl/eblgotpcreloccheck.c65
-rw-r--r--src/libebl/eblgstrtab.c386
-rw-r--r--src/libebl/eblmachineflagcheck.c64
-rw-r--r--src/libebl/eblmachineflagname.c112
-rw-r--r--src/libebl/eblmachinesectionflagcheck.c63
-rw-r--r--src/libebl/eblnonerelocp.c64
-rw-r--r--src/libebl/eblobjecttypename.c84
-rw-r--r--src/libebl/eblobjnote.c241
-rw-r--r--src/libebl/eblobjnotetypename.c101
-rw-r--r--src/libebl/eblopenbackend.c779
-rw-r--r--src/libebl/eblosabiname.c105
-rw-r--r--src/libebl/eblreginfo.c71
-rw-r--r--src/libebl/eblrelativerelocp.c64
-rw-r--r--src/libebl/eblrelocsimpletype.c63
-rw-r--r--src/libebl/eblreloctypecheck.c64
-rw-r--r--src/libebl/eblreloctypename.c74
-rw-r--r--src/libebl/eblrelocvaliduse.c64
-rw-r--r--src/libebl/eblretval.c65
-rw-r--r--src/libebl/eblsectionname.c117
-rw-r--r--src/libebl/eblsectionstripp.c88
-rw-r--r--src/libebl/eblsectiontypename.c148
-rw-r--r--src/libebl/eblsegmenttypename.c111
-rw-r--r--src/libebl/eblshflagscombine.c65
-rw-r--r--src/libebl/eblstother.c64
-rw-r--r--src/libebl/eblstrtab.c379
-rw-r--r--src/libebl/eblsymbolbindingname.c99
-rw-r--r--src/libebl/eblsymboltypename.c105
-rw-r--r--src/libebl/eblsysvhashentrysize.c63
-rw-r--r--src/libebl/eblwstrtab.c380
-rw-r--r--src/libebl/libebl.h404
-rw-r--r--src/libebl/libeblP.h103
54 files changed, 7957 insertions, 0 deletions
diff --git a/src/libebl/Android.mk b/src/libebl/Android.mk
new file mode 100755
index 00000000..2b94a37d
--- /dev/null
+++ b/src/libebl/Android.mk
@@ -0,0 +1,125 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+LIBEBL_SRC_FILES := \
+ eblabicfi.c \
+ eblauxvinfo.c \
+ eblbackendname.c \
+ eblbsspltp.c \
+ eblcheckobjattr.c \
+ ebl_check_special_section.c \
+ ebl_check_special_symbol.c \
+ eblclosebackend.c \
+ eblcopyrelocp.c \
+ eblcorenote.c \
+ eblcorenotetypename.c \
+ ebldebugscnp.c \
+ ebldynamictagcheck.c \
+ ebldynamictagname.c \
+ eblelfclass.c \
+ eblelfdata.c \
+ eblelfmachine.c \
+ eblgotpcreloccheck.c \
+ eblgstrtab.c \
+ eblmachineflagcheck.c \
+ eblmachineflagname.c \
+ eblmachinesectionflagcheck.c \
+ eblnonerelocp.c \
+ eblobjecttypename.c \
+ eblobjnote.c \
+ eblobjnotetypename.c \
+ eblopenbackend.c \
+ eblosabiname.c \
+ eblreginfo.c \
+ eblrelativerelocp.c \
+ eblrelocsimpletype.c \
+ eblreloctypecheck.c \
+ eblreloctypename.c \
+ eblrelocvaliduse.c \
+ eblretval.c \
+ eblsectionname.c \
+ eblsectionstripp.c \
+ eblsectiontypename.c \
+ eblshflagscombine.c \
+ eblstrtab.c \
+ eblsymbolbindingname.c \
+ eblsymboltypename.c \
+ ebl_syscall_abi.c \
+ eblsysvhashentrysize.c
+
+ifeq ($(HOST_OS),linux)
+
+#
+# host libebl
+#
+#
+include $(CLEAR_VARS)
+
+# Disable clang like other elfutils libraries.
+LOCAL_CLANG := false
+
+LOCAL_SRC_FILES := $(LIBEBL_SRC_FILES)
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/.. \
+ $(LOCAL_PATH)/../lib \
+ $(LOCAL_PATH)/../libebl \
+ $(LOCAL_PATH)/../libasm \
+ $(LOCAL_PATH)/../libelf \
+ $(LOCAL_PATH)/../libdw
+
+LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE
+
+LOCAL_CLANG := false
+
+LOCAL_MODULE:= libebl
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+endif # linux
+
+#
+# target libebl
+#
+
+include $(CLEAR_VARS)
+
+# Disable clang like other elfutils libraries.
+LOCAL_CLANG := false
+
+LOCAL_SRC_FILES := $(LIBEBL_SRC_FILES)
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/.. \
+ $(LOCAL_PATH)/../lib \
+ $(LOCAL_PATH)/../libebl \
+ $(LOCAL_PATH)/../libasm \
+ $(LOCAL_PATH)/../libelf \
+ $(LOCAL_PATH)/../libdw
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../bionic-fixup
+
+LOCAL_CFLAGS += -include $(LOCAL_PATH)/../bionic-fixup/AndroidFixup.h
+
+LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -Werror
+
+LOCAL_MODULE:= libebl
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/libebl/ChangeLog b/src/libebl/ChangeLog
new file mode 100644
index 00000000..ac2160de
--- /dev/null
+++ b/src/libebl/ChangeLog
@@ -0,0 +1,873 @@
+2011-04-26 Mark Wielaard <mjw@redhat.com>
+
+ * libebl.h (ebl_object_note_type_name): Add const char *name arg.
+ * eblhooks.h (object_note_type_name): Likewise.
+ * eblopenbackend.c (default_object_note_type_name): Likewise.
+ * eblobjnotetypename.c (ebl_object_note_type_name): Likewise.
+ And print version if name is "stapsdt".
+ * eblobjnote.c (ebl_object_note): Add output for "stapsdt" notes.
+
+2011-03-21 Marek Polacek <mpolacek@redhat.com>
+
+ * ebldynamictagname.c: Fix typo in TLSDESC_GOT.
+
+2011-03-10 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblstother.c.
+ * eblstother.c: New file.
+ * ebl-hooks.h: Add check_st_other_bits hook.
+ * eblopenbackend.c (default_check_st_other_bits): New function.
+ (fill_defaults): Hook default_check_st_other_bits.
+ * libebl.h (ebl_check_st_other_bits): New prototype.
+
+2010-07-07 Roland McGrath <roland@redhat.com>
+
+ * eblopenbackend.c (default_debugscn_p): Match .gdb_index section.
+
+2010-02-15 Roland McGrath <roland@redhat.com>
+
+ * Makefile.am: Use config/eu.am for common stuff.
+
+2010-01-04 Roland McGrath <roland@redhat.com>
+
+ * eblcorenote.c (ebl_core_note): Take GElf_Nhdr * and name data
+ pointer instead of only n_type and n_descsz.
+ * libebl.h: Update declaration.
+ * ebl-hooks.h: Update core_note hook signature.
+ * eblopenbackend.c (default_core_note): Likewise.
+
+2009-10-14 Roland McGrath <roland@redhat.com>
+
+ * eblobjnote.c (ebl_object_note): Clean up NT_GNU_GOLD_VERSION printing.
+
+2009-10-05 Roland McGrath <roland@redhat.com>
+
+ * eblopenbackend.c (default_debugscn_p): Match .debug_pubtypes and
+ .debug_types too.
+
+2009-09-02 Petr Machata <pmachata@redhat.com>
+
+ * libebl/eblstrtab.c (morememory): Allocate memory in multiples of
+ pagesize.
+
+2009-08-06 Petr Machata <pmachata@redhat.com>
+
+ * libebl/eblstrtab.c (ebl_strtabfinalize): Only call copystrings
+ if we have any strings to copy.
+
+2009-07-26 Mark Wielaard <mjw@redhat.com>
+
+ * eblobjnote.c (ebl_object_note): Handle NT_GNU_GOLD_VERSION.
+
+ * eblobjnotetypename.c (ebl_object_note_type_name): Recognize
+ NT_GNU_GOLD_VERSION.
+
+2009-07-08 Roland McGrath <roland@redhat.com>
+
+ * ebl-hooks.h: Add abi_cfi hook.
+ * eblopenbackend.c (default_abi_cfi): New function.
+ (fill_defaults): Add initializer.
+ * eblabicfi.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h: Declare ebl_abi_cfi.
+
+2009-07-08 Ulrich Drepper <drepper@redhat.com>
+
+ * eblsymbolbindingname.c (ebl_symbol_binding_name): Handle
+ STB_GNU_UNIQUE.
+
+ * eblsymboltypename.c (ebl_symbol_type_name): Only handle STT_GNU_IFUNC
+ if the binary is marked as being for Linux.
+
+2009-04-01 Roland McGrath <roland@redhat.com>
+
+ * eblsymboltypename.c (ebl_symbol_type_name): Add STT_GNU_IFUNC.
+
+ * eblauxvinfo.c (AUXV_TYPES): Add RANDOM and BASE_PLATFORM.
+
+2009-02-01 Ulrich Drepper <drepper@redhat.com>
+
+ * eblreloctypename.c (ebl_reloc_type_name): Return "<INVALID RELOC>"
+ instead of "???" for invalid relocations.
+
+2008-08-01 Roland McGrath <roland@redhat.com>
+
+ * eblcorenotetypename.c: Handle NT_386_IOPERM.
+
+2008-07-28 Roland McGrath <roland@redhat.com>
+
+ * eblauxvinfo.c (AUXV_TYPES): Add EXECFN.
+
+ * eblauxvinfo.c (ebl_auxv_info): Handle missing elements of standard
+ table.
+
+2008-07-04 Roland McGrath <roland@redhat.com>
+
+ * libebl.h: Declare ebl_syscall_abi.
+ * ebl_syscall_abi.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * ebl-hooks.h: New hook syscall_abi.
+ * eblopenbackend.c (default_syscall_abi): New function.
+ (fill_defaults): Use it.
+
+2008-03-31 Roland McGrath <roland@redhat.com>
+
+ * ebldynamictagname.c (ebl_dynamic_tag_name): Use hex for unknown tag.
+
+ * ebl-hooks.h: Add check_special_section hook.
+ * eblopenbackend.c (fill_defaults): Set new hook to ...
+ (default_check_special_section): ... this, new function.
+ * ebl_check_special_section.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h: Declare it.
+
+2008-02-20 Roland McGrath <roland@redhat.com>
+
+ * libebl.h: Declare ebl_check_object_attribute.
+ * eblcheckobjattr.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * ebl-hooks.h: Add check_object_attribute hook.
+ * eblopenbackend.c (default_check_object_attribute): New function.
+ (fill_defaults): Initialize pointer to it.
+
+2008-02-19 Roland McGrath <roland@redhat.com>
+
+ * eblsectiontypename.c (ebl_section_type_name):
+ Handle SHT_GNU_ATTRIBUTES.
+
+2008-02-08 Roland McGrath <roland@redhat.com>
+
+ * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PPC_SPE.
+
+2008-01-30 Roland McGrath <roland@redhat.com>
+
+ * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_386_TLS.
+
+2007-10-18 Roland McGrath <roland@redhat.com>
+
+ * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PPC_VMX.
+
+2007-10-11 Roland McGrath <roland@redhat.com>
+
+ * eblobjnote.c (ebl_object_note): Translate target format (byte-swap)
+ for NT_GNU_ABI_TAG contents.
+
+2007-08-22 Roland McGrath <roland@redhat.com>
+
+ * libebl.h (Ebl_Core_Item): New member `group'.
+
+2007-08-19 Roland McGrath <roland@redhat.com>
+
+ * ebl-hooks.h: Add new hook auxv_info.
+ * eblopenbackend.c (default_auxv_info): New function.
+ (fill_defaults): Initialize auxv_info hook.
+ * eblauxvinfo.c : New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h: Declare ebl_auxv_info.
+
+ * eblcorenote.c: Rewritten with new signature.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h (Ebl_Register_Location, Ebl_Core_Item): New types.
+ (ebl_core_note_info): Completely revamp signature.
+ * ebl-hooks.h: Update decl.
+ * eblopenbackend.c (default_core_note): Update signature.
+
+2007-07-09 Roland McGrath <roland@redhat.com>
+
+ * eblobjnotetypename.c (ebl_object_note_type_name): Handle
+ NT_GNU_HWCAP, NT_GNU_BUILD_ID.
+
+ * eblobjnote.c (ebl_object_note): Handle NT_GNU_BUILD_ID.
+
+2007-04-22 Roland McGrath <roland@redhat.com>
+
+ * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PRXFPREG.
+
+2007-03-10 Roland McGrath <roland@redhat.com>
+
+ * eblcorenote.c (ebl_core_note): For normally-zero types,
+ print in hex if not zero.
+
+2007-01-11 Roland McGrath <roland@redhat.com>
+
+ * ebl-hooks.h (machine_section_flag_check): New hook.
+ * libebl.h: Declare ebl_machine_section_flag_check.
+ * eblmachinesectionflagcheck.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * eblopenbackend.c (default_machine_section_flag_check): New function.
+ (fill_defaults): Use it.
+
+2006-09-04 Roland McGrath <roland@redhat.com>
+
+ * ebl-hooks.h: Replace register_name hook with register_info.
+ Also yield natural bit width and base type encoding.
+ * eblopenbackend.c (default_register_name): Renamed
+ default_register_info, new args added.
+ (fill_defaults): Update initialization.
+ * eblregname.c: File renamed ...
+ * eblreginfo.c: ... to this.
+ (ebl_register_name): Renamed to ebl_register_info, new args added.
+ * libebl.h: Update decl.
+
+ * Makefile.am (gen_SOURCES): Update list.
+
+2006-07-06 Ulrich Drepper <drepper@redhat.com>
+
+ * ebldynamictagname.c: Add support for DT_GNU_HASH.
+ * ebldynamictagcheck.c: Likewise.
+ * eblsectiontypename.c: Add support for SHT_GNU_HASH.
+
+2006-07-05 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblsysvhashentrysize.c.
+ * libeblP.h (struct ebl): Add sysvhash_entrysize element.
+ * eblopenbackend.c (fill_defaults): Initialize sysvhash_entrysize.
+
+ * eblopenbackend.c (openbackend): If possible, fill machine, class,
+ and data values in from the ELF file.
+
+2006-07-04 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblrelativerelocp.c.
+ * eblrelativerelocp.c: New file.
+ * ebl-hooks.c: Add relative_reloc_p.
+ * eblopenbackend.c (default_relative_reloc_p): New function.
+ (fill_defaults): Hook it up.
+ * libebl.h: Declare ebl_relative_reloc_p.
+
+2006-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblnonerelocp.c.
+ * eblnonerelocp.c: New file.
+ * ebl-hooks.c: Add none_reloc_p.
+ * eblopenbackend.c (default_none_reloc_p): New function.
+ (fill_defaults): Hook it up.
+ * libebl.h: Declare ebl_none_reloc_p.
+
+2006-05-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl.h: Add extern "C".
+
+2005-11-25 Roland McGrath <roland@redhat.com>
+
+ * eblregname.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * ebl-hooks.h: Declare register_name hook.
+ * libebl.h: Declare ebl_register_name.
+ * eblopenbackend.c (default_register_name): New function.
+ (fill_defaults): Use it.
+
+2005-11-16 Roland McGrath <roland@redhat.com>
+
+ * libebl.h: Use "" for elf-knowledge.h, not <>.
+
+2005-11-15 Roland McGrath <roland@redhat.com>
+
+ * Makefile.am: Removed everything for building libebl_*.so modules,
+ now in ../backends/Makefile.am instead.
+ * alpha_init.c: Moved to ../backends.
+ * alpha_reloc.def: Likewise.
+ * alpha_retval.c: Likewise.
+ * alpha_symbol.c: Likewise.
+ * arm_init.c: Likewise.
+ * arm_reloc.def: Likewise.
+ * arm_symbol.c: Likewise.
+ * common-reloc.c: Likewise.
+ * i386_corenote.c: Likewise.
+ * i386_init.c: Likewise.
+ * i386_reloc.def: Likewise.
+ * i386_retval.c: Likewise.
+ * i386_symbol.c: Likewise.
+ * ia64_init.c: Likewise.
+ * ia64_reloc.def: Likewise.
+ * ia64_symbol.c: Likewise.
+ * libebl_CPU.h: Likewise.
+ * ppc64_init.c: Likewise.
+ * ppc64_reloc.def: Likewise.
+ * ppc64_retval.c: Likewise.
+ * ppc64_symbol.c: Likewise.
+ * ppc_init.c: Likewise.
+ * ppc_reloc.def: Likewise.
+ * ppc_retval.c: Likewise.
+ * ppc_symbol.c: Likewise.
+ * s390_init.c: Likewise.
+ * s390_reloc.def: Likewise.
+ * s390_symbol.c: Likewise.
+ * sh_init.c: Likewise.
+ * sh_reloc.def: Likewise.
+ * sh_symbol.c: Likewise.
+ * sparc_init.c: Likewise.
+ * sparc_reloc.def: Likewise.
+ * sparc_symbol.c: Likewise.
+ * x86_64_corenote.c: Likewise.
+ * x86_64_init.c: Likewise.
+ * x86_64_reloc.def: Likewise.
+ * x86_64_retval.c: Likewise.
+ * x86_64_symbol.c: Likewise.
+
+ * libebl.h: Comment fixes.
+
+ * alpha_retval.c: New file.
+ * Makefile.am (alpha_SRCS): Add it.
+ * alpha_init.c (alpha_init): Initialize return_value_location hook.
+
+ * ppc64_retval.c: New file.
+ * Makefile.am (ppc64_SRCS): Add it.
+ * ppc64_init.c (ppc64_init): Initialize return_value_location hook.
+
+ * ppc_retval.c: New file.
+ * Makefile.am (ppc_SRCS): Add it.
+ * ppc_init.c (ppc_init): Initialize return_value_location hook.
+
+2005-11-14 Roland McGrath <roland@redhat.com>
+
+ * ia64_init.c (ia64_init): Initialize EH->reloc_simple_type.
+ * sh_init.c (sh_init): Likewise.
+ * x86_64_init.c (x86_64_init): Likewise.
+
+ * sparc_symbol.c (sparc_reloc_simple_type): New function.
+ * sparc_init.c (sparc_init): Use it.
+
+ * arm_symbol.c (arm_reloc_simple_type): New function.
+ * arm_init.c (arm_init): Use it.
+
+ * alpha_symbol.c (alpha_reloc_simple_type): New function.
+ * alpha_init.c (alpha_init): Use it.
+
+ * ia64_reloc.def: Update bits per H. J. Lu <hjl@lucon.org>.
+
+ * arm_reloc.def: Update bits per Daniel Jacobowitz <drow@false.org>.
+
+ * alpha_reloc.def: Update bits per Richard Henderson <rth@redhat.com>.
+
+2005-11-13 Roland McGrath <roland@redhat.com>
+
+ * x86_64_retval.c: New file.
+ * Makefile.am (x86_64_SRCS): Add it.
+ * x86_64_init.c (x86_64_init): Use x86_64_return_value_location.
+
+ * i386_retval.c: New file.
+ * Makefile.am (i386_SRCS): Add it.
+ (libdw): New variable.
+ (libebl_%.so): Use $(libdw) in link; use --as-needed.
+ * i386_init.c (i386_init): Use i386_return_value_location.
+
+ * eblretval.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ (INCLUDES): Search in libdw.
+ * libebl.h: Include <libdw.h>. Declare ebl_return_value_location.
+ * ebl-hooks.h: Declare return_value_location hook.
+ * eblopenbackend.c (default_return_value_location): New function.
+ (fill_defaults): Use it.
+
+2005-11-10 Roland McGrath <roland@redhat.com>
+
+ * s390_init.c: New file.
+ * s390_reloc.def: New file.
+ * s390_symbol.c: New file.
+ * Makefile.am (modules, libebl_pic): Add s390.
+ (s390_SRCS, libebl_s390_pic_a_SOURCES): New variables.
+ (am_libebl_s390_pic_a_OBJECTS): New variable.
+
+ * ppc64_init.c: Use common-reloc.c.
+ * ppc64_symbol.c (ppc64_backend_name): Removed.
+ (ppc64_reloc_type_check, ppc64_reloc_type_name): Likewise.
+ (ppc64_copy_reloc_p, ppc64_reloc_valid_use): Likewise.
+
+ * ppc_init.c: Use common-reloc.c.
+ * ppc_symbol.c (ppc_backend_name): Removed.
+ (ppc_reloc_type_name, ppc_reloc_type_check): Likewise.
+ (ppc_reloc_valid_use, ppc_copy_reloc_p): Likewise.
+
+ * sparc_init.c: Use common-reloc.c.
+ * sparc_symbol.c (sparc_backend_name): Removed.
+ (sparc_reloc_type_name, sparc_reloc_type_check): Likewise.
+ (sparc_copy_reloc_p): Likewise.
+
+ * arm_init.c: Use common-reloc.c.
+ * arm_symbol.c (arm_backend_name): Removed.
+ (arm_reloc_type_name, arm_reloc_type_check, arm_copy_reloc_p): Removed.
+
+ * alpha_init.c: Use common-reloc.c.
+ * alpha_symbol.c (alpha_backend_name): Removed.
+ (alpha_reloc_type_name, alpha_reloc_type_check): Likewise.
+ (alpha_copy_reloc_p): Likewise.
+
+ * ia64_symbol.c (ia64_backend_name): Removed.
+ (ia64_reloc_type_name, ia64_reloc_type_check): Likewise.
+ (ia64_copy_reloc_p): Likewise.
+
+ * x86_64_init.c: Use common-reloc.c.
+ * x86_64_symbol.c (x86_64_backend_name): Removed.
+ (x86_64_copy_reloc_p, x86_64_reloc_valid_use): Likewise.
+ (x86_64_reloc_type_check, x86_64_reloc_type_name): Likewise.
+
+ * sh_init.c: Use common-reloc.c.
+ * sh_symbol.c: All functions removed.
+ (sh_reloc_simple_type): New function.
+ (sh_gotpc_reloc_check): New function.
+
+ * common-reloc.c: New file.
+ * Makefile.am (noinst_HEADERS): Add it.
+ * i386_init.c: Include it.
+
+ * sh_reloc.def: New file.
+ * i386_reloc.def: New file.
+ * alpha_reloc.def: New file.
+ * arm_reloc.def: New file.
+ * i386_reloc.def: New file.
+ * ia64_reloc.def: New file.
+ * ppc64_reloc.def: New file.
+ * ppc_reloc.def: New file.
+ * sh_reloc.def: New file.
+ * sparc_reloc.def: New file.
+ * x86_64_reloc.def: New file.
+ * Makefile.am (EXTRA_DIST): Add $(modules:=_reloc.def).
+
+ * libebl_alpha.map: Removed.
+ * libebl_ia64.map: Removed.
+ * libebl_ppc.map: Removed.
+ * libebl_sparc.map: Removed.
+ * libebl_arm.map: Removed.
+ * libebl_i386.map: Removed.
+ * libebl_ppc64.map: Removed.
+ * libebl_sh.map: Removed.
+ * libebl_x86_64.map: Removed.
+ * Makefile.am (EXTRA_DIST): Remove them.
+ (libebl_%.map, libebl_%.so): New pattern rules.
+
+ * libebl_alpha.h: Removed.
+ * libebl_ia64.h: Removed.
+ * libebl_ppc.h: Removed.
+ * libebl_sparc.h: Removed.
+ * libebl_arm.h: Removed.
+ * libebl_i386.h: Removed.
+ * libebl_ppc64.h: Removed.
+ * libebl_sh.h: Removed.
+ * libebl_x86_64.h: Removed.
+ * Makefile.am (noinst_HEADERS): Remove them.
+
+ * x86_64_corenote.c: Use libebl_CPU.h instead.
+ * x86_64_symbol.c: Likewise.
+ * i386_corenote.c: Likewise.
+
+2005-11-09 Roland McGrath <roland@redhat.com>
+
+ * ia64_symbol.c (ia64_reloc_simple_type): New function.
+
+ * ebl-hooks.h (reloc_simple_type): Take the Ebl handle, not Elf handle.
+ * eblrelocsimpletype.c (ebl_reloc_simple_type): Update caller.
+ * eblopenbackend.c (default_reloc_simple_type): Update signature.
+ * i386_symbol.c (i386_reloc_simple_type): Likewise.
+ * ppc64_symbol.c (ppc64_reloc_simple_type): Likewise.
+ * ppc_symbol.c (ppc_reloc_simple_type): Likewise.
+ * x86_64_symbol.c (x86_64_reloc_simple_type): Likewise.
+
+ * i386_symbol.c (i386_backend_name): Removed.
+ (i386_reloc_type_name, i386_reloc_type_check): Likewise.
+ (i386_reloc_valid_use): Removed.
+ (i386_copy_reloc_p): Removed.
+
+ * alpha_destr.c: Removed.
+ * arm_destr.c: Removed.
+ * i386_destr.c: Removed.
+ * ia64_destr.c: Removed.
+ * ppc64_destr.c: Removed.
+ * ppc_destr.c: Removed.
+ * sh_destr.c: Removed.
+ * sparc_destr.c: Removed.
+ * x86_64_destr.c: Removed.
+
+ * ebl-hooks.h: New file, broken out of ...
+ * libeblP.h (struct ebl): ... here. #include that for hook
+ declarations, after defining EBLHOOK macro.
+ * libebl_CPU.h: New file.
+ * Makefile.am (noinst_HEADERS): Add them.
+
+ * libeblP.h (struct ebl): Use uint_fast16_t for machine,
+ and uint_fast8_t for class and data.
+
+2005-08-14 Roland McGrath <roland@redhat.com>
+
+ * ia64_symbol.c (ia64_section_type_name): New function.
+ (ia64_dynamic_tag_check): New function.
+ (ia64_reloc_valid_use): New function.
+ * libebl_ia64.h: Declare them.
+ * ia64_init.c (ia64_init): Use them.
+ * Makefile.am (libebl_ia64.so): Link with libelf.
+
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Use $(LINK) not $(CC) when creating DSOs.
+
+2005-08-13 Roland McGrath <roland@redhat.com>
+
+ * ia64_symbol.c (ia64_machine_flag_check): New function.
+ * libebl_ia64.h: Declare it.
+ * ia64_init.c (ia64_init): Use it.
+
+2005-08-13 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl.h: Add ehdr parameter to ebl_bss_plt_p and
+ ebl_check_special_symbol.
+ * libeblP.h (struct ebl): Adjust callback functions.
+ * eblopenbackend.c: Adjust dummy functions.
+ * ebl_check_special_symbol.c: Add parameter and pass it on.
+ * eblbsspltp.c: Likewise.
+ * ppc_symbol.c (find_dyn_got): With ehdr passed, simplify search for
+ the dynamic section entry.
+ (ppc_check_special_symbol): Add ehdr parameter.
+ (ppc_bss_plt_p): Likewise.
+ * libebl_ppc.h: Adjust prototypes.
+ * ppc64_symbol.c (ppc_check_special_symbol): Add ehdr parameter.
+ (ppc_bss_plt_p): Likewise.
+ * libebl_ppc64.h: Adjust prototypes.
+
+2005-08-12 Roland McGrath <roland@redhat.com>
+
+ * ppc_symbol.c (find_dyn_got): New function, broken out of ...
+ (ppc_bss_plt_p): ... here. Call that.
+ (ppc_check_special_symbol): Use find_dyn_got to fetch value to check
+ against _GLOBAL_OFFSET_TABLE_.
+
+ * libeblP.h (struct ebl): Add bss_plt_p hook.
+ * eblopenbackend.c (default_bss_plt_p): New function.
+ (fill_defaults): Use it.
+ * eblbsspltp.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h: Declare ebl_bss_plt_p.
+ * ppc_symbol.c (ppc_bss_plt_p): New function.
+ * libebl_ppc.h: Declare it.
+ * ppc_init.c (ppc_init): Use it.
+ * ppc64_symbol.c (ppc64_bss_plt_p): New function.
+ * libebl_ppc64.h: Declare it.
+ * ppc64_init.c (ppc64_init): Use it.
+
+ * ebl_check_special_symbol.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * libebl.h: Declare ebl_check_special_symbol.
+ * libeblP.h (struct ebl): Add check_special_symbol hook.
+ * eblopenbackend.c (default_check_special_symbol): New function.
+ (fill_defaults): Use it.
+ * ppc_symbol.c (ppc_check_special_symbol): New function.
+ * libebl_ppc.h: Add prototype.
+ * ppc_init.c (ppc_init): Use it.
+ * ppc64_symbol.c (ppc64_check_special_symbol): New function.
+ * libebl_ppc64.h: Add prototype.
+ * ppc64_init.c (ppc64_init): Use it.
+
+2005-08-07 Ulrich Drepper <drepper@redhat.com>
+
+ * ppc_init.c: Add support for new DT_PPC_* and R_PPC_* values.
+ * ppc_symbol.c: Likewise.
+ * libebl_ppc.h: Likewise.
+ * ppc64_init.c: There is now also a dynamic_tag_check functions
+ * ppc64_symbol.c: Add dynamic_tag_check.
+ * libebl_ppc64.h: Add prototype.
+ * alpha_init.c: Add support for new DT_ALPHA_* value.
+ * alpha_symbol.c: Likewise.
+ * libebl_alpha.h: Likewise.
+
+2005-08-03 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl_alpha.map: Remove unnecessary exports.
+ * libebl_arm.map: Likewise.
+ * libebl_i386.map: Likewise.
+ * libebl_ia64.map: Likewise.
+ * libebl_ppc.map: Likewise.
+ * libebl_ppc64.map: Likewise.
+ * libebl_sh.map: Likewise.
+ * libebl_sparc.map: Likewise.
+ * libebl_x86_64.map: Likewise.
+
+2005-08-02 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (libebl_a_SOURCES): Add eblelfclass.c, eblelfdata.c,
+ and eblelfmachine.c.
+ * elbopenbackend.c (machines): Add class and data fields. Initialize
+ them.
+ (ebl_openbackend): Initialize machine, class, data fields in result.
+ * libebl.h: Declare Add eblelfclass, eblelfdata, and eblelfmachine.
+ * libeblP.h (Ebl): Add machine, class, data fields.
+
+2005-07-23 Ulrich Drepper <drepper@redhat.com>
+
+ * eblsectionstripp.c: New file.
+ * Makefile.am (gen_SOURCES): Add eblsectionstripp.c.
+ * i386_init.c (i386_init): Install specific debugscn_p callback.
+ * i386_symbol.c (i386_debugscn_p): New function.
+ * libebl.h: Declare ebl_section_strip_p.
+ * libebl_i386.h: Declare i386_debugscn_p.
+
+ * libebl.h: Move Ebl definition to...
+ * libeblP.h: ...here.
+
+2005-07-21 Roland McGrath <roland@redhat.com>
+
+ * Makefile.am (install-ebl-modules): New target, commands from ...
+ (install): ... here. Make this depend on it.
+ (LIBEBL_SUBDIR): New variable, substituted by configure.
+ (install-ebl-modules): Install in $(libdir)/$(LIBEBL_SUBDIR).
+ * eblopenbackend.c (openbackend): Use LIBEBL_SUBDIR in module name.
+
+2005-07-21 Ulrich Drepper <drepper@redhat.com>
+
+ * eblcopyrelocp.c: New file.
+ * Makefile.am (gen_SOURCES): Add eblcopyrelocp.c.
+ * libebl.h: Declare ebl_copy_reloc_p.
+ * eblopenbackend.c (fill_defaults): Fill in copy_reloc_p.
+ (default_copy_reloc_p): New function.
+ * alpha_init.c: Define and use arch-specific copy_reloc_p function.
+ * alpha_symbol.c: Likewise.
+ * arm_init.c: Likewise.
+ * arm_symbol.c: Likewise.
+ * i386_init.c: Likewise.
+ * i386_symbol.c: Likewise.
+ * ia64_init.c: Likewise.
+ * ia64_symbol.c: Likewise.
+ * ppc64_init.c: Likewise.
+ * ppc64_symbol.c: Likewise.
+ * ppc_init.c: Likewise.
+ * ppc_symbol.c: Likewise.
+ * sh_init.c: Likewise.
+ * sh_symbol.c: Likewise.
+ * sparc_init.c: Likewise.
+ * sparc_symbol.c: Likewise.
+ * x86_64_init.c: Likewise.
+ * x86_64_symbol.c: Likewise.
+ * libebl_alpha.h: Declare the copy_reloc_p function.
+ * libebl_arm.h: Likewise.
+ * libebl_i386.h: Likewise.
+ * libebl_ia64.h: Likewise.
+ * libebl_ppc.h: Likewise.
+ * libebl_ppc64.h: Likewise.
+ * libebl_sh.h: Likewise.
+ * libebl_sparc.h: Likewise.
+ * libebl_x86_64.h: Likewise.
+
+2005-05-31 Roland McGrath <roland@redhat.com>
+
+ * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
+ tracking works right.
+
+2005-05-21 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl_x86_64.map: Add x86_64_core_note.
+
+2005-05-19 Roland McGrath <roland@redhat.com>
+
+ * libebl_i386.map: Add i386_reloc_valid_use, i386_reloc_simple_type.
+ * libebl_ppc.map: Add ppc_reloc_simple_type.
+ * libebl_ppc64.map: Add ppc64_reloc_simple_type.
+ * libebl_x86_64.map: Add x86_64_reloc_simple_type.
+
+2005-05-11 Ulrich Drepper <drepper@redhat.com>
+
+ * eblcorenote.c: Handle new AT_* values and files with different
+ endianess.
+ * Makefile.am (x86_64_SRCS): Add x86_64_corenote.c.
+ * x86-64_corenote.c: New file.
+ * x86_64_init.c: Hook in x86_64_corenote.
+ * i386_corenote.c: Make file usable on 64-bit platforms.
+
+ * eblopenbackend.c: If modules version comparison fails, reinitialize
+ hooks.
+
+2005-05-10 Ulrich Drepper <drepper@redhat.com>
+
+ * eblopenbackend.c: Require the init function to return a string.
+ Compare it with MODVERSION from config.h.
+ * alpha_init.c: Change return type. Return MODVERSION or NULL.
+ * arm_init.c: Likewise.
+ * eblopenbackend.c: Likewise.
+ * i386_init.c: Likewise.
+ * ia64_init.c: Likewise.
+ * ppc64_init.c: Likewise.
+ * ppc_init.c: Likewise.
+ * sh_init.c: Likewise.
+ * sparc_init.c: Likewise.
+ * x86_64_init.c: Likewise.
+ * libeblP.h: Adjust ebl_bhinit_t.
+ * libebl_alpha.h: Adjust init function prototype.
+ * libebl_arm.h: Likewise.
+ * libebl_i386.h: Likewise.
+ * libebl_ia64.h: Likewise.
+ * libebl_ppc.h: Likewise.
+ * libebl_ppc64.h: Likewise.
+ * libebl_sh.h: Likewise.
+ * libebl_sparc.h: Likewise.
+ * libebl_x86_64.h: Likewise.
+
+ * mips_destr.c: Removed.
+ * mips_init.c: Removed.
+ * mips_symbol.c: Removed.
+ * libebl_mips.h: Removed.
+ * libebl_mips.map: Removed.
+
+2005-05-03 Roland McGrath <roland@redhat.com>
+
+ * libebl.h (Ebl): Add `reloc_simple_type' member.
+ * eblopenbackend.c (default_reloc_simple_type): New function.
+ (openbackend): Use that as default reloc_simple_type callback.
+ * eblrelocsimpletype.c: New file.
+ * Makefile.am (gen_SOURCES): Add it.
+ * i386_symbol.c (i386_reloc_simple_type): New function.
+ * libebl_i386.h: Declare it.
+ * i386_init.c (i386_init): Use it.
+ * x86_64_symbol.c (x86_64_reloc_simple_type): New function.
+ * libebl_x86_64.h: Declare it.
+ * x86_64_init.c (x86_64_init): Use it.
+ * ppc_symbol.c (ppc_reloc_simple_type): New function.
+ * libebl_ppc.h: Declare it.
+ * ppc_init.c (ppc_init): Use it.
+ * ppc64_symbol.c (ppc64_reloc_simple_type): New function.
+ * libebl_ppc64.h: Declare it.
+ * ppc64_init.c (ppc64_init): Use it.
+
+2005-03-17 Ulrich Drepper <drepper@redhat.com>
+
+ * eblcorenote.c (ebl_core_note): Add support for AT_SECURE.
+
+2005-02-15 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Add -Wformat=2.
+
+2005-02-14 Ulrich Drepper <drepper@redhat.com>
+
+ * alpha_destr.c: Add __attribute__((unused)) where needed.
+ * alpha_init.c: Likewise.
+ * alpha_symbol.c: Likewise.
+ * arm_destr.c: Likewise.
+ * arm_init.c: Likewise.
+ * arm_symbol.c: Likewise.
+ * i386_corenote.c: Likewise.
+ * i386_destr.c: Likewise.
+ * i386_init.c: Likewise.
+ * i386_symbol.c: Likewise.
+ * ia64_destr.c: Likewise.
+ * ia64_init.c: Likewise.
+ * ia64_symbol.c: Likewise.
+ * mips_destr.c: Likewise.
+ * mips_init.c: Likewise.
+ * mips_symbol.c: Likewise.
+ * ppc64_destr.c: Likewise.
+ * ppc64_init.c: Likewise.
+ * ppc64_symbol.c: Likewise.
+ * ppc_destr.c: Likewise.
+ * ppc_init.c: Likewise.
+ * ppc_symbol.c: Likewise.
+ * sh_destr.c: Likewise.
+ * sh_init.c: Likewise.
+ * sh_symbol.c: Likewise.
+ * sparc_destr.c: Likewise.
+ * sparc_init.c: Likewise.
+ * sparc_symbol.c: Likewise.
+ * x86_64_destr.c: Likewise.
+ * x86_64_init.c: Likewise.
+ * x86_64_symbol.c: Likewise.
+
+ * x86_64_symbol.c (reloc_map_table): Fix entries for R_X86_64_64
+ and R_X86_64_32..
+
+2005-02-06 Ulrich Drepper <drepper@redhat.com>
+
+ * eblstrtab.c: A few cleanups.
+
+ * eblopenbackend.c: Mark unused parameters.
+
+ * eblgstrtab.c: Cleanups a few printf format strings.
+
+ * Makefile.am: Cleanup AM_CFLAGS handling. Add -Wunused -Wextra.
+
+2005-02-05 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Check for text relocations in constructed DSOs.
+
+ * eblstrtab.c: Minor cleanups.
+
+ * Makefile.am (AM_CFLAGS): Add -std=gnu99 and -fmudflap for MUDFLAP.
+
+2004-08-16 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Add LIBSTR definition with base name of
+ the lib directory.
+ * eblopenbackend.c (openbackend): Use LIBSTR instead of hardcoded
+ lib in path to ebl modules.
+
+2004-04-01 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Add rules for ppc and ppc64 ebl module.
+ * ppc_init..c: New file.
+ * ppc_destr.c: New file.
+ * ppc_symbol.c: New file.
+ * libebl_ppc.h: New file.
+ * libebl_ppc.map: New file.
+ * ppc64_init..c: New file.
+ * ppc64_destr.c: New file.
+ * ppc64_symbol.c: New file.
+ * libebl_ppc64.h: New file.
+ * libebl_ppc64.map: New file.
+
+2004-01-20 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Support building with mudflap.
+
+2004-01-18 Ulrich Drepper <drepper@redhat.com>
+
+ * libeblP.h (_): Use elfutils domain.
+
+2004-01-16 Ulrich Drepper <drepper@redhat.com>
+
+ * eblsectionname.c: Add support for SHN_BEFORE and SHN_AFTER.
+
+2004-01-13 Ulrich Drepper <drepper@redhat.com>
+
+ * eblsegmenttypename.c ((ebl_segment_type_name): Add support for
+ PT_GNU_RELRO.
+
+2004-01-08 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl.h: Remove last traces of libtool.
+
+2004-01-05 Ulrich Drepper <drepper@redhat.com>
+
+ * elf-knowledge.h: Move to libelf subdir.
+
+ * Makefile.am (EXTRA_DIST): Remove libebl.map.
+ * libebl.map: Removed.
+
+2003-12-08 Ulrich Drepper <drepper@redhat.com>
+
+ * eblsectiontypename.c (ebl_section_type_name): Add support for
+ SHT_SUNW_move, SHT_CHECKSUM, and SHT_GNU_LIBLIST.
+
+2003-11-19 Ulrich Drepper <drepper@redhat.com>
+
+ * ia64_symbol.c (ia64_dynamic_tag_name): New function.
+ * libebl_ia64.h (ia64_dynamic_tag_name): Declare.
+ * ia64_init.c (ia64_init): Register i164_dynamic_tag_name.
+
+2003-09-24 Ulrich Drepper <drepper@redhat.com>
+
+ * ia64_init.c (ia64_init): Initialize segment_type_name callback.
+ * ia64_symbol.c (ia64_segment_type_name): Define.
+ * libebl_ia64.h (ia64_segment_type_name): Declare.
+
+2003-09-22 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Add -fpic.
+
+2003-08-14 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (install): Remove dependency on libebl.so.
+
+2003-08-13 Ulrich Drepper <drepper@redhat.com>
+
+ * eblopenbackend.c: Adjust relative path to arch-specific DSOs
+ assuming the code ends up in the application. Add second dlopen()
+ try without any path, just the filename.
+ * Makefile.in: Remove rules to build and install libebl.so.
+
+2003-08-11 Ulrich Drepper <drepper@redhat.com>
+
+ * Moved to CVS archive.
diff --git a/src/libebl/Makefile.am b/src/libebl/Makefile.am
new file mode 100644
index 00000000..ced5668b
--- /dev/null
+++ b/src/libebl/Makefile.am
@@ -0,0 +1,60 @@
+## Process this file with automake to create Makefile.in
+##
+## Copyright (C) 2000-2010 Red Hat, Inc.
+## This file is part of Red Hat elfutils.
+##
+## Red Hat elfutils 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; version 2 of the License.
+##
+## Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+##
+## Red Hat elfutils is an included package of the Open Invention Network.
+## An included package of the Open Invention Network is a package for which
+## Open Invention Network licensees cross-license their patents. No patent
+## license is granted, either expressly or impliedly, by designation as an
+## included package. Should you wish to participate in the Open Invention
+## Network licensing program, please visit www.openinventionnetwork.com
+## <http://www.openinventionnetwork.com>.
+##
+include $(top_srcdir)/config/eu.am
+AM_CFLAGS += -fpic
+INCLUDES += -I$(srcdir)/../libelf -I$(srcdir)/../libdw -I$(srcdir)/../libasm
+VERSION = 1
+LIBEBL_SUBDIR = @LIBEBL_SUBDIR@
+
+lib_LIBRARIES = libebl.a
+
+pkginclude_HEADERS = libebl.h
+
+gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
+ eblreloctypename.c eblsegmenttypename.c \
+ eblsectiontypename.c eblmachineflagname.c \
+ eblsymboltypename.c ebldynamictagname.c eblsectionname.c \
+ eblobjecttypename.c eblsymbolbindingname.c \
+ eblbackendname.c eblshflagscombine.c eblwstrtab.c \
+ eblgstrtab.c eblosabiname.c \
+ eblmachineflagcheck.c eblmachinesectionflagcheck.c \
+ eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletype.c \
+ ebldynamictagcheck.c eblcorenotetypename.c eblobjnotetypename.c \
+ eblcorenote.c eblobjnote.c ebldebugscnp.c \
+ eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \
+ eblelfclass.c eblelfdata.c eblelfmachine.c \
+ ebl_check_special_symbol.c eblbsspltp.c eblretval.c \
+ eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \
+ eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \
+ ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \
+ eblstother.c
+
+libebl_a_SOURCES = $(gen_SOURCES)
+
+noinst_HEADERS = libeblP.h ebl-hooks.h
+
+CLEANFILES += $(am_libebl_pic_a_OBJECTS)
diff --git a/src/libebl/Makefile.in b/src/libebl/Makefile.in
new file mode 100644
index 00000000..40edc5aa
--- /dev/null
+++ b/src/libebl/Makefile.in
@@ -0,0 +1,643 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/eu.am ChangeLog
+@MUDFLAP_TRUE@am__append_1 = -fmudflap
+subdir = libebl
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libebl_a_AR = $(AR) $(ARFLAGS)
+libebl_a_LIBADD =
+am__objects_1 = eblopenbackend.$(OBJEXT) eblclosebackend.$(OBJEXT) \
+ eblstrtab.$(OBJEXT) eblreloctypename.$(OBJEXT) \
+ eblsegmenttypename.$(OBJEXT) eblsectiontypename.$(OBJEXT) \
+ eblmachineflagname.$(OBJEXT) eblsymboltypename.$(OBJEXT) \
+ ebldynamictagname.$(OBJEXT) eblsectionname.$(OBJEXT) \
+ eblobjecttypename.$(OBJEXT) eblsymbolbindingname.$(OBJEXT) \
+ eblbackendname.$(OBJEXT) eblshflagscombine.$(OBJEXT) \
+ eblwstrtab.$(OBJEXT) eblgstrtab.$(OBJEXT) \
+ eblosabiname.$(OBJEXT) eblmachineflagcheck.$(OBJEXT) \
+ eblmachinesectionflagcheck.$(OBJEXT) \
+ eblreloctypecheck.$(OBJEXT) eblrelocvaliduse.$(OBJEXT) \
+ eblrelocsimpletype.$(OBJEXT) ebldynamictagcheck.$(OBJEXT) \
+ eblcorenotetypename.$(OBJEXT) eblobjnotetypename.$(OBJEXT) \
+ eblcorenote.$(OBJEXT) eblobjnote.$(OBJEXT) \
+ ebldebugscnp.$(OBJEXT) eblgotpcreloccheck.$(OBJEXT) \
+ eblcopyrelocp.$(OBJEXT) eblsectionstripp.$(OBJEXT) \
+ eblelfclass.$(OBJEXT) eblelfdata.$(OBJEXT) \
+ eblelfmachine.$(OBJEXT) ebl_check_special_symbol.$(OBJEXT) \
+ eblbsspltp.$(OBJEXT) eblretval.$(OBJEXT) eblreginfo.$(OBJEXT) \
+ eblnonerelocp.$(OBJEXT) eblrelativerelocp.$(OBJEXT) \
+ eblsysvhashentrysize.$(OBJEXT) eblauxvinfo.$(OBJEXT) \
+ eblcheckobjattr.$(OBJEXT) ebl_check_special_section.$(OBJEXT) \
+ ebl_syscall_abi.$(OBJEXT) eblabicfi.$(OBJEXT) \
+ eblstother.$(OBJEXT)
+am_libebl_a_OBJECTS = $(am__objects_1)
+libebl_a_OBJECTS = $(am_libebl_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libebl_a_SOURCES)
+DIST_SOURCES = $(libebl_a_SOURCES)
+HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUGPRED = @DEBUGPRED@
+DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EXEEXT = @EXEEXT@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBEBL_SUBDIR = @LIBEBL_SUBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MODVERSION = @MODVERSION@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = 1
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+base_cpu = @base_cpu@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+eu_version = @eu_version@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+zip_LIBS = @zip_LIBS@
+INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
+ -I$(srcdir)/../libelf -I$(srcdir)/../libdw \
+ -I$(srcdir)/../libasm
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+ $($(*F)_no_Werror),,-Werror) $(if \
+ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
+ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+ $(am__append_1) -fpic
+@MUDFLAP_FALSE@libmudflap =
+@MUDFLAP_TRUE@libmudflap = -lmudflap
+COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+ $(COMPILE))
+
+CLEANFILES = *.gcno *.gcda $(am_libebl_pic_a_OBJECTS)
+textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+lib_LIBRARIES = libebl.a
+pkginclude_HEADERS = libebl.h
+gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
+ eblreloctypename.c eblsegmenttypename.c \
+ eblsectiontypename.c eblmachineflagname.c \
+ eblsymboltypename.c ebldynamictagname.c eblsectionname.c \
+ eblobjecttypename.c eblsymbolbindingname.c \
+ eblbackendname.c eblshflagscombine.c eblwstrtab.c \
+ eblgstrtab.c eblosabiname.c \
+ eblmachineflagcheck.c eblmachinesectionflagcheck.c \
+ eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletype.c \
+ ebldynamictagcheck.c eblcorenotetypename.c eblobjnotetypename.c \
+ eblcorenote.c eblobjnote.c ebldebugscnp.c \
+ eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \
+ eblelfclass.c eblelfdata.c eblelfmachine.c \
+ ebl_check_special_symbol.c eblbsspltp.c eblretval.c \
+ eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \
+ eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \
+ ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \
+ eblstother.c
+
+libebl_a_SOURCES = $(gen_SOURCES)
+noinst_HEADERS = libeblP.h ebl-hooks.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/eu.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libebl/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnits libebl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(libdir)" && rm -f $$files
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libebl.a: $(libebl_a_OBJECTS) $(libebl_a_DEPENDENCIES)
+ -rm -f libebl.a
+ $(libebl_a_AR) libebl.a $(libebl_a_OBJECTS) $(libebl_a_LIBADD)
+ $(RANLIB) libebl.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_check_special_section.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_check_special_symbol.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_syscall_abi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblabicfi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblauxvinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblbackendname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblbsspltp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcheckobjattr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblclosebackend.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcopyrelocp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcorenote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcorenotetypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldebugscnp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldynamictagcheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldynamictagname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfclass.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfdata.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfmachine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblgotpcreloccheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblgstrtab.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagcheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachinesectionflagcheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblnonerelocp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjecttypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnotetypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblopenbackend.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblosabiname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreginfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelativerelocp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelocsimpletype.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypecheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelocvaliduse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblretval.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectionname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectionstripp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectiontypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsegmenttypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblshflagscombine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblstother.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblstrtab.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymbolbindingname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymboltypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsysvhashentrysize.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblwstrtab.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-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_sh_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:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+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-libLIBRARIES uninstall-pkgincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libLIBRARIES install-man install-pdf \
+ install-pdf-am install-pkgincludeHEADERS install-ps \
+ install-ps-am 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-libLIBRARIES \
+ uninstall-pkgincludeHEADERS
+
+
+%.os: %.c %.o
+@AMDEP_TRUE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+@AMDEP_TRUE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
+@AMDEP_TRUE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
+@AMDEP_TRUE@ rm -f "$(DEPDIR)/$*.Tpo"; \
+@AMDEP_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@AMDEP_TRUE@ fi
+@AMDEP_FALSE@ $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $<
+
+# 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/src/libebl/ebl-hooks.h b/src/libebl/ebl-hooks.h
new file mode 100644
index 00000000..a04b3db0
--- /dev/null
+++ b/src/libebl/ebl-hooks.h
@@ -0,0 +1,179 @@
+/* Backend hook signatures internal interface for libebl.
+ Copyright (C) 2000-2011 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+/* Return symbol representaton of object file type. */
+const char *EBLHOOK(object_type_name) (int, char *, size_t);
+
+/* Return symbolic representation of relocation type. */
+const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
+
+/* Check relocation type. */
+bool EBLHOOK(reloc_type_check) (int);
+
+/* Check if relocation type is for simple absolute relocations. */
+Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int);
+
+/* Check relocation type use. */
+bool EBLHOOK(reloc_valid_use) (Elf *, int);
+
+/* Return true if the symbol type is that referencing the GOT. */
+bool EBLHOOK(gotpc_reloc_check) (Elf *, int);
+
+/* Return symbolic representation of segment type. */
+const char *EBLHOOK(segment_type_name) (int, char *, size_t);
+
+/* Return symbolic representation of section type. */
+const char *EBLHOOK(section_type_name) (int, char *, size_t);
+
+/* Return section name. */
+const char *EBLHOOK(section_name) (int, int, char *, size_t);
+
+/* Return next machine flag name. */
+const char *EBLHOOK(machine_flag_name) (GElf_Word *);
+
+/* Check whether machine flags are valid. */
+bool EBLHOOK(machine_flag_check) (GElf_Word);
+
+/* Check whether SHF_MASKPROC flag bits are valid. */
+bool EBLHOOK(machine_section_flag_check) (GElf_Xword);
+
+/* Check whether the section with the given index, header, and name
+ is a special machine section that is valid despite a combination
+ of flags or other details that are not generically valid. */
+bool EBLHOOK(check_special_section) (Ebl *, int,
+ const GElf_Shdr *, const char *);
+
+/* Return symbolic representation of symbol type. */
+const char *EBLHOOK(symbol_type_name) (int, char *, size_t);
+
+/* Return symbolic representation of symbol binding. */
+const char *EBLHOOK(symbol_binding_name) (int, char *, size_t);
+
+/* Return symbolic representation of dynamic tag. */
+const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t);
+
+/* Check dynamic tag. */
+bool EBLHOOK(dynamic_tag_check) (int64_t);
+
+/* Combine section header flags values. */
+GElf_Word EBLHOOK(sh_flags_combine) (GElf_Word, GElf_Word);
+
+/* Return symbolic representation of OS ABI. */
+const char *EBLHOOK(osabi_name) (int, char *, size_t);
+
+/* Name of a note entry type for core files. */
+const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t);
+
+/* Name of a note entry type for object files. */
+const char *EBLHOOK(object_note_type_name) (const char *, uint32_t,
+ char *, size_t);
+
+/* Describe core note format. */
+int EBLHOOK(core_note) (const GElf_Nhdr *, const char *,
+ GElf_Word *, size_t *, const Ebl_Register_Location **,
+ size_t *, const Ebl_Core_Item **);
+
+/* Handle object file note. */
+bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *);
+
+/* Check object attribute. */
+bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t,
+ const char **, const char **);
+
+/* Describe auxv element type. */
+int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **);
+
+/* Check section name for being that of a debug informatino section. */
+bool EBLHOOK(debugscn_p) (const char *);
+
+/* Check whether given relocation is a copy relocation. */
+bool EBLHOOK(copy_reloc_p) (int);
+
+/* Check whether given relocation is a no-op relocation. */
+bool EBLHOOK(none_reloc_p) (int);
+
+/* Check whether given relocation is a relative relocation. */
+bool EBLHOOK(relative_reloc_p) (int);
+
+/* Check whether given symbol's value is ok despite normal checks. */
+bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *,
+ const char *, const GElf_Shdr *);
+
+/* Check whether only valid bits are set on the st_other symbol flag.
+ Standard ST_VISIBILITY have already been masked off. */
+bool EBLHOOK(check_st_other_bits) (unsigned char st_other);
+
+/* Check if backend uses a bss PLT in this file. */
+bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *);
+
+/* Return location expression to find return value given the
+ DW_AT_type DIE of a DW_TAG_subprogram DIE. */
+int EBLHOOK(return_value_location) (Dwarf_Die *functypedie,
+ const Dwarf_Op **locp);
+
+/* Return register name information. */
+ssize_t EBLHOOK(register_info) (Ebl *ebl,
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type);
+
+/* Return system call ABI registers. */
+int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc,
+ int *callno, int args[6]);
+
+/* Disassembler function. */
+int EBLHOOK(disasm) (const uint8_t **startp, const uint8_t *end,
+ GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb,
+ DisasmGetSymCB_t symcb, void *outcbarg, void *symcbarg);
+
+/* Supply the machine-specific state of CFI before CIE initial programs. */
+int EBLHOOK(abi_cfi) (Ebl *ebl, Dwarf_CIE *abi_info);
+
+/* Destructor for ELF backend handle. */
+void EBLHOOK(destr) (struct ebl *);
diff --git a/src/libebl/ebl_check_special_section.c b/src/libebl/ebl_check_special_section.c
new file mode 100644
index 00000000..d1f3c6e3
--- /dev/null
+++ b/src/libebl/ebl_check_special_section.c
@@ -0,0 +1,65 @@
+/* Check for a special section allowed to violate generic constraints.
+ Copyright (C) 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_check_special_section (ebl, ndx, shdr, sname)
+ Ebl *ebl;
+ int ndx;
+ const GElf_Shdr *shdr;
+ const char *sname;
+{
+ return ebl != NULL && ebl->check_special_section (ebl, ndx, shdr, sname);
+}
diff --git a/src/libebl/ebl_check_special_symbol.c b/src/libebl/ebl_check_special_symbol.c
new file mode 100644
index 00000000..875ed1ca
--- /dev/null
+++ b/src/libebl/ebl_check_special_symbol.c
@@ -0,0 +1,70 @@
+/* Check special symbol's st_value.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <libeblP.h>
+
+
+bool
+ebl_check_special_symbol (ebl, ehdr, sym, name, destshdr)
+ Ebl *ebl;
+ GElf_Ehdr *ehdr;
+ const GElf_Sym *sym;
+ const char *name;
+ const GElf_Shdr *destshdr;
+{
+ if (ebl == NULL)
+ return false;
+
+ return ebl->check_special_symbol (ebl->elf, ehdr, sym, name, destshdr);
+}
diff --git a/src/libebl/ebl_syscall_abi.c b/src/libebl/ebl_syscall_abi.c
new file mode 100644
index 00000000..2d9a26b6
--- /dev/null
+++ b/src/libebl/ebl_syscall_abi.c
@@ -0,0 +1,66 @@
+/* Return system call ABI mapped to DWARF register numbers.
+ Copyright (C) 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_syscall_abi (ebl, sp, pc, callno, args)
+ Ebl *ebl;
+ int *sp;
+ int *pc;
+ int *callno;
+ int args[6];
+{
+ return ebl != NULL ? ebl->syscall_abi (ebl, sp, pc, callno, args) : -1;
+}
diff --git a/src/libebl/eblabicfi.c b/src/libebl/eblabicfi.c
new file mode 100644
index 00000000..221e83fc
--- /dev/null
+++ b/src/libebl/eblabicfi.c
@@ -0,0 +1,63 @@
+/* Return ABI-specific DWARF CFI details.
+ Copyright (C) 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_abi_cfi (ebl, abi_info)
+ Ebl *ebl;
+ Dwarf_CIE *abi_info;
+{
+ return ebl == NULL ? -1 : ebl->abi_cfi (ebl, abi_info);
+}
diff --git a/src/libebl/eblauxvinfo.c b/src/libebl/eblauxvinfo.c
new file mode 100644
index 00000000..6e02403f
--- /dev/null
+++ b/src/libebl/eblauxvinfo.c
@@ -0,0 +1,124 @@
+/* Describe known auxv types.
+ Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <byteswap.h>
+#include <endian.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <libeblP.h>
+
+#define AUXV_TYPES \
+ TYPE (NULL, "") \
+ TYPE (IGNORE, "") \
+ TYPE (EXECFD, "d") \
+ TYPE (EXECFN, "s") \
+ TYPE (PHDR, "p") \
+ TYPE (PHENT, "u") \
+ TYPE (PHNUM, "u") \
+ TYPE (PAGESZ, "u") \
+ TYPE (BASE, "p") \
+ TYPE (FLAGS, "x") \
+ TYPE (ENTRY, "p") \
+ TYPE (NOTELF, "") \
+ TYPE (UID, "u") \
+ TYPE (EUID, "u") \
+ TYPE (GID, "u") \
+ TYPE (EGID, "u") \
+ TYPE (CLKTCK, "u") \
+ TYPE (PLATFORM, "s") \
+ TYPE (BASE_PLATFORM, "s") \
+ TYPE (HWCAP, "x") \
+ TYPE (FPUCW, "x") \
+ TYPE (DCACHEBSIZE, "d") \
+ TYPE (ICACHEBSIZE, "d") \
+ TYPE (UCACHEBSIZE, "d") \
+ TYPE (IGNOREPPC, "") \
+ TYPE (SECURE, "u") \
+ TYPE (SYSINFO, "p") \
+ TYPE (SYSINFO_EHDR, "p") \
+ TYPE (L1I_CACHESHAPE, "d") \
+ TYPE (L1D_CACHESHAPE, "d") \
+ TYPE (L2_CACHESHAPE, "d") \
+ TYPE (L3_CACHESHAPE, "d") \
+ TYPE (RANDOM, "p")
+
+static const struct
+{
+ const char *name, *format;
+} auxv_types[] =
+ {
+#define TYPE(name, fmt) [AT_##name] = { #name, fmt },
+ AUXV_TYPES
+#undef TYPE
+ };
+#define nauxv_types (sizeof auxv_types / sizeof auxv_types[0])
+
+int
+ebl_auxv_info (ebl, a_type, name, format)
+ Ebl *ebl;
+ GElf_Xword a_type;
+ const char **name;
+ const char **format;
+{
+ int result = ebl->auxv_info (a_type, name, format);
+ if (result == 0 && a_type < nauxv_types && auxv_types[a_type].name != NULL)
+ {
+ /* The machine specific function did not know this type. */
+ *name = auxv_types[a_type].name;
+ *format = auxv_types[a_type].format;
+ result = 1;
+ }
+ return result;
+}
diff --git a/src/libebl/eblbackendname.c b/src/libebl/eblbackendname.c
new file mode 100644
index 00000000..daec8805
--- /dev/null
+++ b/src/libebl/eblbackendname.c
@@ -0,0 +1,64 @@
+/* Return backend name.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_backend_name (ebl)
+ Ebl *ebl;
+{
+ return ebl != NULL ? ebl->emulation : gettext ("No backend");
+}
diff --git a/src/libebl/eblbsspltp.c b/src/libebl/eblbsspltp.c
new file mode 100644
index 00000000..14b6f099
--- /dev/null
+++ b/src/libebl/eblbsspltp.c
@@ -0,0 +1,64 @@
+/* Check if backend uses a bss PLT.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <libeblP.h>
+
+
+bool
+ebl_bss_plt_p (ebl, ehdr)
+ Ebl *ebl;
+ GElf_Ehdr *ehdr;
+{
+ return ebl == NULL ? false : ebl->bss_plt_p (ebl->elf, ehdr);
+}
diff --git a/src/libebl/eblcheckobjattr.c b/src/libebl/eblcheckobjattr.c
new file mode 100644
index 00000000..fe75de74
--- /dev/null
+++ b/src/libebl/eblcheckobjattr.c
@@ -0,0 +1,81 @@
+/* Check object attributes.
+ Copyright (C) 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <libeblP.h>
+
+
+bool
+ebl_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
+ Ebl *ebl;
+ const char *vendor;
+ int tag;
+ uint64_t value;
+ const char **tag_name;
+ const char **value_name;
+{
+ if (ebl->check_object_attribute (ebl, vendor, tag, value,
+ tag_name, value_name))
+ return true;
+
+ if (strcmp (vendor, "gnu"))
+ return false;
+
+ if (tag == 32)
+ {
+ *tag_name = "compatibility";
+ return true;
+ }
+
+ return false;
+}
diff --git a/src/libebl/eblclosebackend.c b/src/libebl/eblclosebackend.c
new file mode 100644
index 00000000..a0fb3448
--- /dev/null
+++ b/src/libebl/eblclosebackend.c
@@ -0,0 +1,75 @@
+/* Free ELF backend handle.
+ Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <dlfcn.h>
+#include <stdlib.h>
+
+#include <libeblP.h>
+
+
+void
+ebl_closebackend (Ebl *ebl)
+{
+ if (ebl != NULL)
+ {
+ /* Run the destructor. */
+ ebl->destr (ebl);
+
+ /* Close the dynamically loaded object. */
+ if (ebl->dlhandle != NULL)
+ (void) dlclose (ebl->dlhandle);
+
+ /* Free the resources. */
+ free (ebl);
+ }
+}
diff --git a/src/libebl/eblcopyrelocp.c b/src/libebl/eblcopyrelocp.c
new file mode 100644
index 00000000..a7aea880
--- /dev/null
+++ b/src/libebl/eblcopyrelocp.c
@@ -0,0 +1,64 @@
+/* Check whether given relocation is a copy relocation.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_copy_reloc_p (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl->copy_reloc_p (reloc);
+}
diff --git a/src/libebl/eblcorenote.c b/src/libebl/eblcorenote.c
new file mode 100644
index 00000000..7549ca61
--- /dev/null
+++ b/src/libebl/eblcorenote.c
@@ -0,0 +1,107 @@
+/* Describe known core note formats.
+ Copyright (C) 2007, 2010 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <byteswap.h>
+#include <endian.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <libeblP.h>
+
+
+int
+ebl_core_note (ebl, nhdr, name,
+ regs_offset, nregloc, reglocs, nitems, items)
+ Ebl *ebl;
+ const GElf_Nhdr *nhdr;
+ const char *name;
+ GElf_Word *regs_offset;
+ size_t *nregloc;
+ const Ebl_Register_Location **reglocs;
+ size_t *nitems;
+ const Ebl_Core_Item **items;
+{
+ int result = ebl->core_note (nhdr, name,
+ regs_offset, nregloc, reglocs, nitems, items);
+ if (result == 0)
+ {
+ /* The machine specific function did not know this type. */
+
+ *regs_offset = 0;
+ *nregloc = 0;
+ *reglocs = NULL;
+ switch (nhdr->n_type)
+ {
+#define ITEMS(type, table) \
+ case type: \
+ *items = table; \
+ *nitems = sizeof table / sizeof table[0]; \
+ result = 1; \
+ break
+
+ static const Ebl_Core_Item platform[] =
+ {
+ {
+ .name = "Platform",
+ .type = ELF_T_BYTE, .count = 0, .format = 's'
+ }
+ };
+ ITEMS (NT_PLATFORM, platform);
+
+#undef ITEMS
+ }
+ }
+
+ return result;
+}
diff --git a/src/libebl/eblcorenotetypename.c b/src/libebl/eblcorenotetypename.c
new file mode 100644
index 00000000..9376cf57
--- /dev/null
+++ b/src/libebl/eblcorenotetypename.c
@@ -0,0 +1,114 @@
+/* Return note type name.
+ Copyright (C) 2002, 2007, 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <libeblP.h>
+
+const char *
+ebl_core_note_type_name (ebl, type, buf, len)
+ Ebl *ebl;
+ uint32_t type;
+ char *buf;
+ size_t len;
+{
+ const char *res = ebl->core_note_type_name (type, buf, len);
+
+ if (res == NULL)
+ {
+ static const char *knowntypes[] =
+ {
+#define KNOWNSTYPE(name) [NT_##name] = #name
+ KNOWNSTYPE (PRSTATUS),
+ KNOWNSTYPE (FPREGSET),
+ KNOWNSTYPE (PRPSINFO),
+ KNOWNSTYPE (TASKSTRUCT),
+ KNOWNSTYPE (PLATFORM),
+ KNOWNSTYPE (AUXV),
+ KNOWNSTYPE (GWINDOWS),
+ KNOWNSTYPE (ASRS),
+ KNOWNSTYPE (PSTATUS),
+ KNOWNSTYPE (PSINFO),
+ KNOWNSTYPE (PRCRED),
+ KNOWNSTYPE (UTSNAME),
+ KNOWNSTYPE (LWPSTATUS),
+ KNOWNSTYPE (LWPSINFO),
+ KNOWNSTYPE (PRFPXREG)
+#undef KNOWNSTYPE
+ };
+
+ /* Handle standard names. */
+ if (type < sizeof (knowntypes) / sizeof (knowntypes[0])
+ && knowntypes[type] != NULL)
+ res = knowntypes[type];
+ else
+ switch (type)
+ {
+#define KNOWNSTYPE(name) case NT_##name: res = #name; break
+ KNOWNSTYPE (PRXFPREG);
+ KNOWNSTYPE (PPC_VMX);
+ KNOWNSTYPE (PPC_SPE);
+ KNOWNSTYPE (386_TLS);
+ KNOWNSTYPE (386_IOPERM);
+#undef KNOWNSTYPE
+
+ default:
+ snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/ebldebugscnp.c b/src/libebl/ebldebugscnp.c
new file mode 100644
index 00000000..c96622c5
--- /dev/null
+++ b/src/libebl/ebldebugscnp.c
@@ -0,0 +1,65 @@
+/* Check section name for being that of a debug informatino section.
+ Copyright (C) 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdint.h>
+#include <libeblP.h>
+
+
+bool
+ebl_debugscn_p (ebl, name)
+ Ebl *ebl;
+ const char *name;
+{
+ return ebl->debugscn_p (name);
+}
diff --git a/src/libebl/ebldynamictagcheck.c b/src/libebl/ebldynamictagcheck.c
new file mode 100644
index 00000000..1953a9c0
--- /dev/null
+++ b/src/libebl/ebldynamictagcheck.c
@@ -0,0 +1,77 @@
+/* Check dynamic tag.
+ Copyright (C) 2001, 2002, 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <libeblP.h>
+
+
+bool
+ebl_dynamic_tag_check (ebl, tag)
+ Ebl *ebl;
+ int64_t tag;
+{
+ bool res = ebl != NULL ? ebl->dynamic_tag_check (tag) : false;
+
+ if (!res
+ && ((tag >= 0 && tag < DT_NUM)
+ || (tag >= DT_GNU_PRELINKED && tag <= DT_SYMINENT)
+ || (tag >= DT_GNU_HASH && tag <= DT_SYMINFO)
+ || tag == DT_VERSYM
+ || (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM)
+ || tag == DT_AUXILIARY
+ || tag == DT_FILTER))
+ res = true;
+
+ return res;
+}
diff --git a/src/libebl/ebldynamictagname.c b/src/libebl/ebldynamictagname.c
new file mode 100644
index 00000000..cb65b929
--- /dev/null
+++ b/src/libebl/ebldynamictagname.c
@@ -0,0 +1,134 @@
+/* Return dynamic tag name.
+ Copyright (C) 2001, 2002, 2006, 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_dynamic_tag_name (ebl, tag, buf, len)
+ Ebl *ebl;
+ int64_t tag;
+ char *buf;
+ size_t len;
+{
+ const char *res = ebl != NULL ? ebl->dynamic_tag_name (tag, buf, len) : NULL;
+
+ if (res == NULL)
+ {
+ if (tag >= 0 && tag < DT_NUM)
+ {
+ static const char *stdtags[] =
+ {
+ "NULL", "NEEDED", "PLTRELSZ", "PLTGOT", "HASH", "STRTAB",
+ "SYMTAB", "RELA", "RELASZ", "RELAENT", "STRSZ", "SYMENT",
+ "INIT", "FINI", "SONAME", "RPATH", "SYMBOLIC", "REL", "RELSZ",
+ "RELENT", "PLTREL", "DEBUG", "TEXTREL", "JMPREL", "BIND_NOW",
+ "INIT_ARRAY", "FINI_ARRAY", "INIT_ARRAYSZ", "FINI_ARRAYSZ",
+ "RUNPATH", "FLAGS", "ENCODING", "PREINIT_ARRAY",
+ "PREINIT_ARRAYSZ"
+ };
+
+ res = stdtags[tag];
+ }
+ else if (tag == DT_VERSYM)
+ res = "VERSYM";
+ else if (tag >= DT_GNU_PRELINKED && tag <= DT_SYMINENT)
+ {
+ static const char *valrntags[] =
+ {
+ "GNU_PRELINKED", "GNU_CONFLICTSZ", "GNU_LIBLISTSZ",
+ "CHECKSUM", "PLTPADSZ", "MOVEENT", "MOVESZ", "FEATURE_1",
+ "POSFLAG_1", "SYMINSZ", "SYMINENT"
+ };
+
+ res = valrntags[tag - DT_GNU_PRELINKED];
+ }
+ else if (tag >= DT_GNU_HASH && tag <= DT_SYMINFO)
+ {
+ static const char *addrrntags[] =
+ {
+ "GNU_HASH", "TLSDESC_PLT", "TLSDESC_GOT",
+ "GNU_CONFLICT", "GNU_LIBLIST", "CONFIG", "DEPAUDIT", "AUDIT",
+ "PLTPAD", "MOVETAB", "SYMINFO"
+ };
+
+ res = addrrntags[tag - DT_GNU_HASH];
+ }
+ else if (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM)
+ {
+ static const char *suntags[] =
+ {
+ "RELACOUNT", "RELCOUNT", "FLAGS_1", "VERDEF", "VERDEFNUM",
+ "VERNEED", "VERNEEDNUM"
+ };
+
+ res = suntags[tag - DT_RELACOUNT];
+ }
+ else if (tag == DT_AUXILIARY)
+ res = "AUXILIARY";
+ else if (tag == DT_FILTER)
+ res = "FILTER";
+ else
+ {
+ snprintf (buf, len, gettext ("<unknown>: %#" PRIx64), tag);
+
+ res = buf;
+
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblelfclass.c b/src/libebl/eblelfclass.c
new file mode 100644
index 00000000..222307e7
--- /dev/null
+++ b/src/libebl/eblelfclass.c
@@ -0,0 +1,63 @@
+/* Return ELF class.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_get_elfclass (ebl)
+ Ebl *ebl;
+{
+ return ebl->class;
+}
diff --git a/src/libebl/eblelfdata.c b/src/libebl/eblelfdata.c
new file mode 100644
index 00000000..f84ae165
--- /dev/null
+++ b/src/libebl/eblelfdata.c
@@ -0,0 +1,63 @@
+/* Return ELF data encoding.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_get_elfdata (ebl)
+ Ebl *ebl;
+{
+ return ebl->data;
+}
diff --git a/src/libebl/eblelfmachine.c b/src/libebl/eblelfmachine.c
new file mode 100644
index 00000000..9839fefe
--- /dev/null
+++ b/src/libebl/eblelfmachine.c
@@ -0,0 +1,63 @@
+/* Return ELF machine.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_get_elfmachine (ebl)
+ Ebl *ebl;
+{
+ return ebl->machine;
+}
diff --git a/src/libebl/eblgotpcreloccheck.c b/src/libebl/eblgotpcreloccheck.c
new file mode 100644
index 00000000..e70fcb19
--- /dev/null
+++ b/src/libebl/eblgotpcreloccheck.c
@@ -0,0 +1,65 @@
+/* Return true if the symbol type is that referencing the GOT. E.g.,
+ R_386_GOTPC.
+ Copyright (C) 2003 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_gotpc_reloc_check (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl != NULL ? ebl->gotpc_reloc_check (ebl->elf, reloc) : false;
+}
diff --git a/src/libebl/eblgstrtab.c b/src/libebl/eblgstrtab.c
new file mode 100644
index 00000000..73f0d278
--- /dev/null
+++ b/src/libebl/eblgstrtab.c
@@ -0,0 +1,386 @@
+/* Generic string table handling.
+ Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <inttypes.h>
+#include <libelf.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/param.h>
+
+#include "libebl.h"
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+struct Ebl_GStrent
+{
+ const char *string;
+ size_t len;
+ struct Ebl_GStrent *next;
+ struct Ebl_GStrent *left;
+ struct Ebl_GStrent *right;
+ size_t offset;
+ unsigned int width;
+ char reverse[0];
+};
+
+
+struct memoryblock
+{
+ struct memoryblock *next;
+ char memory[0];
+};
+
+
+struct Ebl_GStrtab
+{
+ struct Ebl_GStrent *root;
+ struct memoryblock *memory;
+ char *backp;
+ size_t left;
+ size_t total;
+ unsigned int width;
+ bool nullstr;
+
+ struct Ebl_GStrent null;
+};
+
+
+/* Cache for the pagesize. We correct this value a bit so that `malloc'
+ is not allocating more than a page. */
+static size_t ps;
+
+
+struct Ebl_GStrtab *
+ebl_gstrtabinit (unsigned int width, bool nullstr)
+{
+ struct Ebl_GStrtab *ret;
+
+ if (ps == 0)
+ {
+ ps = sysconf (_SC_PAGESIZE) - 2 * sizeof (void *);
+ assert (sizeof (struct memoryblock) < ps);
+ }
+
+ ret = (struct Ebl_GStrtab *) calloc (1, sizeof (struct Ebl_GStrtab));
+ if (ret != NULL)
+ {
+ ret->width = width;
+ ret->nullstr = nullstr;
+
+ if (nullstr)
+ {
+ ret->null.len = 1;
+ ret->null.string = (char *) calloc (1, width);
+ }
+ }
+
+ return ret;
+}
+
+
+static void
+morememory (struct Ebl_GStrtab *st, size_t len)
+{
+ struct memoryblock *newmem;
+
+ if (len < ps)
+ len = ps;
+ newmem = (struct memoryblock *) malloc (len);
+ if (newmem == NULL)
+ abort ();
+
+ newmem->next = st->memory;
+ st->memory = newmem;
+ st->backp = newmem->memory;
+ st->left = len - offsetof (struct memoryblock, memory);
+}
+
+
+void
+ebl_gstrtabfree (struct Ebl_GStrtab *st)
+{
+ struct memoryblock *mb = st->memory;
+
+ while (mb != NULL)
+ {
+ void *old = mb;
+ mb = mb->next;
+ free (old);
+ }
+
+ if (st->null.string != NULL)
+ free ((char *) st->null.string);
+
+ free (st);
+}
+
+
+static struct Ebl_GStrent *
+newstring (struct Ebl_GStrtab *st, const char *str, size_t len)
+{
+ /* Compute the amount of padding needed to make the structure aligned. */
+ size_t align = ((__alignof__ (struct Ebl_GStrent)
+ - (((uintptr_t) st->backp)
+ & (__alignof__ (struct Ebl_GStrent) - 1)))
+ & (__alignof__ (struct Ebl_GStrent) - 1));
+
+ /* Make sure there is enough room in the memory block. */
+ if (st->left < align + sizeof (struct Ebl_GStrent) + len * st->width)
+ {
+ morememory (st, sizeof (struct Ebl_GStrent) + len * st->width);
+ align = 0;
+ }
+
+ /* Create the reserved string. */
+ struct Ebl_GStrent *newstr = (struct Ebl_GStrent *) (st->backp + align);
+ newstr->string = str;
+ newstr->len = len;
+ newstr->width = st->width;
+ newstr->next = NULL;
+ newstr->left = NULL;
+ newstr->right = NULL;
+ newstr->offset = 0;
+ for (int i = len - 2; i >= 0; --i)
+ for (int j = st->width - 1; j >= 0; --j)
+ newstr->reverse[i * st->width + j] = str[(len - 2 - i) * st->width + j];
+ for (size_t j = 0; j < st->width; ++j)
+ newstr->reverse[(len - 1) * st->width + j] = '\0';
+ st->backp += align + sizeof (struct Ebl_GStrent) + len * st->width;
+ st->left -= align + sizeof (struct Ebl_GStrent) + len * st->width;
+
+ return newstr;
+}
+
+
+/* XXX This function should definitely be rewritten to use a balancing
+ tree algorith (AVL, red-black trees). For now a simple, correct
+ implementation is enough. */
+static struct Ebl_GStrent **
+searchstring (struct Ebl_GStrent **sep, struct Ebl_GStrent *newstr)
+{
+ int cmpres;
+
+ /* More strings? */
+ if (*sep == NULL)
+ {
+ *sep = newstr;
+ return sep;
+ }
+
+ /* Compare the strings. */
+ cmpres = memcmp ((*sep)->reverse, newstr->reverse,
+ (MIN ((*sep)->len, newstr->len) - 1) * (*sep)->width);
+ if (cmpres == 0)
+ /* We found a matching string. */
+ return sep;
+ else if (cmpres > 0)
+ return searchstring (&(*sep)->left, newstr);
+ else
+ return searchstring (&(*sep)->right, newstr);
+}
+
+
+/* Add new string. The actual string is assumed to be permanent. */
+struct Ebl_GStrent *
+ebl_gstrtabadd (struct Ebl_GStrtab *st, const char *str, size_t len)
+{
+ struct Ebl_GStrent *newstr;
+ struct Ebl_GStrent **sep;
+
+ /* Compute the string length if the caller doesn't know it. */
+ if (len == 0)
+ {
+ size_t j;
+
+ do
+ for (j = 0; j < st->width; ++j)
+ if (str[len * st->width + j] != '\0')
+ break;
+ while (j == st->width && ++len);
+ }
+
+ /* Make sure all "" strings get offset 0 but only if the table was
+ created with a special null entry in mind. */
+ if (len == 1 && st->null.string != NULL)
+ return &st->null;
+
+ /* Allocate memory for the new string and its associated information. */
+ newstr = newstring (st, str, len);
+
+ /* Search in the array for the place to insert the string. If there
+ is no string with matching prefix and no string with matching
+ leading substring, create a new entry. */
+ sep = searchstring (&st->root, newstr);
+ if (*sep != newstr)
+ {
+ /* This is not the same entry. This means we have a prefix match. */
+ if ((*sep)->len > newstr->len)
+ {
+ struct Ebl_GStrent *subs;
+
+ /* Check whether we already know this string. */
+ for (subs = (*sep)->next; subs != NULL; subs = subs->next)
+ if (subs->len == newstr->len)
+ {
+ /* We have an exact match with a substring. Free the memory
+ we allocated. */
+ st->left += (st->backp - (char *) newstr) * st->width;
+ st->backp = (char *) newstr;
+
+ return subs;
+ }
+
+ /* We have a new substring. This means we don't need the reverse
+ string of this entry anymore. */
+ st->backp -= newstr->len;
+ st->left += newstr->len;
+
+ newstr->next = (*sep)->next;
+ (*sep)->next = newstr;
+ }
+ else if ((*sep)->len != newstr->len)
+ {
+ /* When we get here it means that the string we are about to
+ add has a common prefix with a string we already have but
+ it is longer. In this case we have to put it first. */
+ st->total += newstr->len - (*sep)->len;
+ newstr->next = *sep;
+ newstr->left = (*sep)->left;
+ newstr->right = (*sep)->right;
+ *sep = newstr;
+ }
+ else
+ {
+ /* We have an exact match. Free the memory we allocated. */
+ st->left += (st->backp - (char *) newstr) * st->width;
+ st->backp = (char *) newstr;
+
+ newstr = *sep;
+ }
+ }
+ else
+ st->total += newstr->len;
+
+ return newstr;
+}
+
+
+static void
+copystrings (struct Ebl_GStrent *nodep, char **freep, size_t *offsetp)
+{
+ struct Ebl_GStrent *subs;
+
+ if (nodep->left != NULL)
+ copystrings (nodep->left, freep, offsetp);
+
+ /* Process the current node. */
+ nodep->offset = *offsetp;
+ *freep = (char *) mempcpy (*freep, nodep->string, nodep->len * nodep->width);
+ *offsetp += nodep->len * nodep->width;
+
+ for (subs = nodep->next; subs != NULL; subs = subs->next)
+ {
+ assert (subs->len < nodep->len);
+ subs->offset = nodep->offset + (nodep->len - subs->len) * nodep->width;
+ assert (subs->offset != 0 || subs->string[0] == '\0');
+ }
+
+ if (nodep->right != NULL)
+ copystrings (nodep->right, freep, offsetp);
+}
+
+
+void
+ebl_gstrtabfinalize (struct Ebl_GStrtab *st, Elf_Data *data)
+{
+ size_t copylen;
+ char *endp;
+ size_t nulllen = st->nullstr ? st->width : 0;
+
+ /* Fill in the information. */
+ data->d_buf = malloc (st->total + nulllen);
+ if (data->d_buf == NULL)
+ abort ();
+
+ /* The first byte must always be zero if we created the table with a
+ null string. */
+ if (st->nullstr)
+ memset (data->d_buf, '\0', st->width);
+
+ data->d_type = ELF_T_BYTE;
+ data->d_size = st->total + nulllen;
+ data->d_off = 0;
+ data->d_align = 1;
+ data->d_version = EV_CURRENT;
+
+ /* Now run through the tree and add all the string while also updating
+ the offset members of the elfstrent records. */
+ endp = (char *) data->d_buf + nulllen;
+ copylen = nulllen;
+ copystrings (st->root, &endp, &copylen);
+ assert (copylen == st->total * st->width + nulllen);
+}
+
+
+size_t
+ebl_gstrtaboffset (struct Ebl_GStrent *se)
+{
+ return se->offset;
+}
diff --git a/src/libebl/eblmachineflagcheck.c b/src/libebl/eblmachineflagcheck.c
new file mode 100644
index 00000000..ac383f60
--- /dev/null
+++ b/src/libebl/eblmachineflagcheck.c
@@ -0,0 +1,64 @@
+/* Check machine flag.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_machine_flag_check (ebl, flags)
+ Ebl *ebl;
+ Elf64_Word flags;
+{
+ return ebl != NULL ? ebl->machine_flag_check (flags) : (flags == 0);
+}
diff --git a/src/libebl/eblmachineflagname.c b/src/libebl/eblmachineflagname.c
new file mode 100644
index 00000000..88a8da83
--- /dev/null
+++ b/src/libebl/eblmachineflagname.c
@@ -0,0 +1,112 @@
+/* Return machine flag names.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_machine_flag_name (ebl, flags, buf, len)
+ Ebl *ebl;
+ Elf64_Word flags;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ if (flags == 0)
+ res = "";
+ else
+ {
+ char *cp = buf;
+ int first = 1;
+ const char *machstr;
+ size_t machstrlen;
+
+ do
+ {
+ if (! first)
+ {
+ if (cp + 1 >= buf + len)
+ break;
+ *cp++ = ',';
+ }
+
+ machstr = ebl != NULL ? ebl->machine_flag_name (&flags) : NULL;
+ if (machstr == NULL)
+ {
+ /* No more known flag. */
+ snprintf (cp, buf + len - cp, "%#x", flags);
+ break;
+ }
+
+ machstrlen = strlen (machstr) + 1;
+ if ((size_t) (buf + len - cp) < machstrlen)
+ {
+ *((char *) mempcpy (cp, machstr, buf + len - cp - 1)) = '\0';
+ break;
+ }
+
+ cp = mempcpy (cp, machstr, machstrlen);
+
+ first = 0;
+ }
+ while (flags != 0);
+
+ res = buf;
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblmachinesectionflagcheck.c b/src/libebl/eblmachinesectionflagcheck.c
new file mode 100644
index 00000000..9eb6d386
--- /dev/null
+++ b/src/libebl/eblmachinesectionflagcheck.c
@@ -0,0 +1,63 @@
+/* Check SHF_MASKPROC flags.
+ Copyright (C) 2007 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_machine_section_flag_check (ebl, flags)
+ Ebl *ebl;
+ GElf_Xword flags;
+{
+ return ebl != NULL ? ebl->machine_section_flag_check (flags) : (flags == 0);
+}
diff --git a/src/libebl/eblnonerelocp.c b/src/libebl/eblnonerelocp.c
new file mode 100644
index 00000000..3bca98b1
--- /dev/null
+++ b/src/libebl/eblnonerelocp.c
@@ -0,0 +1,64 @@
+/* Check whether given relocation is a no-op relocation.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_none_reloc_p (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl->none_reloc_p (reloc);
+}
diff --git a/src/libebl/eblobjecttypename.c b/src/libebl/eblobjecttypename.c
new file mode 100644
index 00000000..ce100e7f
--- /dev/null
+++ b/src/libebl/eblobjecttypename.c
@@ -0,0 +1,84 @@
+/* Return object file type name.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_object_type_name (ebl, object, buf, len)
+ Ebl *ebl;
+ int object;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ res = ebl != NULL ? ebl->object_type_name (object, buf, len) : NULL;
+ if (res == NULL)
+ {
+ /* Handle OS-specific section names. */
+ if (object >= ET_LOOS && object <= ET_HIOS)
+ snprintf (buf, len, "LOOS+%x", object - ET_LOOS);
+ /* Handle processor-specific section names. */
+ else if (object >= ET_LOPROC && object <= ET_HIPROC)
+ snprintf (buf, len, "LOPROC+%x", object - ET_LOPROC);
+ else
+ snprintf (buf, len, "%s: %d", gettext ("<unknown>"), object);
+
+ res = buf;
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblobjnote.c b/src/libebl/eblobjnote.c
new file mode 100644
index 00000000..ec5bb7da
--- /dev/null
+++ b/src/libebl/eblobjnote.c
@@ -0,0 +1,241 @@
+/* Print contents of object file note.
+ Copyright (C) 2002, 2007, 2009, 2011 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <libeblP.h>
+
+
+void
+ebl_object_note (ebl, name, type, descsz, desc)
+ Ebl *ebl;
+ const char *name;
+ uint32_t type;
+ uint32_t descsz;
+ const char *desc;
+{
+ if (! ebl->object_note (name, type, descsz, desc))
+ /* The machine specific function did not know this type. */
+
+ if (strcmp ("stapsdt", name) == 0)
+ {
+ if (type != 3)
+ {
+ printf (gettext ("unknown SDT version %u\n"), type);
+ return;
+ }
+
+ /* Descriptor starts with three addresses, pc, base ref and
+ semaphore. Then three zero terminated strings provider,
+ name and arguments. */
+
+ union
+ {
+ Elf64_Addr a64[3];
+ Elf32_Addr a32[3];
+ } addrs;
+
+ size_t addrs_size = gelf_fsize (ebl->elf, ELF_T_ADDR, 3, EV_CURRENT);
+ if (descsz < addrs_size + 3)
+ {
+ invalid_sdt:
+ printf (gettext ("invalid SDT probe descriptor\n"));
+ return;
+ }
+
+ Elf_Data src =
+ {
+ .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
+ .d_buf = (void *) desc, .d_size = addrs_size
+ };
+
+ Elf_Data dst =
+ {
+ .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
+ .d_buf = &addrs, .d_size = addrs_size
+ };
+
+ if (gelf_xlatetom (ebl->elf, &dst, &src,
+ elf_getident (ebl->elf, NULL)[EI_DATA]) == NULL)
+ {
+ printf ("%s\n", elf_errmsg (-1));
+ return;
+ }
+
+ const char *provider = desc + addrs_size;
+ const char *pname = memchr (provider, '\0', desc + descsz - provider);
+ if (pname == NULL)
+ goto invalid_sdt;
+
+ ++pname;
+ const char *args = memchr (pname, '\0', desc + descsz - pname);
+ if (args == NULL ||
+ memchr (++args, '\0', desc + descsz - pname) != desc + descsz - 1)
+ goto invalid_sdt;
+
+ GElf_Addr pc;
+ GElf_Addr base;
+ GElf_Addr sem;
+ if (gelf_getclass (ebl->elf) == ELFCLASS32)
+ {
+ pc = addrs.a32[0];
+ base = addrs.a32[1];
+ sem = addrs.a32[2];
+ }
+ else
+ {
+ pc = addrs.a64[0];
+ base = addrs.a64[1];
+ sem = addrs.a64[2];
+ }
+
+ printf (gettext (" PC: "));
+ printf ("%#" PRIx64 ",", pc);
+ printf (gettext (" Base: "));
+ printf ("%#" PRIx64 ",", base);
+ printf (gettext (" Semaphore: "));
+ printf ("%#" PRIx64 "\n", sem);
+ printf (gettext (" Provider: "));
+ printf ("%s,", provider);
+ printf (gettext (" Name: "));
+ printf ("%s,", pname);
+ printf (gettext (" Args: "));
+ printf ("'%s'\n", args);
+ return;
+ }
+
+ switch (type)
+ {
+ case NT_GNU_BUILD_ID:
+ if (strcmp (name, "GNU") == 0 && descsz > 0)
+ {
+ printf (gettext (" Build ID: "));
+ uint_fast32_t i;
+ for (i = 0; i < descsz - 1; ++i)
+ printf ("%02" PRIx8, (uint8_t) desc[i]);
+ printf ("%02" PRIx8 "\n", (uint8_t) desc[i]);
+ }
+ break;
+
+ case NT_GNU_GOLD_VERSION:
+ if (strcmp (name, "GNU") == 0 && descsz > 0)
+ /* A non-null terminated version string. */
+ printf (gettext (" Linker version: %.*s\n"),
+ (int) descsz, desc);
+ break;
+
+ case NT_GNU_ABI_TAG:
+ if (strcmp (name, "GNU") == 0 && descsz >= 8 && descsz % 4 == 0)
+ {
+ Elf_Data in =
+ {
+ .d_version = EV_CURRENT,
+ .d_type = ELF_T_WORD,
+ .d_size = descsz,
+ .d_buf = (void *) desc
+ };
+ uint32_t buf[descsz / 4];
+ Elf_Data out =
+ {
+ .d_version = EV_CURRENT,
+ .d_type = ELF_T_WORD,
+ .d_size = descsz,
+ .d_buf = buf
+ };
+
+ if (elf32_xlatetom (&out, &in, ebl->data) != NULL)
+ {
+ const char *os;
+ switch (buf[0])
+ {
+ case ELF_NOTE_OS_LINUX:
+ os = "Linux";
+ break;
+
+ case ELF_NOTE_OS_GNU:
+ os = "GNU";
+ break;
+
+ case ELF_NOTE_OS_SOLARIS2:
+ os = "Solaris";
+ break;
+
+ case ELF_NOTE_OS_FREEBSD:
+ os = "FreeBSD";
+ break;
+
+ default:
+ os = "???";
+ break;
+ }
+
+ printf (gettext (" OS: %s, ABI: "), os);
+ for (size_t cnt = 1; cnt < descsz / 4; ++cnt)
+ {
+ if (cnt > 1)
+ putchar_unlocked ('.');
+ printf ("%" PRIu32, buf[cnt]);
+ }
+ putchar_unlocked ('\n');
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ /* Unknown type. */
+ break;
+ }
+}
diff --git a/src/libebl/eblobjnotetypename.c b/src/libebl/eblobjnotetypename.c
new file mode 100644
index 00000000..0ceb5a87
--- /dev/null
+++ b/src/libebl/eblobjnotetypename.c
@@ -0,0 +1,101 @@
+/* Return note type name.
+ Copyright (C) 2002, 2007, 2009, 2011 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_object_note_type_name (ebl, name, type, buf, len)
+ Ebl *ebl;
+ const char *name;
+ uint32_t type;
+ char *buf;
+ size_t len;
+{
+ const char *res = ebl->object_note_type_name (name, type, buf, len);
+
+ if (res == NULL)
+ {
+ if (strcmp (name, "stapsdt") == 0)
+ {
+ snprintf (buf, len, "Version: %" PRIu32, type);
+ return buf;
+ }
+
+ static const char *knowntypes[] =
+ {
+#define KNOWNSTYPE(name) [NT_##name] = #name
+ KNOWNSTYPE (VERSION),
+ KNOWNSTYPE (GNU_HWCAP),
+ KNOWNSTYPE (GNU_BUILD_ID),
+ KNOWNSTYPE (GNU_GOLD_VERSION),
+ };
+
+ /* Handle standard names. */
+ if (type < sizeof (knowntypes) / sizeof (knowntypes[0])
+ && knowntypes[type] != NULL)
+ res = knowntypes[type];
+ else
+ {
+ snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblopenbackend.c b/src/libebl/eblopenbackend.c
new file mode 100644
index 00000000..542df629
--- /dev/null
+++ b/src/libebl/eblopenbackend.c
@@ -0,0 +1,779 @@
+/* Generate ELF backend handle.
+ Copyright (C) 2000-2011 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <dlfcn.h>
+#include <error.h>
+#include <libelfP.h>
+#include <dwarf.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <libeblP.h>
+
+
+/* This table should contain the complete list of architectures as far
+ as the ELF specification is concerned. */
+/* XXX When things are stable replace the string pointers with char
+ arrays to avoid relocations. */
+static const struct
+{
+ const char *dsoname;
+ const char *emulation;
+ const char *prefix;
+ int prefix_len;
+ int em;
+ int class;
+ int data;
+} machines[] =
+{
+ { "i386", "elf_i386", "i386", 4, EM_386, ELFCLASS32, ELFDATA2LSB },
+ { "ia64", "elf_ia64", "ia64", 4, EM_IA_64, ELFCLASS64, ELFDATA2LSB },
+ { "alpha", "elf_alpha", "alpha", 5, EM_ALPHA, ELFCLASS64, ELFDATA2LSB },
+ { "x86_64", "elf_x86_64", "x86_64", 6, EM_X86_64, ELFCLASS64, ELFDATA2LSB },
+ { "ppc", "elf_ppc", "ppc", 3, EM_PPC, ELFCLASS32, ELFDATA2MSB },
+ { "ppc64", "elf_ppc64", "ppc64", 5, EM_PPC64, ELFCLASS64, ELFDATA2MSB },
+ // XXX class and machine fields need to be filled in for all archs.
+ { "sh", "elf_sh", "sh", 2, EM_SH, 0, 0 },
+ { "arm", "ebl_arm", "arm", 3, EM_ARM, 0, 0 },
+ { "sparc", "elf_sparcv9", "sparc", 5, EM_SPARCV9, 0, 0 },
+ { "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
+ { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
+ { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
+
+ { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
+ { "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 },
+ { "m88k", "elf_m88k", "m88k", 4, EM_88K, 0, 0 },
+ { "i860", "elf_i860", "i860", 4, EM_860, 0, 0 },
+ { "s370", "ebl_s370", "s370", 4, EM_S370, 0, 0 },
+ { "parisc", "elf_parisc", "parisc", 6, EM_PARISC, 0, 0 },
+ { "vpp500", "elf_vpp500", "vpp500", 5, EM_VPP500, 0, 0 },
+ { "sparc", "elf_v8plus", "v8plus", 6, EM_SPARC32PLUS, 0, 0 },
+ { "i960", "elf_i960", "i960", 4, EM_960, 0, 0 },
+ { "v800", "ebl_v800", "v800", 4, EM_V800, 0, 0 },
+ { "fr20", "ebl_fr20", "fr20", 4, EM_FR20, 0, 0 },
+ { "rh32", "ebl_rh32", "rh32", 4, EM_RH32, 0, 0 },
+ { "rce", "ebl_rce", "rce", 3, EM_RCE, 0, 0 },
+ { "tricore", "elf_tricore", "tricore", 7, EM_TRICORE, 0, 0 },
+ { "arc", "elf_arc", "arc", 3, EM_ARC, 0, 0 },
+ { "h8", "elf_h8_300", "h8_300", 6, EM_H8_300, 0, 0 },
+ { "h8", "elf_h8_300h", "h8_300h", 6, EM_H8_300H, 0, 0 },
+ { "h8", "elf_h8s", "h8s", 6, EM_H8S, 0, 0 },
+ { "h8", "elf_h8_500", "h8_500", 6, EM_H8_500, 0, 0 },
+ { "coldfire", "elf_coldfire", "coldfire", 8, EM_COLDFIRE, 0, 0 },
+ { "m68k", "elf_68hc12", "68hc12", 6, EM_68HC12, 0, 0 },
+ { "mma", "elf_mma", "mma", 3, EM_MMA, 0, 0 },
+ { "pcp", "elf_pcp", "pcp", 3, EM_PCP, 0, 0 },
+ { "ncpu", "elf_ncpu", "ncpu", 4, EM_NCPU, 0, 0 },
+ { "ndr1", "elf_ndr1", "ndr1", 4, EM_NDR1, 0, 0 },
+ { "starcore", "elf_starcore", "starcore", 8, EM_STARCORE, 0, 0 },
+ { "me16", "elf_me16", "em16", 4, EM_ME16, 0, 0 },
+ { "st100", "elf_st100", "st100", 5, EM_ST100, 0, 0 },
+ { "tinyj", "elf_tinyj", "tinyj", 5, EM_TINYJ, 0, 0 },
+ { "pdsp", "elf_pdsp", "pdsp", 4, EM_PDSP, 0, 0 },
+ { "fx66", "elf_fx66", "fx66", 4, EM_FX66, 0, 0 },
+ { "st9plus", "elf_st9plus", "st9plus", 7, EM_ST9PLUS, 0, 0 },
+ { "st7", "elf_st7", "st7", 3, EM_ST7, 0, 0 },
+ { "m68k", "elf_68hc16", "68hc16", 6, EM_68HC16, 0, 0 },
+ { "m68k", "elf_68hc11", "68hc11", 6, EM_68HC11, 0, 0 },
+ { "m68k", "elf_68hc08", "68hc08", 6, EM_68HC08, 0, 0 },
+ { "m68k", "elf_68hc05", "68hc05", 6, EM_68HC05, 0, 0 },
+ { "svx", "elf_svx", "svx", 3, EM_SVX, 0, 0 },
+ { "st19", "elf_st19", "st19", 4, EM_ST19, 0, 0 },
+ { "vax", "elf_vax", "vax", 3, EM_VAX, 0, 0 },
+ { "cris", "elf_cris", "cris", 4, EM_CRIS, 0, 0 },
+ { "javelin", "elf_javelin", "javelin", 7, EM_JAVELIN, 0, 0 },
+ { "firepath", "elf_firepath", "firepath", 8, EM_FIREPATH, 0, 0 },
+ { "zsp", "elf_zsp", "zsp", 3, EM_ZSP, 0, 0 },
+ { "mmix", "elf_mmix", "mmix", 4, EM_MMIX, 0, 0 },
+ { "hunay", "elf_huany", "huany", 5, EM_HUANY, 0, 0 },
+ { "prism", "elf_prism", "prism", 5, EM_PRISM, 0, 0 },
+ { "avr", "elf_avr", "avr", 3, EM_AVR, 0, 0 },
+ { "fr30", "elf_fr30", "fr30", 4, EM_FR30, 0, 0 },
+ { "dv10", "elf_dv10", "dv10", 4, EM_D10V, 0, 0 },
+ { "dv30", "elf_dv30", "dv30", 4, EM_D30V, 0, 0 },
+ { "v850", "elf_v850", "v850", 4, EM_V850, 0, 0 },
+ { "m32r", "elf_m32r", "m32r", 4, EM_M32R, 0, 0 },
+ { "mn10300", "elf_mn10300", "mn10300", 7, EM_MN10300, 0, 0 },
+ { "mn10200", "elf_mn10200", "mn10200", 7, EM_MN10200, 0, 0 },
+ { "pj", "elf_pj", "pj", 2, EM_PJ, 0, 0 },
+ { "openrisc", "elf_openrisc", "openrisc", 8, EM_OPENRISC, 0, 0 },
+ { "arc", "elf_arc_a5", "arc_a5", 6, EM_ARC_A5, 0, 0 },
+ { "xtensa", "elf_xtensa", "xtensa", 6, EM_XTENSA, 0, 0 },
+};
+#define nmachines (sizeof (machines) / sizeof (machines[0]))
+
+
+/* Default callbacks. Mostly they just return the error value. */
+static const char *default_object_type_name (int ignore, char *buf,
+ size_t len);
+static const char *default_reloc_type_name (int ignore, char *buf, size_t len);
+static bool default_reloc_type_check (int ignore);
+static bool default_reloc_valid_use (Elf *elf, int ignore);
+static Elf_Type default_reloc_simple_type (Ebl *ebl, int ignore);
+static bool default_gotpc_reloc_check (Elf *elf, int ignore);
+static const char *default_segment_type_name (int ignore, char *buf,
+ size_t len);
+static const char *default_section_type_name (int ignore, char *buf,
+ size_t len);
+static const char *default_section_name (int ignore, int ignore2, char *buf,
+ size_t len);
+static const char *default_machine_flag_name (Elf64_Word *ignore);
+static bool default_machine_flag_check (Elf64_Word flags);
+static bool default_machine_section_flag_check (GElf_Xword flags);
+static const char *default_symbol_type_name (int ignore, char *buf,
+ size_t len);
+static const char *default_symbol_binding_name (int ignore, char *buf,
+ size_t len);
+static const char *default_dynamic_tag_name (int64_t ignore, char *buf,
+ size_t len);
+static bool default_dynamic_tag_check (int64_t ignore);
+static GElf_Word default_sh_flags_combine (GElf_Word flags1, GElf_Word flags2);
+static const char *default_osabi_name (int ignore, char *buf, size_t len);
+static void default_destr (struct ebl *ignore);
+static const char *default_core_note_type_name (uint32_t, char *buf,
+ size_t len);
+static const char *default_object_note_type_name (const char *name, uint32_t,
+ char *buf, size_t len);
+static int default_core_note (const GElf_Nhdr *nhdr, const char *name,
+ GElf_Word *regs_offset, size_t *nregloc,
+ const Ebl_Register_Location **reglocs,
+ size_t *nitems, const Ebl_Core_Item **);
+static int default_auxv_info (GElf_Xword a_type,
+ const char **name, const char **format);
+static bool default_object_note (const char *name, uint32_t type,
+ uint32_t descsz, const char *desc);
+static bool default_debugscn_p (const char *name);
+static bool default_copy_reloc_p (int reloc);
+#ifndef __APPLE__
+static bool default_none_reloc_p (int reloc);
+static bool default_relative_reloc_p (int reloc);
+#else
+#define default_none_reloc_p default_copy_reloc_p
+#define default_relative_reloc_p default_copy_reloc_p
+#endif
+static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr,
+ const GElf_Sym *sym,
+ const char *name,
+ const GElf_Shdr *destshdr);
+static bool default_check_st_other_bits (unsigned char st_other);
+static bool default_check_special_section (Ebl *, int,
+ const GElf_Shdr *, const char *);
+static bool default_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr);
+static int default_return_value_location (Dwarf_Die *functypedie,
+ const Dwarf_Op **locops);
+static ssize_t default_register_info (Ebl *ebl,
+ int regno, char *name, size_t namelen,
+ const char **prefix,
+ const char **setname,
+ int *bits, int *type);
+static int default_syscall_abi (Ebl *ebl, int *sp, int *pc,
+ int *callno, int args[6]);
+static bool default_check_object_attribute (Ebl *ebl, const char *vendor,
+ int tag, uint64_t value,
+ const char **tag_name,
+ const char **value_name);
+static int default_abi_cfi (Ebl *ebl, Dwarf_CIE *abi_info);
+
+
+static void
+fill_defaults (Ebl *result)
+{
+ result->object_type_name = default_object_type_name;
+ result->reloc_type_name = default_reloc_type_name;
+ result->reloc_type_check = default_reloc_type_check;
+ result->reloc_valid_use = default_reloc_valid_use;
+ result->reloc_simple_type = default_reloc_simple_type;
+ result->gotpc_reloc_check = default_gotpc_reloc_check;
+ result->segment_type_name = default_segment_type_name;
+ result->section_type_name = default_section_type_name;
+ result->section_name = default_section_name;
+ result->machine_flag_name = default_machine_flag_name;
+ result->machine_flag_check = default_machine_flag_check;
+ result->machine_section_flag_check = default_machine_section_flag_check;
+ result->check_special_section = default_check_special_section;
+ result->symbol_type_name = default_symbol_type_name;
+ result->symbol_binding_name = default_symbol_binding_name;
+ result->dynamic_tag_name = default_dynamic_tag_name;
+ result->dynamic_tag_check = default_dynamic_tag_check;
+ result->sh_flags_combine = default_sh_flags_combine;
+ result->osabi_name = default_osabi_name;
+ result->core_note_type_name = default_core_note_type_name;
+ result->object_note_type_name = default_object_note_type_name;
+ result->core_note = default_core_note;
+ result->auxv_info = default_auxv_info;
+ result->object_note = default_object_note;
+ result->debugscn_p = default_debugscn_p;
+ result->copy_reloc_p = default_copy_reloc_p;
+ result->none_reloc_p = default_none_reloc_p;
+ result->relative_reloc_p = default_relative_reloc_p;
+ result->check_special_symbol = default_check_special_symbol;
+ result->check_st_other_bits = default_check_st_other_bits;
+ result->bss_plt_p = default_bss_plt_p;
+ result->return_value_location = default_return_value_location;
+ result->register_info = default_register_info;
+ result->syscall_abi = default_syscall_abi;
+ result->check_object_attribute = default_check_object_attribute;
+ result->disasm = NULL;
+ result->abi_cfi = default_abi_cfi;
+ result->destr = default_destr;
+ result->sysvhash_entrysize = sizeof (Elf32_Word);
+}
+
+
+/* Find an appropriate backend for the file associated with ELF. */
+static Ebl *
+openbackend (elf, emulation, machine)
+ Elf *elf;
+ const char *emulation;
+ GElf_Half machine;
+{
+ Ebl *result;
+ size_t cnt;
+
+ /* First allocate the data structure for the result. We do this
+ here since this assures that the structure is always large
+ enough. */
+ result = (Ebl *) calloc (1, sizeof (Ebl));
+ if (result == NULL)
+ {
+ // XXX uncomment
+ // __libebl_seterror (ELF_E_NOMEM);
+ return NULL;
+ }
+
+ /* Fill in the default callbacks. The initializer for the machine
+ specific module can overwrite the values. */
+ fill_defaults (result);
+
+ /* XXX Currently all we do is to look at 'e_machine' value in the
+ ELF header. With an internal mapping table from EM_* value to
+ DSO name we try to load the appropriate module to handle this
+ binary type.
+
+ Multiple modules for the same machine type are possible and they
+ will be tried in sequence. The lookup process will only stop
+ when a module which can handle the machine type is found or all
+ available matching modules are tried. */
+ for (cnt = 0; cnt < nmachines; ++cnt)
+ if ((emulation != NULL && strcmp (emulation, machines[cnt].emulation) == 0)
+ || (emulation == NULL && machines[cnt].em == machine))
+ {
+ /* Well, we know the emulation name now. */
+ result->emulation = machines[cnt].emulation;
+
+ /* We access some data structures directly. Make sure the 32 and
+ 64 bit variants are laid out the same. */
+ assert (offsetof (Elf32_Ehdr, e_machine)
+ == offsetof (Elf64_Ehdr, e_machine));
+ assert (sizeof (((Elf32_Ehdr *) 0)->e_machine)
+ == sizeof (((Elf64_Ehdr *) 0)->e_machine));
+ assert (offsetof (Elf, state.elf32.ehdr)
+ == offsetof (Elf, state.elf64.ehdr));
+
+ /* Prefer taking the information from the ELF file. */
+ if (elf == NULL)
+ {
+ result->machine = machines[cnt].em;
+ result->class = machines[cnt].class;
+ result->data = machines[cnt].data;
+ }
+ else
+ {
+ result->machine = elf->state.elf32.ehdr->e_machine;
+ result->class = elf->state.elf32.ehdr->e_ident[EI_CLASS];
+ result->data = elf->state.elf32.ehdr->e_ident[EI_DATA];
+ }
+
+#ifndef LIBEBL_SUBDIR
+# define LIBEBL_SUBDIR PACKAGE
+#endif
+#define ORIGINDIR "$ORIGIN/../$LIB/" LIBEBL_SUBDIR "/"
+
+ /* Give it a try. At least the machine type matches. First
+ try to load the module. */
+ char dsoname[100];
+ strcpy (stpcpy (stpcpy (dsoname, ORIGINDIR "libebl_"),
+ machines[cnt].dsoname),
+ ".so");
+
+ void *h = dlopen (dsoname, RTLD_LAZY);
+ if (h == NULL)
+ {
+ strcpy (stpcpy (stpcpy (dsoname, "libebl_"),
+ machines[cnt].dsoname),
+ ".so");
+ h = dlopen (dsoname, RTLD_LAZY);
+ }
+
+ /* Try without an explicit path. */
+ if (h != NULL)
+ {
+ /* We managed to load the object. Now see whether the
+ initialization function likes our file. */
+ static const char version[] = MODVERSION;
+ const char *modversion;
+ ebl_bhinit_t initp;
+ char symname[machines[cnt].prefix_len + sizeof "_init"];
+
+ strcpy (mempcpy (symname, machines[cnt].prefix,
+ machines[cnt].prefix_len), "_init");
+
+ initp = (ebl_bhinit_t) dlsym (h, symname);
+ if (initp != NULL
+ && (modversion = initp (elf, machine, result, sizeof (Ebl)))
+ && strcmp (version, modversion) == 0)
+ {
+ /* We found a module to handle our file. */
+ result->dlhandle = h;
+ result->elf = elf;
+
+ /* A few entries are mandatory. */
+ assert (result->name != NULL);
+ assert (result->destr != NULL);
+
+ return result;
+ }
+
+ /* Not the module we need. */
+ (void) dlclose (h);
+ }
+
+ /* We cannot find a DSO but the emulation/machine ID matches.
+ Return that information. */
+ result->dlhandle = NULL;
+ result->elf = elf;
+ result->name = machines[cnt].prefix;
+ fill_defaults (result);
+
+ return result;
+ }
+
+ /* Nothing matched. We use only the default callbacks. */
+ result->dlhandle = NULL;
+ result->elf = elf;
+ result->emulation = "<unknown>";
+ result->name = "<unknown>";
+ fill_defaults (result);
+
+ return result;
+}
+
+
+/* Find an appropriate backend for the file associated with ELF. */
+Ebl *
+ebl_openbackend (elf)
+ Elf *elf;
+{
+ GElf_Ehdr ehdr_mem;
+ GElf_Ehdr *ehdr;
+
+ /* Get the ELF header of the object. */
+ ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr == NULL)
+ {
+ // XXX uncomment
+ // __libebl_seterror (elf_errno ());
+ return NULL;
+ }
+
+ return openbackend (elf, NULL, ehdr->e_machine);
+}
+
+
+/* Find backend without underlying ELF file. */
+Ebl *
+ebl_openbackend_machine (machine)
+ GElf_Half machine;
+{
+ return openbackend (NULL, NULL, machine);
+}
+
+
+/* Find backend with given emulation name. */
+Ebl *
+ebl_openbackend_emulation (const char *emulation)
+{
+ return openbackend (NULL, emulation, EM_NONE);
+}
+
+
+/* Default callbacks. Mostly they just return the error value. */
+static const char *
+default_object_type_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_reloc_type_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static bool
+default_reloc_type_check (int ignore __attribute__ ((unused)))
+{
+ return false;
+}
+
+static bool
+default_reloc_valid_use (Elf *elf __attribute__ ((unused)),
+ int ignore __attribute__ ((unused)))
+{
+ return false;
+}
+
+static Elf_Type
+default_reloc_simple_type (Ebl *eh __attribute__ ((unused)),
+ int ignore __attribute__ ((unused)))
+{
+ return ELF_T_NUM;
+}
+
+static bool
+default_gotpc_reloc_check (Elf *elf __attribute__ ((unused)),
+ int ignore __attribute__ ((unused)))
+{
+ return false;
+}
+
+static const char *
+default_segment_type_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_section_type_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_section_name (int ignore __attribute__ ((unused)),
+ int ignore2 __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_machine_flag_name (Elf64_Word *ignore __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static bool
+default_machine_flag_check (Elf64_Word flags __attribute__ ((unused)))
+{
+ return flags == 0;
+}
+
+static bool
+default_machine_section_flag_check (GElf_Xword flags)
+{
+ return flags == 0;
+}
+
+static bool
+default_check_special_section (Ebl *ebl __attribute__ ((unused)),
+ int ndx __attribute__ ((unused)),
+ const GElf_Shdr *shdr __attribute__ ((unused)),
+ const char *sname __attribute__ ((unused)))
+{
+ return false;
+}
+
+static const char *
+default_symbol_type_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_symbol_binding_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_dynamic_tag_name (int64_t ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static bool
+default_dynamic_tag_check (int64_t ignore __attribute__ ((unused)))
+{
+ return false;
+}
+
+static GElf_Word
+default_sh_flags_combine (GElf_Word flags1, GElf_Word flags2)
+{
+ return SH_FLAGS_COMBINE (flags1, flags2);
+}
+
+static void
+default_destr (struct ebl *ignore __attribute__ ((unused)))
+{
+}
+
+static const char *
+default_osabi_name (int ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static const char *
+default_core_note_type_name (uint32_t ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static int
+default_auxv_info (GElf_Xword a_type __attribute__ ((unused)),
+ const char **name __attribute__ ((unused)),
+ const char **format __attribute__ ((unused)))
+{
+ return 0;
+}
+
+static int
+default_core_note (const GElf_Nhdr *nhdr __attribute__ ((unused)),
+ const char *name __attribute__ ((unused)),
+ GElf_Word *ro __attribute__ ((unused)),
+ size_t *nregloc __attribute__ ((unused)),
+ const Ebl_Register_Location **reglocs
+ __attribute__ ((unused)),
+ size_t *nitems __attribute__ ((unused)),
+ const Ebl_Core_Item **items __attribute__ ((unused)))
+{
+ return 0;
+}
+
+static const char *
+default_object_note_type_name (const char *name __attribute__ ((unused)),
+ uint32_t ignore __attribute__ ((unused)),
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static bool
+default_object_note (const char *name __attribute__ ((unused)),
+ uint32_t type __attribute__ ((unused)),
+ uint32_t descsz __attribute__ ((unused)),
+ const char *desc __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static bool
+default_debugscn_p (const char *name)
+{
+ /* We know by default only about the DWARF debug sections which have
+ fixed names. */
+ static const char *dwarf_scn_names[] =
+ {
+ /* DWARF 1 */
+ ".debug",
+ ".line",
+ /* GNU DWARF 1 extensions */
+ ".debug_srcinfo",
+ ".debug_sfnames",
+ /* DWARF 1.1 and DWARF 2 */
+ ".debug_aranges",
+ ".debug_pubnames",
+ /* DWARF 2 */
+ ".debug_info",
+ ".debug_abbrev",
+ ".debug_line",
+ ".debug_frame",
+ ".debug_str",
+ ".debug_loc",
+ ".debug_macinfo",
+ /* DWARF 3 */
+ ".debug_ranges",
+ ".debug_pubtypes",
+ /* DWARF 4 */
+ ".debug_types",
+ /* GDB DWARF 4 extension */
+ ".gdb_index",
+ /* SGI/MIPS DWARF 2 extensions */
+ ".debug_weaknames",
+ ".debug_funcnames",
+ ".debug_typenames",
+ ".debug_varnames"
+ };
+ const size_t ndwarf_scn_names = (sizeof (dwarf_scn_names)
+ / sizeof (dwarf_scn_names[0]));
+ for (size_t cnt = 0; cnt < ndwarf_scn_names; ++cnt)
+ if (strcmp (name, dwarf_scn_names[cnt]) == 0)
+ return true;
+
+ return false;
+}
+
+static bool
+default_copy_reloc_p (int reloc __attribute__ ((unused)))
+{
+ return false;
+}
+#ifndef __APPLE__
+strong_alias (default_copy_reloc_p, default_none_reloc_p)
+strong_alias (default_copy_reloc_p, default_relative_reloc_p)
+#endif
+
+static bool
+default_check_special_symbol (Elf *elf __attribute__ ((unused)),
+ GElf_Ehdr *ehdr __attribute__ ((unused)),
+ const GElf_Sym *sym __attribute__ ((unused)),
+ const char *name __attribute__ ((unused)),
+ const GElf_Shdr *destshdr __attribute__ ((unused)))
+{
+ return false;
+}
+
+static bool
+default_check_st_other_bits (unsigned char st_other __attribute__ ((unused)))
+{
+ return false;
+}
+
+
+static bool
+default_bss_plt_p (Elf *elf __attribute__ ((unused)),
+ GElf_Ehdr *ehdr __attribute__ ((unused)))
+{
+ return false;
+}
+
+static int
+default_return_value_location (Dwarf_Die *functypedie __attribute__ ((unused)),
+ const Dwarf_Op **locops __attribute__ ((unused)))
+{
+ return -2;
+}
+
+static ssize_t
+default_register_info (Ebl *ebl __attribute__ ((unused)),
+ int regno, char *name, size_t namelen,
+ const char **prefix,
+ const char **setname,
+ int *bits, int *type)
+{
+ if (name == NULL)
+ return 0;
+
+ *setname = "???";
+ *prefix = "";
+ *bits = -1;
+ *type = DW_ATE_void;
+ return snprintf (name, namelen, "reg%d", regno);
+}
+
+static int
+default_syscall_abi (Ebl *ebl __attribute__ ((unused)),
+ int *sp, int *pc, int *callno, int args[6])
+{
+ *sp = *pc = *callno = -1;
+ args[0] = -1;
+ args[1] = -1;
+ args[2] = -1;
+ args[3] = -1;
+ args[4] = -1;
+ args[5] = -1;
+ return -1;
+}
+
+static bool
+default_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
+ const char *vendor __attribute__ ((unused)),
+ int tag __attribute__ ((unused)),
+ uint64_t value __attribute__ ((unused)),
+ const char **tag_name, const char **value_name)
+{
+ *tag_name = NULL;
+ *value_name = NULL;
+ return false;
+}
+
+static int
+default_abi_cfi (Ebl *ebl __attribute__ ((unused)),
+ Dwarf_CIE *abi_info __attribute__ ((unused)))
+{
+ return 0;
+}
diff --git a/src/libebl/eblosabiname.c b/src/libebl/eblosabiname.c
new file mode 100644
index 00000000..3b38b441
--- /dev/null
+++ b/src/libebl/eblosabiname.c
@@ -0,0 +1,105 @@
+/* Return OS ABI name
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_osabi_name (ebl, osabi, buf, len)
+ Ebl *ebl;
+ int osabi;
+ char *buf;
+ size_t len;
+{
+ const char *res = ebl != NULL ? ebl->osabi_name (osabi, buf, len) : NULL;
+
+ if (res == NULL)
+ {
+ if (osabi == ELFOSABI_NONE)
+ res = "UNIX - System V";
+ else if (osabi == ELFOSABI_HPUX)
+ res = "HP/UX";
+ else if (osabi == ELFOSABI_NETBSD)
+ res = "NetBSD";
+ else if (osabi == ELFOSABI_LINUX)
+ res = "Linux";
+ else if (osabi == ELFOSABI_SOLARIS)
+ res = "Solaris";
+ else if (osabi == ELFOSABI_AIX)
+ res = "AIX";
+ else if (osabi == ELFOSABI_IRIX)
+ res = "Irix";
+ else if (osabi == ELFOSABI_FREEBSD)
+ res = "FreeBSD";
+ else if (osabi == ELFOSABI_TRU64)
+ res = "TRU64";
+ else if (osabi == ELFOSABI_MODESTO)
+ res = "Modesto";
+ else if (osabi == ELFOSABI_OPENBSD)
+ res = "OpenBSD";
+ else if (osabi == ELFOSABI_ARM)
+ res = "Arm";
+ else if (osabi == ELFOSABI_STANDALONE)
+ res = gettext ("Stand alone");
+ else
+ {
+ snprintf (buf, len, "%s: %d", gettext ("<unknown>"), osabi);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblreginfo.c b/src/libebl/eblreginfo.c
new file mode 100644
index 00000000..8fc4abfa
--- /dev/null
+++ b/src/libebl/eblreginfo.c
@@ -0,0 +1,71 @@
+/* Return register name information.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <libeblP.h>
+
+
+ssize_t
+ebl_register_info (ebl, regno, name, namelen, prefix, setname, bits, type)
+ Ebl *ebl;
+ int regno;
+ char *name;
+ size_t namelen;
+ const char **prefix;
+ const char **setname;
+ int *bits;
+ int *type;
+{
+ return ebl == NULL ? -1 : ebl->register_info (ebl, regno, name, namelen,
+ prefix, setname, bits, type);
+}
diff --git a/src/libebl/eblrelativerelocp.c b/src/libebl/eblrelativerelocp.c
new file mode 100644
index 00000000..9c28b59c
--- /dev/null
+++ b/src/libebl/eblrelativerelocp.c
@@ -0,0 +1,64 @@
+/* Check whether given relocation is a relative relocation.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_relative_reloc_p (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl->relative_reloc_p (reloc);
+}
diff --git a/src/libebl/eblrelocsimpletype.c b/src/libebl/eblrelocsimpletype.c
new file mode 100644
index 00000000..87eb5a89
--- /dev/null
+++ b/src/libebl/eblrelocsimpletype.c
@@ -0,0 +1,63 @@
+/* Check relocation type for simple types.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+Elf_Type
+ebl_reloc_simple_type (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc) : ELF_T_NUM;
+}
diff --git a/src/libebl/eblreloctypecheck.c b/src/libebl/eblreloctypecheck.c
new file mode 100644
index 00000000..576073cb
--- /dev/null
+++ b/src/libebl/eblreloctypecheck.c
@@ -0,0 +1,64 @@
+/* Check relocation type.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_reloc_type_check (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl != NULL ? ebl->reloc_type_check (reloc) : false;
+}
diff --git a/src/libebl/eblreloctypename.c b/src/libebl/eblreloctypename.c
new file mode 100644
index 00000000..3f2c7d9c
--- /dev/null
+++ b/src/libebl/eblreloctypename.c
@@ -0,0 +1,74 @@
+/* Return relocation type name.
+ Copyright (C) 2001, 2002, 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_reloc_type_name (ebl, reloc, buf, len)
+ Ebl *ebl;
+ int reloc;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ res = ebl != NULL ? ebl->reloc_type_name (reloc, buf, len) : NULL;
+ if (res == NULL)
+ /* There are no generic relocation type names. */
+ res = "<INVALID RELOC>";
+
+ return res;
+}
diff --git a/src/libebl/eblrelocvaliduse.c b/src/libebl/eblrelocvaliduse.c
new file mode 100644
index 00000000..40f27157
--- /dev/null
+++ b/src/libebl/eblrelocvaliduse.c
@@ -0,0 +1,64 @@
+/* Check relocation type use.
+ Copyright (C) 2003 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_reloc_valid_use (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl != NULL ? ebl->reloc_valid_use (ebl->elf, reloc) : false;
+}
diff --git a/src/libebl/eblretval.c b/src/libebl/eblretval.c
new file mode 100644
index 00000000..56dc30ff
--- /dev/null
+++ b/src/libebl/eblretval.c
@@ -0,0 +1,65 @@
+/* Return location expression to find return value given a function type DIE.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <libeblP.h>
+
+
+int
+ebl_return_value_location (ebl, functypedie, locops)
+ Ebl *ebl;
+ Dwarf_Die *functypedie;
+ const Dwarf_Op **locops;
+{
+ return ebl == NULL ? -1 : ebl->return_value_location (functypedie, locops);
+}
diff --git a/src/libebl/eblsectionname.c b/src/libebl/eblsectionname.c
new file mode 100644
index 00000000..f1c2b56a
--- /dev/null
+++ b/src/libebl/eblsectionname.c
@@ -0,0 +1,117 @@
+/* Return section name.
+ Copyright (C) 2001, 2002, 2004 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_section_name (ebl, section, xsection, buf, len, scnnames, shnum)
+ Ebl *ebl;
+ int section;
+ int xsection;
+ char *buf;
+ size_t len;
+ const char *scnnames[];
+ size_t shnum;
+{
+ const char *res = ebl != NULL ? ebl->section_name (section, xsection,
+ buf, len) : NULL;
+
+ if (res == NULL)
+ {
+ if (section == SHN_UNDEF)
+ res = "UNDEF";
+ else if (section == SHN_ABS)
+ res = "ABS";
+ else if (section == SHN_COMMON)
+ res = "COMMON";
+ else if (section == SHN_BEFORE)
+ res = "BEFORE";
+ else if (section == SHN_AFTER)
+ res = "AFTER";
+ else if ((section < SHN_LORESERVE || section == SHN_XINDEX)
+ && (size_t) section < shnum)
+ {
+ int idx = section != SHN_XINDEX ? section : xsection;
+
+ if (scnnames != NULL)
+ res = scnnames[idx];
+ else
+ {
+ snprintf (buf, len, "%d", idx);
+ res = buf;
+ }
+ }
+ else
+ {
+ /* Handle OS-specific section names. */
+ if (section == SHN_XINDEX)
+ snprintf (buf, len, "%s: %d", "XINDEX", xsection);
+ else if (section >= SHN_LOOS && section <= SHN_HIOS)
+ snprintf (buf, len, "LOOS+%x", section - SHN_LOOS);
+ /* Handle processor-specific section names. */
+ else if (section >= SHN_LOPROC && section <= SHN_HIPROC)
+ snprintf (buf, len, "LOPROC+%x", section - SHN_LOPROC);
+ else if (section >= SHN_LORESERVE && section <= SHN_HIRESERVE)
+ snprintf (buf, len, "LORESERVE+%x", section - SHN_LORESERVE);
+ else
+ snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblsectionstripp.c b/src/libebl/eblsectionstripp.c
new file mode 100644
index 00000000..9aa7502c
--- /dev/null
+++ b/src/libebl/eblsectionstripp.c
@@ -0,0 +1,88 @@
+/* Check whether section can be stripped.
+ Copyright (C) 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include "libeblP.h"
+
+
+bool
+ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr,
+ const char *name, bool remove_comment,
+ bool only_remove_debug)
+{
+ /* If only debug information should be removed check the name. There
+ is unfortunately no other way. */
+ if (unlikely (only_remove_debug))
+ {
+ if (ebl_debugscn_p (ebl, name))
+ return true;
+
+ if (shdr->sh_type == SHT_RELA || shdr->sh_type == SHT_REL)
+ {
+ Elf_Scn *scn_l = elf_getscn (ebl->elf, (shdr)->sh_info);
+ GElf_Shdr shdr_mem_l;
+ GElf_Shdr *shdr_l = gelf_getshdr (scn_l, &shdr_mem_l);
+ if (shdr_l == NULL)
+ {
+ const char *s_l = elf_strptr (ebl->elf, ehdr->e_shstrndx,
+ shdr_l->sh_name);
+ if (s_l != NULL && ebl_debugscn_p (ebl, s_l))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ return SECTION_STRIP_P (shdr, name, remove_comment);
+}
diff --git a/src/libebl/eblsectiontypename.c b/src/libebl/eblsectiontypename.c
new file mode 100644
index 00000000..a37e5f6d
--- /dev/null
+++ b/src/libebl/eblsectiontypename.c
@@ -0,0 +1,148 @@
+/* Return section type name.
+ Copyright (C) 2001, 2002, 2006, 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_section_type_name (ebl, section, buf, len)
+ Ebl *ebl;
+ int section;
+ char *buf;
+ size_t len;
+{
+ const char *res = ebl->section_type_name (section, buf, len);
+
+ if (res == NULL)
+ {
+ static const char *knowntypes[] =
+ {
+#define KNOWNSTYPE(name) [SHT_##name] = #name
+ KNOWNSTYPE (NULL),
+ KNOWNSTYPE (PROGBITS),
+ KNOWNSTYPE (SYMTAB),
+ KNOWNSTYPE (STRTAB),
+ KNOWNSTYPE (RELA),
+ KNOWNSTYPE (HASH),
+ KNOWNSTYPE (DYNAMIC),
+ KNOWNSTYPE (NOTE),
+ KNOWNSTYPE (NOBITS),
+ KNOWNSTYPE (REL),
+ KNOWNSTYPE (SHLIB),
+ KNOWNSTYPE (DYNSYM),
+ KNOWNSTYPE (INIT_ARRAY),
+ KNOWNSTYPE (FINI_ARRAY),
+ KNOWNSTYPE (PREINIT_ARRAY),
+ KNOWNSTYPE (GROUP),
+ KNOWNSTYPE (SYMTAB_SHNDX)
+ };
+
+ /* Handle standard names. */
+ if ((size_t) section < sizeof (knowntypes) / sizeof (knowntypes[0])
+ && knowntypes[section] != NULL)
+ res = knowntypes[section];
+ /* The symbol versioning/Sun extensions. */
+ else if (section >= SHT_LOSUNW && section <= SHT_HISUNW)
+ {
+ static const char *sunwtypes[] =
+ {
+#undef KNOWNSTYPE
+#define KNOWNSTYPE(name) [SHT_##name - SHT_LOSUNW] = #name
+ KNOWNSTYPE (SUNW_move),
+ KNOWNSTYPE (SUNW_COMDAT),
+ KNOWNSTYPE (SUNW_syminfo),
+ KNOWNSTYPE (GNU_verdef),
+ KNOWNSTYPE (GNU_verneed),
+ KNOWNSTYPE (GNU_versym)
+ };
+ res = sunwtypes[section - SHT_LOSUNW];
+ }
+ else
+ /* A few GNU additions. */
+ switch (section)
+ {
+ case SHT_CHECKSUM:
+ res = "CHECKSUM";
+ break;
+ case SHT_GNU_LIBLIST:
+ res = "GNU_LIBLIST";
+ break;
+ case SHT_GNU_HASH:
+ res = "GNU_HASH";
+ break;
+ case SHT_GNU_ATTRIBUTES:
+ res = "GNU_ATTRIBUTES";
+ break;
+
+ default:
+ /* Handle OS-specific section names. */
+ if (section >= SHT_LOOS && section <= SHT_HIOS)
+ snprintf (buf, len, "SHT_LOOS+%x", section - SHT_LOOS);
+ /* Handle processor-specific section names. */
+ else if (section >= SHT_LOPROC && section <= SHT_HIPROC)
+ snprintf (buf, len, "SHT_LOPROC+%x", section - SHT_LOPROC);
+ else if ((unsigned int) section >= SHT_LOUSER
+ && (unsigned int) section <= SHT_HIUSER)
+ snprintf (buf, len, "SHT_LOUSER+%x", section - SHT_LOUSER);
+ else
+ snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section);
+
+ res = buf;
+ break;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblsegmenttypename.c b/src/libebl/eblsegmenttypename.c
new file mode 100644
index 00000000..8c4c2952
--- /dev/null
+++ b/src/libebl/eblsegmenttypename.c
@@ -0,0 +1,111 @@
+/* Return segment type name.
+ Copyright (C) 2001, 2002, 2004 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_segment_type_name (ebl, segment, buf, len)
+ Ebl *ebl;
+ int segment;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ res = ebl != NULL ? ebl->segment_type_name (segment, buf, len) : NULL;
+ if (res == NULL)
+ {
+ static const char *ptypes[PT_NUM] =
+ {
+#define PTYPE(name) [PT_##name] = #name
+ PTYPE (NULL),
+ PTYPE (LOAD),
+ PTYPE (DYNAMIC),
+ PTYPE (INTERP),
+ PTYPE (NOTE),
+ PTYPE (SHLIB),
+ PTYPE (PHDR),
+ PTYPE (TLS)
+ };
+
+ /* Is it one of the standard segment types? */
+ if (segment >= PT_NULL && segment < PT_NUM)
+ res = ptypes[segment];
+ else if (segment == PT_GNU_EH_FRAME)
+ res = "GNU_EH_FRAME";
+ else if (segment == PT_GNU_STACK)
+ res = "GNU_STACK";
+ else if (segment == PT_GNU_RELRO)
+ res = "GNU_RELRO";
+ else if (segment == PT_SUNWBSS)
+ res = "SUNWBSS";
+ else if (segment == PT_SUNWSTACK)
+ res = "SUNWSTACK";
+ else
+ {
+ if (segment >= PT_LOOS && segment <= PT_HIOS)
+ snprintf (buf, len, "LOOS+%d", segment - PT_LOOS);
+ else if (segment >= PT_LOPROC && segment <= PT_HIPROC)
+ snprintf (buf, len, "LOPROC+%d", segment - PT_LOPROC);
+ else
+ snprintf (buf, len, "%s: %d", gettext ("<unknown>"), segment);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblshflagscombine.c b/src/libebl/eblshflagscombine.c
new file mode 100644
index 00000000..49a65600
--- /dev/null
+++ b/src/libebl/eblshflagscombine.c
@@ -0,0 +1,65 @@
+/* Return combines section header flags value.
+ Copyright (C) 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+GElf_Word
+ebl_sh_flags_combine (ebl, flags1, flags2)
+ Ebl *ebl;
+ GElf_Word flags1;
+ GElf_Word flags2;
+{
+ return ebl->sh_flags_combine (flags1, flags2);
+}
diff --git a/src/libebl/eblstother.c b/src/libebl/eblstother.c
new file mode 100644
index 00000000..ba8c9dac
--- /dev/null
+++ b/src/libebl/eblstother.c
@@ -0,0 +1,64 @@
+/* Check st_other flag.
+ Copyright (C) 2011 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+bool
+ebl_check_st_other_bits (ebl, st_other)
+ Ebl *ebl;
+ unsigned char st_other;
+{
+ return ((st_other ^ GELF_ST_VISIBILITY (st_other)) == 0
+ || ebl->check_st_other_bits (st_other ^ GELF_ST_VISIBILITY (st_other)));
+}
diff --git a/src/libebl/eblstrtab.c b/src/libebl/eblstrtab.c
new file mode 100644
index 00000000..4222cfd5
--- /dev/null
+++ b/src/libebl/eblstrtab.c
@@ -0,0 +1,379 @@
+/* ELF string table handling.
+ Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <inttypes.h>
+#include <libelf.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/param.h>
+
+#include "libebl.h"
+#include <system.h>
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+struct Ebl_Strent
+{
+ const char *string;
+ size_t len;
+ struct Ebl_Strent *next;
+ struct Ebl_Strent *left;
+ struct Ebl_Strent *right;
+ size_t offset;
+ char reverse[0];
+};
+
+
+struct memoryblock
+{
+ struct memoryblock *next;
+ char memory[0];
+};
+
+
+struct Ebl_Strtab
+{
+ struct Ebl_Strent *root;
+ struct memoryblock *memory;
+ char *backp;
+ size_t left;
+ size_t total;
+ bool nullstr;
+
+ struct Ebl_Strent null;
+};
+
+
+/* Cache for the pagesize. */
+static size_t ps;
+/* We correct this value a bit so that `malloc' is not allocating more
+ than a page. */
+#define MALLOC_OVERHEAD (2 * sizeof (void *))
+
+
+struct Ebl_Strtab *
+ebl_strtabinit (bool nullstr)
+{
+ if (ps == 0)
+ {
+ ps = sysconf (_SC_PAGESIZE);
+ assert (sizeof (struct memoryblock) < ps - MALLOC_OVERHEAD);
+ }
+
+ struct Ebl_Strtab *ret
+ = (struct Ebl_Strtab *) calloc (1, sizeof (struct Ebl_Strtab));
+ if (ret != NULL)
+ {
+ ret->nullstr = nullstr;
+
+ if (nullstr)
+ {
+ ret->null.len = 1;
+ ret->null.string = "";
+ }
+ }
+
+ return ret;
+}
+
+
+static int
+morememory (struct Ebl_Strtab *st, size_t len)
+{
+ size_t overhead = offsetof (struct memoryblock, memory);
+ len += overhead + MALLOC_OVERHEAD;
+
+ /* Allocate nearest multiple of pagesize >= len. */
+ len = ((len / ps) + (len % ps != 0)) * ps - MALLOC_OVERHEAD;
+
+ struct memoryblock *newmem = (struct memoryblock *) malloc (len);
+ if (newmem == NULL)
+ return 1;
+
+ newmem->next = st->memory;
+ st->memory = newmem;
+ st->backp = newmem->memory;
+ st->left = len - overhead;
+
+ return 0;
+}
+
+
+void
+ebl_strtabfree (struct Ebl_Strtab *st)
+{
+ struct memoryblock *mb = st->memory;
+
+ while (mb != NULL)
+ {
+ void *old = mb;
+ mb = mb->next;
+ free (old);
+ }
+
+ free (st);
+}
+
+
+static struct Ebl_Strent *
+newstring (struct Ebl_Strtab *st, const char *str, size_t len)
+{
+ /* Compute the amount of padding needed to make the structure aligned. */
+ size_t align = ((__alignof__ (struct Ebl_Strent)
+ - (((uintptr_t) st->backp)
+ & (__alignof__ (struct Ebl_Strent) - 1)))
+ & (__alignof__ (struct Ebl_Strent) - 1));
+
+ /* Make sure there is enough room in the memory block. */
+ if (st->left < align + sizeof (struct Ebl_Strent) + len)
+ {
+ if (morememory (st, sizeof (struct Ebl_Strent) + len))
+ return NULL;
+
+ align = 0;
+ }
+
+ /* Create the reserved string. */
+ struct Ebl_Strent *newstr = (struct Ebl_Strent *) (st->backp + align);
+ newstr->string = str;
+ newstr->len = len;
+ newstr->next = NULL;
+ newstr->left = NULL;
+ newstr->right = NULL;
+ newstr->offset = 0;
+ for (int i = len - 2; i >= 0; --i)
+ newstr->reverse[i] = str[len - 2 - i];
+ newstr->reverse[len - 1] = '\0';
+ st->backp += align + sizeof (struct Ebl_Strent) + len;
+ st->left -= align + sizeof (struct Ebl_Strent) + len;
+
+ return newstr;
+}
+
+
+/* XXX This function should definitely be rewritten to use a balancing
+ tree algorith (AVL, red-black trees). For now a simple, correct
+ implementation is enough. */
+static struct Ebl_Strent **
+searchstring (struct Ebl_Strent **sep, struct Ebl_Strent *newstr)
+{
+ /* More strings? */
+ if (*sep == NULL)
+ {
+ *sep = newstr;
+ return sep;
+ }
+
+ /* Compare the strings. */
+ int cmpres = memcmp ((*sep)->reverse, newstr->reverse,
+ MIN ((*sep)->len, newstr->len) - 1);
+ if (cmpres == 0)
+ /* We found a matching string. */
+ return sep;
+ else if (cmpres > 0)
+ return searchstring (&(*sep)->left, newstr);
+ else
+ return searchstring (&(*sep)->right, newstr);
+}
+
+
+/* Add new string. The actual string is assumed to be permanent. */
+struct Ebl_Strent *
+ebl_strtabadd (struct Ebl_Strtab *st, const char *str, size_t len)
+{
+ /* Compute the string length if the caller doesn't know it. */
+ if (len == 0)
+ len = strlen (str) + 1;
+
+ /* Make sure all "" strings get offset 0 but only if the table was
+ created with a special null entry in mind. */
+ if (len == 1 && st->null.string != NULL)
+ return &st->null;
+
+ /* Allocate memory for the new string and its associated information. */
+ struct Ebl_Strent *newstr = newstring (st, str, len);
+ if (newstr == NULL)
+ return NULL;
+
+ /* Search in the array for the place to insert the string. If there
+ is no string with matching prefix and no string with matching
+ leading substring, create a new entry. */
+ struct Ebl_Strent **sep = searchstring (&st->root, newstr);
+ if (*sep != newstr)
+ {
+ /* This is not the same entry. This means we have a prefix match. */
+ if ((*sep)->len > newstr->len)
+ {
+ /* Check whether we already know this string. */
+ for (struct Ebl_Strent *subs = (*sep)->next; subs != NULL;
+ subs = subs->next)
+ if (subs->len == newstr->len)
+ {
+ /* We have an exact match with a substring. Free the memory
+ we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ return subs;
+ }
+
+ /* We have a new substring. This means we don't need the reverse
+ string of this entry anymore. */
+ st->backp -= newstr->len;
+ st->left += newstr->len;
+
+ newstr->next = (*sep)->next;
+ (*sep)->next = newstr;
+ }
+ else if ((*sep)->len != newstr->len)
+ {
+ /* When we get here it means that the string we are about to
+ add has a common prefix with a string we already have but
+ it is longer. In this case we have to put it first. */
+ st->total += newstr->len - (*sep)->len;
+ newstr->next = *sep;
+ newstr->left = (*sep)->left;
+ newstr->right = (*sep)->right;
+ *sep = newstr;
+ }
+ else
+ {
+ /* We have an exact match. Free the memory we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ newstr = *sep;
+ }
+ }
+ else
+ st->total += newstr->len;
+
+ return newstr;
+}
+
+
+static void
+copystrings (struct Ebl_Strent *nodep, char **freep, size_t *offsetp)
+{
+ if (nodep->left != NULL)
+ copystrings (nodep->left, freep, offsetp);
+
+ /* Process the current node. */
+ nodep->offset = *offsetp;
+ *freep = (char *) mempcpy (*freep, nodep->string, nodep->len);
+ *offsetp += nodep->len;
+
+ for (struct Ebl_Strent *subs = nodep->next; subs != NULL; subs = subs->next)
+ {
+ assert (subs->len < nodep->len);
+ subs->offset = nodep->offset + nodep->len - subs->len;
+ assert (subs->offset != 0 || subs->string[0] == '\0');
+ }
+
+ if (nodep->right != NULL)
+ copystrings (nodep->right, freep, offsetp);
+}
+
+
+void
+ebl_strtabfinalize (struct Ebl_Strtab *st, Elf_Data *data)
+{
+ size_t nulllen = st->nullstr ? 1 : 0;
+
+ /* Fill in the information. */
+ data->d_buf = malloc (st->total + nulllen);
+ if (data->d_buf == NULL)
+ abort ();
+
+ /* The first byte must always be zero if we created the table with a
+ null string. */
+ if (st->nullstr)
+ *((char *) data->d_buf) = '\0';
+
+ data->d_type = ELF_T_BYTE;
+ data->d_size = st->total + nulllen;
+ data->d_off = 0;
+ data->d_align = 1;
+ data->d_version = EV_CURRENT;
+
+ /* Now run through the tree and add all the string while also updating
+ the offset members of the elfstrent records. */
+ char *endp = (char *) data->d_buf + nulllen;
+ size_t copylen = nulllen;
+ if (st->root)
+ copystrings (st->root, &endp, &copylen);
+ assert (copylen == st->total + nulllen);
+}
+
+
+size_t
+ebl_strtaboffset (struct Ebl_Strent *se)
+{
+ return se->offset;
+}
+
+
+const char *
+ebl_string (struct Ebl_Strent *se)
+{
+ assert (se->string != NULL);
+
+ return se->string;
+}
diff --git a/src/libebl/eblsymbolbindingname.c b/src/libebl/eblsymbolbindingname.c
new file mode 100644
index 00000000..334a9c3e
--- /dev/null
+++ b/src/libebl/eblsymbolbindingname.c
@@ -0,0 +1,99 @@
+/* Return symbol binding name.
+ Copyright (C) 2001, 2002, 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_symbol_binding_name (ebl, binding, buf, len)
+ Ebl *ebl;
+ int binding;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ res = ebl != NULL ? ebl->symbol_type_name (binding, buf, len) : NULL;
+ if (res == NULL)
+ {
+ static const char *stb_names[STB_NUM] =
+ {
+ "LOCAL", "GLOBAL", "WEAK"
+ };
+
+ /* Standard binding? */
+ if (binding < STB_NUM)
+ res = stb_names[binding];
+ else
+ {
+ char *ident;
+
+ if (binding >= STB_LOPROC && binding <= STB_HIPROC)
+ snprintf (buf, len, "LOPROC+%d", binding - STB_LOPROC);
+ else if (binding == STB_GNU_UNIQUE
+ && (ident = elf_getident (ebl->elf, NULL)) != NULL
+ && ident[EI_OSABI] == ELFOSABI_LINUX)
+ return "GNU_UNIQUE";
+ else if (binding >= STB_LOOS && binding <= STB_HIOS)
+ snprintf (buf, len, "LOOS+%d", binding - STB_LOOS);
+ else
+ snprintf (buf, len, gettext ("<unknown>: %d"), binding);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblsymboltypename.c b/src/libebl/eblsymboltypename.c
new file mode 100644
index 00000000..f2ac6222
--- /dev/null
+++ b/src/libebl/eblsymboltypename.c
@@ -0,0 +1,105 @@
+/* Return symbol type name.
+ Copyright (C) 2001, 2002, 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <libeblP.h>
+
+
+const char *
+ebl_symbol_type_name (ebl, symbol, buf, len)
+ Ebl *ebl;
+ int symbol;
+ char *buf;
+ size_t len;
+{
+ const char *res;
+
+ res = ebl != NULL ? ebl->symbol_type_name (symbol, buf, len) : NULL;
+ if (res == NULL)
+ {
+ static const char *stt_names[STT_NUM] =
+ {
+ [STT_NOTYPE] = "NOTYPE",
+ [STT_OBJECT] = "OBJECT",
+ [STT_FUNC] = "FUNC",
+ [STT_SECTION] = "SECTION",
+ [STT_FILE] = "FILE",
+ [STT_COMMON] = "COMMON",
+ [STT_TLS] = "TLS"
+ };
+
+ /* Standard type? */
+ if (symbol < STT_NUM)
+ res = stt_names[symbol];
+ else
+ {
+ char *ident;
+
+ if (symbol >= STT_LOPROC && symbol <= STT_HIPROC)
+ snprintf (buf, len, "LOPROC+%d", symbol - STT_LOPROC);
+ else if (symbol == STT_GNU_IFUNC
+ && (ident = elf_getident (ebl->elf, NULL)) != NULL
+ && ident[EI_OSABI] == ELFOSABI_LINUX)
+ return "GNU_IFUNC";
+ else if (symbol >= STT_LOOS && symbol <= STT_HIOS)
+ snprintf (buf, len, "LOOS+%d", symbol - STT_LOOS);
+ else
+ snprintf (buf, len, gettext ("<unknown>: %d"), symbol);
+
+ res = buf;
+ }
+ }
+
+ return res;
+}
diff --git a/src/libebl/eblsysvhashentrysize.c b/src/libebl/eblsysvhashentrysize.c
new file mode 100644
index 00000000..341979c1
--- /dev/null
+++ b/src/libebl/eblsysvhashentrysize.c
@@ -0,0 +1,63 @@
+/* Return OS ABI name
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+
+
+int
+ebl_sysvhash_entrysize (ebl)
+ Ebl *ebl;
+{
+ return ebl->sysvhash_entrysize;
+}
diff --git a/src/libebl/eblwstrtab.c b/src/libebl/eblwstrtab.c
new file mode 100644
index 00000000..f29c0c7a
--- /dev/null
+++ b/src/libebl/eblwstrtab.c
@@ -0,0 +1,380 @@
+/* ELF string table handling.
+ Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <inttypes.h>
+#include <libelf.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <sys/param.h>
+
+#include "libebl.h"
+#include <system.h>
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+struct Ebl_WStrent
+{
+ const wchar_t *string;
+ size_t len;
+ struct Ebl_WStrent *next;
+ struct Ebl_WStrent *left;
+ struct Ebl_WStrent *right;
+ size_t offset;
+ wchar_t reverse[0];
+};
+
+
+struct memoryblock
+{
+ struct memoryblock *next;
+ char memory[0];
+};
+
+
+struct Ebl_WStrtab
+{
+ struct Ebl_WStrent *root;
+ struct memoryblock *memory;
+ char *backp;
+ size_t left;
+ size_t total;
+ bool nullstr;
+
+ struct Ebl_WStrent null;
+};
+
+
+/* Cache for the pagesize. We correct this value a bit so that `malloc'
+ is not allocating more than a page. */
+static size_t ps;
+
+
+struct Ebl_WStrtab *
+ebl_wstrtabinit (bool nullstr)
+{
+ struct Ebl_WStrtab *ret;
+
+ if (ps == 0)
+ {
+ ps = sysconf (_SC_PAGESIZE) - 2 * sizeof (void *);
+ assert (sizeof (struct memoryblock) < ps);
+ }
+
+ ret = (struct Ebl_WStrtab *) calloc (1, sizeof (struct Ebl_WStrtab));
+ if (ret != NULL)
+ {
+ ret->nullstr = nullstr;
+ if (nullstr)
+ {
+ ret->null.len = 1;
+ ret->null.string = L"";
+ }
+ }
+ return ret;
+}
+
+
+static int
+morememory (struct Ebl_WStrtab *st, size_t len)
+{
+ struct memoryblock *newmem;
+
+ if (len < ps)
+ len = ps;
+ newmem = (struct memoryblock *) malloc (len);
+ if (newmem == NULL)
+ return 1;
+
+ newmem->next = st->memory;
+ st->memory = newmem;
+ st->backp = newmem->memory;
+ st->left = len - offsetof (struct memoryblock, memory);
+
+ return 0;
+}
+
+
+void
+ebl_wstrtabfree (struct Ebl_WStrtab *st)
+{
+ struct memoryblock *mb = st->memory;
+
+ while (mb != NULL)
+ {
+ void *old = mb;
+ mb = mb->next;
+ free (old);
+ }
+
+ free (st);
+}
+
+
+static struct Ebl_WStrent *
+newstring (struct Ebl_WStrtab *st, const wchar_t *str, size_t len)
+{
+ struct Ebl_WStrent *newstr;
+ size_t align;
+ int i;
+
+ /* Compute the amount of padding needed to make the structure aligned. */
+ align = ((__alignof__ (struct Ebl_WStrent)
+ - (((uintptr_t) st->backp)
+ & (__alignof__ (struct Ebl_WStrent) - 1)))
+ & (__alignof__ (struct Ebl_WStrent) - 1));
+
+ /* Make sure there is enough room in the memory block. */
+ if (st->left < align + sizeof (struct Ebl_WStrent) + len * sizeof (wchar_t))
+ {
+ if (morememory (st,
+ sizeof (struct Ebl_WStrent) + len * sizeof (wchar_t)))
+ return NULL;
+
+ align = 0;
+ }
+
+ /* Create the reserved string. */
+ newstr = (struct Ebl_WStrent *) (st->backp + align);
+ newstr->string = str;
+ newstr->len = len;
+ newstr->next = NULL;
+ newstr->left = NULL;
+ newstr->right = NULL;
+ newstr->offset = 0;
+ for (i = len - 2; i >= 0; --i)
+ newstr->reverse[i] = str[len - 2 - i];
+ newstr->reverse[len - 1] = L'\0';
+ st->backp += align + sizeof (struct Ebl_WStrent) + len * sizeof (wchar_t);
+ st->left -= align + sizeof (struct Ebl_WStrent) + len * sizeof (wchar_t);
+
+ return newstr;
+}
+
+
+/* XXX This function should definitely be rewritten to use a balancing
+ tree algorith (AVL, red-black trees). For now a simple, correct
+ implementation is enough. */
+static struct Ebl_WStrent **
+searchstring (struct Ebl_WStrent **sep, struct Ebl_WStrent *newstr)
+{
+ int cmpres;
+
+ /* More strings? */
+ if (*sep == NULL)
+ {
+ *sep = newstr;
+ return sep;
+ }
+
+ /* Compare the strings. */
+ cmpres = wmemcmp ((*sep)->reverse, newstr->reverse,
+ MIN ((*sep)->len, newstr->len) - 1);
+ if (cmpres == 0)
+ /* We found a matching string. */
+ return sep;
+ else if (cmpres > 0)
+ return searchstring (&(*sep)->left, newstr);
+ else
+ return searchstring (&(*sep)->right, newstr);
+}
+
+
+/* Add new string. The actual string is assumed to be permanent. */
+struct Ebl_WStrent *
+ebl_wstrtabadd (struct Ebl_WStrtab *st, const wchar_t *str, size_t len)
+{
+ struct Ebl_WStrent *newstr;
+ struct Ebl_WStrent **sep;
+
+ /* Compute the string length if the caller doesn't know it. */
+ if (len == 0)
+ len = wcslen (str) + 1;
+
+ /* Make sure all "" strings get offset 0 but only if the table was
+ created with a special null entry in mind. */
+ if (len == 1 && st->null.string != NULL)
+ return &st->null;
+
+ /* Allocate memory for the new string and its associated information. */
+ newstr = newstring (st, str, len);
+ if (newstr == NULL)
+ return NULL;
+
+ /* Search in the array for the place to insert the string. If there
+ is no string with matching prefix and no string with matching
+ leading substring, create a new entry. */
+ sep = searchstring (&st->root, newstr);
+ if (*sep != newstr)
+ {
+ /* This is not the same entry. This means we have a prefix match. */
+ if ((*sep)->len > newstr->len)
+ {
+ struct Ebl_WStrent *subs;
+
+ /* Check whether we already know this string. */
+ for (subs = (*sep)->next; subs != NULL; subs = subs->next)
+ if (subs->len == newstr->len)
+ {
+ /* We have an exact match with a substring. Free the memory
+ we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ return subs;
+ }
+
+ /* We have a new substring. This means we don't need the reverse
+ string of this entry anymore. */
+ st->backp -= newstr->len;
+ st->left += newstr->len;
+
+ newstr->next = (*sep)->next;
+ (*sep)->next = newstr;
+ }
+ else if ((*sep)->len != newstr->len)
+ {
+ /* When we get here it means that the string we are about to
+ add has a common prefix with a string we already have but
+ it is longer. In this case we have to put it first. */
+ st->total += newstr->len - (*sep)->len;
+ newstr->next = *sep;
+ newstr->left = (*sep)->left;
+ newstr->right = (*sep)->right;
+ *sep = newstr;
+ }
+ else
+ {
+ /* We have an exact match. Free the memory we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ newstr = *sep;
+ }
+ }
+ else
+ st->total += newstr->len;
+
+ return newstr;
+}
+
+
+static void
+copystrings (struct Ebl_WStrent *nodep, wchar_t **freep, size_t *offsetp)
+{
+ struct Ebl_WStrent *subs;
+
+ if (nodep->left != NULL)
+ copystrings (nodep->left, freep, offsetp);
+
+ /* Process the current node. */
+ nodep->offset = *offsetp;
+ *freep = wmempcpy (*freep, nodep->string, nodep->len);
+ *offsetp += nodep->len * sizeof (wchar_t);
+
+ for (subs = nodep->next; subs != NULL; subs = subs->next)
+ {
+ assert (subs->len < nodep->len);
+ subs->offset = nodep->offset + nodep->len - subs->len;
+ assert (subs->offset != 0 || subs->string[0] == '\0');
+ }
+
+ if (nodep->right != NULL)
+ copystrings (nodep->right, freep, offsetp);
+}
+
+
+void
+ebl_wstrtabfinalize (struct Ebl_WStrtab *st, Elf_Data *data)
+{
+ size_t copylen;
+ wchar_t *endp;
+ size_t nulllen = st->nullstr ? 1 : 0;
+
+ /* Fill in the information. */
+ data->d_buf = malloc ((st->total + nulllen) * sizeof (wchar_t));
+ if (data->d_buf == NULL)
+ abort ();
+
+ /* The first byte must always be zero if we created the table with a
+ null string. */
+ if (st->nullstr)
+ *((wchar_t *) data->d_buf) = L'\0';
+
+ data->d_type = ELF_T_BYTE;
+ data->d_size = st->total + nulllen;
+ data->d_off = 0;
+ data->d_align = 1;
+ data->d_version = EV_CURRENT;
+
+ /* Now run through the tree and add all the string while also updating
+ the offset members of the elfstrent records. */
+ endp = (wchar_t *) data->d_buf + nulllen;
+ copylen = sizeof (wchar_t) * nulllen;
+ copystrings (st->root, &endp, &copylen);
+ assert (copylen == (st->total + nulllen) * sizeof (wchar_t));
+}
+
+
+size_t
+ebl_wstrtaboffset (struct Ebl_WStrent *se)
+{
+ return se->offset;
+}
diff --git a/src/libebl/libebl.h b/src/libebl/libebl.h
new file mode 100644
index 00000000..3a334024
--- /dev/null
+++ b/src/libebl/libebl.h
@@ -0,0 +1,404 @@
+/* Interface for libebl.
+ Copyright (C) 2000-2010 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifndef _LIBEBL_H
+#define _LIBEBL_H 1
+
+#include <gelf.h>
+#include "libdw.h"
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "elf-knowledge.h"
+
+
+/* Opaque type for the handle. */
+typedef struct ebl Ebl;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Get backend handle for object associated with ELF handle. */
+extern Ebl *ebl_openbackend (Elf *elf);
+/* Similar but without underlying ELF file. */
+extern Ebl *ebl_openbackend_machine (GElf_Half machine);
+/* Similar but with emulation name given. */
+extern Ebl *ebl_openbackend_emulation (const char *emulation);
+
+/* Free resources allocated for backend handle. */
+extern void ebl_closebackend (Ebl *bh);
+
+
+/* Information about the descriptor. */
+
+/* Get ELF machine. */
+extern int ebl_get_elfmachine (Ebl *ebl) __attribute__ ((__pure__));
+
+/* Get ELF class. */
+extern int ebl_get_elfclass (Ebl *ebl) __attribute__ ((__pure__));
+
+/* Get ELF data encoding. */
+extern int ebl_get_elfdata (Ebl *ebl) __attribute__ ((__pure__));
+
+
+/* Function to call the callback functions including default ELF
+ handling. */
+
+/* Return backend name. */
+extern const char *ebl_backend_name (Ebl *ebl);
+
+/* Return relocation type name. */
+extern const char *ebl_object_type_name (Ebl *ebl, int object,
+ char *buf, size_t len);
+
+/* Return relocation type name. */
+extern const char *ebl_reloc_type_name (Ebl *ebl, int reloc,
+ char *buf, size_t len);
+
+/* Check relocation type. */
+extern bool ebl_reloc_type_check (Ebl *ebl, int reloc);
+
+/* Check relocation type use. */
+extern bool ebl_reloc_valid_use (Ebl *ebl, int reloc);
+
+/* Check if relocation type is for simple absolute relocations.
+ Return ELF_T_{BYTE,HALF,SWORD,SXWORD} for a simple type, else ELF_T_NUM. */
+extern Elf_Type ebl_reloc_simple_type (Ebl *ebl, int reloc);
+
+/* Return true if the symbol type is that referencing the GOT. E.g.,
+ R_386_GOTPC. */
+extern bool ebl_gotpc_reloc_check (Ebl *ebl, int reloc);
+
+/* Return segment type name. */
+extern const char *ebl_segment_type_name (Ebl *ebl, int segment,
+ char *buf, size_t len);
+
+/* Return section type name. */
+extern const char *ebl_section_type_name (Ebl *ebl, int section,
+ char *buf, size_t len);
+
+/* Return section name. */
+extern const char *ebl_section_name (Ebl *ebl, int section, int xsection,
+ char *buf, size_t len,
+ const char *scnnames[], size_t shnum);
+
+/* Return machine flag names. */
+extern const char *ebl_machine_flag_name (Ebl *ebl, GElf_Word flags,
+ char *buf, size_t len);
+
+/* Check whether machine flag is valid. */
+extern bool ebl_machine_flag_check (Ebl *ebl, GElf_Word flags);
+
+/* Check whether SHF_MASKPROC flags are valid. */
+extern bool ebl_machine_section_flag_check (Ebl *ebl, GElf_Xword flags);
+
+/* Check whether the section with the given index, header, and name
+ is a special machine section that is valid despite a combination
+ of flags or other details that are not generically valid. */
+extern bool ebl_check_special_section (Ebl *ebl, int ndx,
+ const GElf_Shdr *shdr, const char *name);
+
+/* Return symbol type name. */
+extern const char *ebl_symbol_type_name (Ebl *ebl, int symbol,
+ char *buf, size_t len);
+
+/* Return symbol binding name. */
+extern const char *ebl_symbol_binding_name (Ebl *ebl, int binding,
+ char *buf, size_t len);
+
+/* Return dynamic tag name. */
+extern const char *ebl_dynamic_tag_name (Ebl *ebl, int64_t tag,
+ char *buf, size_t len);
+
+/* Check dynamic tag. */
+extern bool ebl_dynamic_tag_check (Ebl *ebl, int64_t tag);
+
+/* Check whether given symbol's st_value and st_size are OK despite failing
+ normal checks. */
+extern bool ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr,
+ const GElf_Sym *sym, const char *name,
+ const GElf_Shdr *destshdr);
+
+/* Check whether only valid bits are set on the st_other symbol flag. */
+extern bool ebl_check_st_other_bits (Ebl *ebl, unsigned char st_other);
+
+/* Return combined section header flags value. */
+extern GElf_Word ebl_sh_flags_combine (Ebl *ebl, GElf_Word flags1,
+ GElf_Word flags2);
+
+/* Return symbolic representation of OS ABI. */
+extern const char *ebl_osabi_name (Ebl *ebl, int osabi, char *buf, size_t len);
+
+
+/* Return name of the note section type for a core file. */
+extern const char *ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf,
+ size_t len);
+
+/* Return name of the note section type for an object file. */
+extern const char *ebl_object_note_type_name (Ebl *ebl, const char *name,
+ uint32_t type, char *buf,
+ size_t len);
+
+/* Print information about object note if available. */
+extern void ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
+ uint32_t descsz, const char *desc);
+
+/* Check whether an attribute in a .gnu_attributes section is recognized.
+ Fills in *TAG_NAME with the name for this tag.
+ If VALUE is a known value for that tag, also fills in *VALUE_NAME. */
+extern bool ebl_check_object_attribute (Ebl *ebl, const char *vendor,
+ int tag, uint64_t value,
+ const char **tag_name,
+ const char **value_name);
+
+
+/* Check section name for being that of a debug informatino section. */
+extern bool ebl_debugscn_p (Ebl *ebl, const char *name);
+
+/* Check whether given relocation is a copy relocation. */
+extern bool ebl_copy_reloc_p (Ebl *ebl, int reloc);
+
+/* Check whether given relocation is a no-op relocation. */
+extern bool ebl_none_reloc_p (Ebl *ebl, int reloc);
+
+/* Check whether given relocation is a relative relocation. */
+extern bool ebl_relative_reloc_p (Ebl *ebl, int reloc);
+
+/* Check whether section should be stripped. */
+extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr,
+ const GElf_Shdr *shdr, const char *name,
+ bool remove_comment, bool only_remove_debug);
+
+/* Check if backend uses a bss PLT in this file. */
+extern bool ebl_bss_plt_p (Ebl *ebl, GElf_Ehdr *ehdr);
+
+/* Return size of entry in SysV-style hash table. */
+extern int ebl_sysvhash_entrysize (Ebl *ebl);
+
+/* Return location expression to find return value given a
+ DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing
+ function itself (whose DW_AT_type attribute describes its return type).
+ Returns -1 for a libdw error (see dwarf_errno).
+ Returns -2 for an unrecognized type formation.
+ Returns zero if the function has no return value (e.g. "void" in C).
+ Otherwise, *LOCOPS gets a location expression to find the return value,
+ and returns the number of operations in the expression. The pointer is
+ permanently allocated at least as long as the Ebl handle is open. */
+extern int ebl_return_value_location (Ebl *ebl,
+ Dwarf_Die *functypedie,
+ const Dwarf_Op **locops);
+
+/* Fill in register information given DWARF register numbers.
+ If NAME is null, return the maximum REGNO + 1 that has a name.
+ Otherwise, store in NAME the name for DWARF register number REGNO
+ and return the number of bytes written (including '\0' terminator).
+ Return -1 if NAMELEN is too short or REGNO is negative or too large.
+ Return 0 if REGNO is unused (a gap in the DWARF number assignment).
+ On success, set *SETNAME to a description like "integer" or "FPU"
+ fit for "%s registers" title display, and *PREFIX to the string
+ that precedes NAME in canonical assembler syntax (e.g. "%" or "$").
+ The NAME string contains identifier characters only (maybe just digits). */
+extern ssize_t ebl_register_info (Ebl *ebl,
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type);
+
+/* Fill in the DWARF register numbers for the registers used in system calls.
+ The SP and PC are what kernel reports call the user stack pointer and PC.
+ The CALLNO and ARGS are the system call number and incoming arguments.
+ Each of these is filled with the DWARF register number corresponding,
+ or -1 if there is none. Returns zero when the information is available. */
+extern int ebl_syscall_abi (Ebl *ebl, int *sp, int *pc,
+ int *callno, int args[6]);
+
+/* Supply the ABI-specified state of DWARF CFI before CIE initial programs.
+
+ The DWARF 3.0 spec says that the default initial states of all registers
+ are "undefined", unless otherwise specified by the machine/compiler ABI.
+
+ This default is wrong for every machine with the CFI generated by GCC.
+ The EH unwinder does not really distinguish "same_value" and "undefined",
+ since it doesn't matter for unwinding (in either case there is no change
+ to make for that register). GCC generates CFI that says nothing at all
+ about registers it hasn't spilled somewhere. For our unwinder to give
+ the true story, the backend must supply an initial state that uses
+ "same_value" rules for all the callee-saves registers.
+
+ This can fill in the initial_instructions, initial_instructions_end
+ members of *ABI_INFO to point at a CFI instruction stream to process
+ before each CIE's initial instructions. It should set the
+ data_alignment_factor member if it affects the initial instructions.
+
+ As a shorthand for some common cases, for this instruction stream
+ we overload some CFI instructions that cannot be used in a CIE:
+
+ DW_CFA_restore -- Change default rule for all unmentioned
+ registers from undefined to same_value.
+
+ This function can also fill in ABI_INFO->return_address_register with the
+ DWARF register number that identifies the actual PC in machine state.
+ If there is no canonical DWARF register number with that meaning, it's
+ left unchanged (callers usually initialize with (Dwarf_Word) -1).
+ This value is not used by CFI per se. */
+extern int ebl_abi_cfi (Ebl *ebl, Dwarf_CIE *abi_info)
+ __nonnull_attribute__ (2);
+
+/* ELF string table handling. */
+struct Ebl_Strtab;
+struct Ebl_Strent;
+
+/* Create new ELF string table object in memory. */
+extern struct Ebl_Strtab *ebl_strtabinit (bool nullstr);
+
+/* Free resources allocated for ELF string table ST. */
+extern void ebl_strtabfree (struct Ebl_Strtab *st);
+
+/* Add string STR (length LEN is != 0) to ELF string table ST. */
+extern struct Ebl_Strent *ebl_strtabadd (struct Ebl_Strtab *st,
+ const char *str, size_t len);
+
+/* Finalize string table ST and store size and memory location information
+ in DATA. */
+extern void ebl_strtabfinalize (struct Ebl_Strtab *st, Elf_Data *data);
+
+/* Get offset in string table for string associated with SE. */
+extern size_t ebl_strtaboffset (struct Ebl_Strent *se);
+
+/* Return the string associated with SE. */
+extern const char *ebl_string (struct Ebl_Strent *se);
+
+
+/* ELF wide char string table handling. */
+struct Ebl_WStrtab;
+struct Ebl_WStrent;
+
+/* Create new ELF wide char string table object in memory. */
+extern struct Ebl_WStrtab *ebl_wstrtabinit (bool nullstr);
+
+/* Free resources allocated for ELF wide char string table ST. */
+extern void ebl_wstrtabfree (struct Ebl_WStrtab *st);
+
+/* Add string STR (length LEN is != 0) to ELF string table ST. */
+extern struct Ebl_WStrent *ebl_wstrtabadd (struct Ebl_WStrtab *st,
+ const wchar_t *str, size_t len);
+
+/* Finalize string table ST and store size and memory location information
+ in DATA. */
+extern void ebl_wstrtabfinalize (struct Ebl_WStrtab *st, Elf_Data *data);
+
+/* Get offset in wide char string table for string associated with SE. */
+extern size_t ebl_wstrtaboffset (struct Ebl_WStrent *se);
+
+
+/* Generic string table handling. */
+struct Ebl_GStrtab;
+struct Ebl_GStrent;
+
+/* Create new string table object in memory. */
+extern struct Ebl_GStrtab *ebl_gstrtabinit (unsigned int width, bool nullstr);
+
+/* Free resources allocated for string table ST. */
+extern void ebl_gstrtabfree (struct Ebl_GStrtab *st);
+
+/* Add string STR (length LEN is != 0) to string table ST. */
+extern struct Ebl_GStrent *ebl_gstrtabadd (struct Ebl_GStrtab *st,
+ const char *str, size_t len);
+
+/* Finalize string table ST and store size and memory location information
+ in DATA. */
+extern void ebl_gstrtabfinalize (struct Ebl_GStrtab *st, Elf_Data *data);
+
+/* Get offset in wide char string table for string associated with SE. */
+extern size_t ebl_gstrtaboffset (struct Ebl_GStrent *se);
+
+
+/* Register map info. */
+typedef struct
+{
+ Dwarf_Half offset; /* Byte offset in register data block. */
+ Dwarf_Half regno; /* DWARF register number. */
+ uint8_t bits; /* Bits of data for one register. */
+ uint8_t pad; /* Bytes of padding after register's data. */
+ Dwarf_Half count; /* Consecutive register numbers here. */
+} Ebl_Register_Location;
+
+/* Non-register data items in core notes. */
+typedef struct
+{
+ const char *name; /* Printable identifier. */
+ const char *group; /* Identifier for category of related items. */
+ Dwarf_Half offset; /* Byte offset in note data. */
+ Dwarf_Half count;
+ Elf_Type type;
+ char format;
+ bool thread_identifier;
+} Ebl_Core_Item;
+
+/* Describe the format of a core file note with the given header and NAME.
+ NAME is not guaranteed terminated, it's NHDR->n_namesz raw bytes. */
+extern int ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name,
+ GElf_Word *regs_offset, size_t *nregloc,
+ const Ebl_Register_Location **reglocs,
+ size_t *nitems, const Ebl_Core_Item **items)
+ __nonnull_attribute__ (1, 2, 3, 4, 5, 6, 7, 8);
+
+/* Describe the auxv type number. */
+extern int ebl_auxv_info (Ebl *ebl, GElf_Xword a_type,
+ const char **name, const char **format)
+ __nonnull_attribute__ (1, 3, 4);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* libebl.h */
diff --git a/src/libebl/libeblP.h b/src/libebl/libeblP.h
new file mode 100644
index 00000000..32a43728
--- /dev/null
+++ b/src/libebl/libeblP.h
@@ -0,0 +1,103 @@
+/* Internal definitions for interface for libebl.
+ Copyright (C) 2000-2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils 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; version 2 of the License.
+
+ Red Hat elfutils 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 Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifndef _LIBEBLP_H
+#define _LIBEBLP_H 1
+
+#include <gelf.h>
+#include <libasm.h>
+#include <libebl.h>
+#include <libintl.h>
+
+
+/* Backend handle. */
+struct ebl
+{
+ /* Machine name. */
+ const char *name;
+
+ /* Emulation name. */
+ const char *emulation;
+
+ /* ELF machine, class, and data encoding. */
+ uint_fast16_t machine;
+ uint_fast8_t class;
+ uint_fast8_t data;
+
+ /* The libelf handle (if known). */
+ Elf *elf;
+
+ /* See ebl-hooks.h for the declarations of the hook functions. */
+# define EBLHOOK(name) (*name)
+# include "ebl-hooks.h"
+# undef EBLHOOK
+
+ /* Size of entry in Sysv-style hash table. */
+ int sysvhash_entrysize;
+
+ /* Internal data. */
+ void *dlhandle;
+};
+
+
+/* Type of the initialization functions in the backend modules. */
+typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t);
+
+
+/* gettext helper macros. */
+#undef _
+#define _(Str) dgettext ("elfutils", Str)
+
+
+/* LEB128 constant helper macros. */
+#define ULEB128_7(x) (BUILD_BUG_ON_ZERO ((x) >= (1U << 7)) + (x))
+
+#define BUILD_BUG_ON_ZERO(x) (sizeof (char [(x) ? -1 : 1]) - 1)
+
+#endif /* libeblP.h */