Commit 6aea5cda authored by Koen Kooi's avatar Koen Kooi

eglibc 2.12: import from oe-core

Signed-off-by: default avatarKoen Kooi <koen@dominion.thruhere.net>
parent ea53d5c6
DESCRIPTION = "Cross locale generation tool for eglibc"
HOMEPAGE = "http://www.eglibc.org/home"
SECTION = "libs"
LICENSE = "LGPL"
LIC_DIR = "${WORKDIR}/${EGLIBC_BRANCH}/libc"
LIC_FILES_CHKSUM = "file://${LIC_DIR}/LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
file://${LIC_DIR}/COPYING;md5=393a5ca445f6965873eca0259a17f833 \
file://${LIC_DIR}/posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
file://${LIC_DIR}/COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
inherit native
inherit autotools
PR = "r1"
SRCREV="11982"
EGLIBC_BRANCH="eglibc-2_12"
SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http "
S = "${WORKDIR}/${EGLIBC_BRANCH}/localedef"
do_unpack_append() {
bb.build.exec_func('do_move_ports', d)
}
do_move_ports() {
if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then
rm -rf ${WORKDIR}/libc/ports
mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${WORKDIR}/libc/
fi
}
EXTRA_OECONF = "--with-glibc=${WORKDIR}/${EGLIBC_BRANCH}/libc"
do_configure () {
./configure ${EXTRA_OECONF}
}
do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}/localedef ${D}${bindir}/cross-localedef
}
Upstream-Status: Pending
import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html
Index: libc/bits/stdio-lock.h
===================================================================
--- libc.orig/bits/stdio-lock.h 2009-10-28 14:34:19.000000000 -0700
+++ libc/bits/stdio-lock.h 2009-10-28 14:34:54.000000000 -0700
@@ -50,6 +50,8 @@ __libc_lock_define_recursive (typedef, _
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
_IO_flockfile (_fp)
+# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
+
# define _IO_release_lock(_fp) \
_IO_funlockfile (_fp); \
_IO_cleanup_region_end (0)
Source: http://sourceware.org/bugzilla/show_bug.cgi?id=12097
Upstream-Status: Submitted
The patch should be merged into glibc-ports
-Khem
Index: libc/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S
===================================================================
--- libc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S
+++ libc/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S
@@ -16,6 +16,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#if defined(__thumb__)
+
#include <sysdep.h>
/* Out-of-line syscall stub. We expect the system call number in ip
@@ -41,3 +43,5 @@ ENTRY (__libc_do_syscall)
pop {r7, pc}
.fnend
END (__libc_do_syscall)
+
+#endif /* __thumb__ */
Upstream-Status: Pending
In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: warning: implicit declaration of function 'THREAD_GETMEM'
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'THREAD_SELF' undeclared (first use in this function)
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: (Each undeclared identifier is reported only once
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: for each function it appears in.)
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'header' undeclared (first use in this function)
make[4]: *** [/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os] Error 1
--- libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h.orig
+++ libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
@@ -25,6 +25,7 @@
#include <atomic.h>
#include <sysdep.h>
#include <kernel-features.h>
+#include <tls.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#!/usr/bin/make
include $(IN)
all:
rm -f $(OUT)
touch $(OUT)
for locale in $(SUPPORTED-LOCALES); do \
[ $$locale = true ] && continue; \
echo $$locale | sed 's,/, ,' >> $(OUT); \
done
Upstream-Status: Inappropriate [embedded specific]
The default lib search path order is:
1) LD_LIBRARY_PATH
2) RPATH from the binary
3) ld.so.cache
4) default search paths embedded in the linker
For nativesdk binaries which are being used alongside binaries on a host system, we
need the search paths to firstly search the shipped nativesdk libs but then also
cover the host system. For example we want the host system's libGL and this may be
in a non-standard location like /usr/lib/mesa. The only place the location is know
about is in the ld.so.cache of the host system.
Since nativesdk has a simple structure and doesn't need to use a cache itself, we
repurpose the cache for use as a last resort in finding host system binaries. This
means we need to switch the order of 3 and 4 above to make this work effectively.
RP 14/10/2010
Index: libc/elf/dl-load.c
===================================================================
--- libc.orig/elf/dl-load.c
+++ libc/elf/dl-load.c
@@ -2107,6 +2107,15 @@ _dl_map_object (struct link_map *loader,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
+ /* try the default path. */
+ if (fd == -1
+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
+ && rtld_search_dirs.dirs != (void *) -1)
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
+
+ /* Finally try ld.so.cache */
if (fd == -1
&& (__builtin_expect (! (mode & __RTLD_SECURE), 1)
|| ! INTUSE(__libc_enable_secure)))
@@ -2169,14 +2178,6 @@ _dl_map_object (struct link_map *loader,
}
}
- /* Finally, try the default path. */
- if (fd == -1
- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
- || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
- && rtld_search_dirs.dirs != (void *) -1)
- fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
-
/* Add another newline when we are tracing the library loading. */
if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_printf ("\n");
Upstream-Status: Pending
On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
section if a --version-script sets _RLD_MAP to local. This is apparently
a binutils bug, but libc shouldn't segfault in this case.
see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615
9/19/2010 - added by Qing He <qing.he@intel.com>
---
diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h
--- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h 2009-05-16 16:36:20.000000000 +0800
+++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h 2010-09-19 09:11:53.000000000 +0800
@@ -70,7 +70,8 @@
/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
with the run-time address of the r_debug structure */
#define ELF_MACHINE_DEBUG_SETUP(l,r) \
-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
+do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
+ (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
*(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
(ElfW(Addr)) (r); \
} while (0)
We now pass --with-cpu option to eglibc this ends up with configure errors if we do
not pass a cpu which eglibc has support for in sysdeps
| checking sysdep dirs... configure: error: The 603e subspecies of powerpc is not supported.
| + bbfatal 'oe_runconf failed'
| + echo 'ERROR: oe_runconf failed'
We fix this by adding the 603e sub directories with Implies to generic
powerpc to overcome this error
Upstream-Status: Inappropriate [OE config related]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Index: libc/ports/sysdeps/powerpc/powerpc32/603e/Implies
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ libc/ports/sysdeps/powerpc/powerpc32/603e/Implies 2011-09-17 19:18:57.593292084 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32
Index: libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/Implies
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/Implies 2011-09-17 19:17:48.613292100 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32
Upstream-Status: Pending
Source: http://sourceware.org/ml/libc-alpha/2010-03/msg00064.html
This patch scratches an itch. Each individual gcc command in the
glibc build is over 1K, which means it takes up a good chunk of my
terminal. Most of that is include paths. Any version of GCC new
enough to build glibc supports response files, which were added in
2005. So use a response file for the static list of include paths.
Now the build commands are a lot shorter, and easier to use when
developing glibc.
Tested on x86_64-linux-gnu. Please apply if acceptable.
--
Daniel Jacobowitz
CodeSourcery
2010-03-30 Daniel Jacobowitz <dan@codesourcery.com>
* Makeconfig (+common-includes): Define.
(+includes): Use @$(common-objpfx)includes.
* Makefile (postclean): Remove includes and includes.mk.
* Makerules ($(common-objpfx)includes.mk): Include and create
includes.mk. Create includes.
Index: libc/Makeconfig
===================================================================
--- libc.orig/Makeconfig 2009-10-13 22:55:12.000000000 -0700
+++ libc/Makeconfig 2010-03-31 16:02:37.120489733 -0700
@@ -678,9 +678,10 @@ endif # $(+cflags) == ""
# library source directory, in the include directory, and in the
# current directory.
+sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
++common-includes = $(+sysdep-includes) $(includes) $(sysincludes)
+includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
- $(+sysdep-includes) $(includes) \
- $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
+ @$(common-objpfx)includes \
+ $(patsubst %/,-I%,$(..)) $(libio-include) -I.
# Since libio has several internal header files, we use a -I instead
# of many little headers in the include directory.
Index: libc/Makefile
===================================================================
--- libc.orig/Makefile 2009-12-09 12:06:28.000000000 -0800
+++ libc/Makefile 2010-03-31 16:02:37.132481508 -0700
@@ -247,7 +247,7 @@ parent-mostlyclean: common-mostlyclean #
parent-clean: parent-mostlyclean common-clean
postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
- $(addprefix $(objpfx),sysd-dirs sysd-rules) \
+ $(addprefix $(objpfx),sysd-dirs sysd-rules includes includes.mk) \
$(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
clean: parent-clean
Index: libc/Makerules
===================================================================
--- libc.orig/Makerules 2009-12-09 12:06:28.000000000 -0800
+++ libc/Makerules 2010-03-31 16:02:37.140481645 -0700
@@ -254,6 +254,20 @@ ifndef sysd-rules-done
no_deps=t
endif
+-include $(common-objpfx)includes.mk
+ifneq ($(+common-includes),$(saved-includes))
+# Recreate includes.mk (and includes).
+includes-force = FORCE
+FORCE:
+endif
+$(common-objpfx)includes.mk: $(includes-force)
+ -@rm -f $@T $(common-objpfx)includesT
+ for inc in $(+common-includes); do echo "$$inc"; done \
+ > $(common-objpfx)includesT
+ mv -f $(common-objpfx)includesT $(common-objpfx)includes
+ echo 'saved-includes := $(+common-includes)' > $@T
+ mv -f $@T $@
+
define o-iterator-doit
$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
endef
require eglibc_${PV}.bb
require recipes-core/eglibc/eglibc-initial.inc
do_configure_prepend () {
unset CFLAGS
}
require recipes-core/eglibc/eglibc-locale.inc
require recipes-core/eglibc/eglibc.inc
DEPENDS += "gperf-native"
PR = "r27"
SRCREV = "14158"
EGLIBC_BRANCH="eglibc-2_12"
SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \
file://eglibc-svn-arm-lowlevellock-include-tls.patch \
file://IO-acquire-lock-fix.patch \
file://shorten-build-commands.patch \
file://mips-rld-map-check.patch \
file://armv4-eabi-compile-fix.patch \
file://ppc-enable-603e-cpu.patch \
file://etc/ld.so.conf \
file://generate-supported.mk \
"
SRC_URI_append_virtclass-nativesdk = " file://ld-search-order.patch"
S = "${WORKDIR}/${EGLIBC_BRANCH}/libc"
B = "${WORKDIR}/build-${TARGET_SYS}"
PACKAGES_DYNAMIC = "libc6*"
RPROVIDES_${PN}-dev = "libc6-dev virtual-libc-dev"
PROVIDES_${PN}-dbg = "glibc-dbg"
# the -isystem in bitbake.conf screws up glibc do_stage
BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${layout_includedir}"
GLIBC_ADDONS ?= "ports,nptl,libidn"
GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1"
FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/eglibc-${PV}', '${FILE_DIRNAME}/eglibc', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
#
# For now, we will skip building of a gcc package if it is a uclibc one
# and our build is not a uclibc one, and we skip a glibc one if our build
# is a uclibc build.
#
# See the note in gcc/gcc_3.4.0.oe
#
python __anonymous () {
import bb, re
uc_os = (re.match('.*uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None)
if uc_os:
raise bb.parse.SkipPackage("incompatible with target %s" %
bb.data.getVar('TARGET_OS', d, 1))
}
export libc_cv_slibdir = "${base_libdir}"
EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
--without-cvs --disable-profile --disable-debug --without-gd \
--enable-clocale=gnu \
--enable-add-ons=${GLIBC_ADDONS},ports \
--with-headers=${STAGING_INCDIR} \
--without-selinux \
${GLIBC_EXTRA_OECONF}"
EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
do_unpack_append() {
bb.build.exec_func('do_move_ports', d)
}
do_move_ports() {
if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then
rm -rf ${S}/ports
mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${S}/
fi
}
do_configure () {
# override this function to avoid the autoconf/automake/aclocal/autoheader
# calls for now
# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
# version check and doesn't really help with anything
if [ -z "`which rpcgen`" ]; then
echo "rpcgen not found. Install glibc-devel."
exit 1
fi
(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
find ${S} -name "configure" | xargs touch
CPPFLAGS="" oe_runconf
}
rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
do_compile () {
# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
unset LDFLAGS
base_do_compile
(
cd ${S}/sunrpc/rpcsvc
for r in ${rpcsvc}; do
h=`echo $r|sed -e's,\.x$,.h,'`
rpcgen -h $r -o $h || bbwarn "unable to generate header for $r"
done
)
}
require recipes-core/eglibc/eglibc-package.inc
BBCLASSEXTEND = "nativesdk"
Upstream-Status: Inappropriate [embedded specific]
We run the ldconfig in the cross fashion. make the code bitsize aware so that
we can cross build ldconfig cache for various architectures.
Richard Purdie <richard.purdie@linuxfoundation.org> 2009/05/19
Nitin A Kamble <nitin.a.kamble@intel.com> 2009/03/29
Index: ldconfig-native-2.12.1/readelflib.c
===================================================================
--- ldconfig-native-2.12.1.orig/readelflib.c
+++ ldconfig-native-2.12.1/readelflib.c
@@ -40,39 +40,212 @@ do \
/* Returns 0 if everything is ok, != 0 in case of error. */
int
-process_elf_file (const char *file_name, const char *lib, int *flag,
+process_elf_file32 (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, char **soname, void *file_contents,
size_t file_length)
{
int i;
unsigned int j;
- ElfW(Addr) loadaddr;
+ Elf32_Addr loadaddr;
unsigned int dynamic_addr;
size_t dynamic_size;
char *program_interpreter;
- ElfW(Ehdr) *elf_header;
- ElfW(Phdr) *elf_pheader, *segment;
- ElfW(Dyn) *dynamic_segment, *dyn_entry;
+ Elf32_Ehdr *elf_header;
+ Elf32_Phdr *elf_pheader, *segment;
+ Elf32_Dyn *dynamic_segment, *dyn_entry;
char *dynamic_strings;
- elf_header = (ElfW(Ehdr) *) file_contents;
+ elf_header = (Elf32_Ehdr *) file_contents;
*osversion = 0;
- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
+ if (elf_header->e_type != ET_DYN)
{
- if (opt_verbose)
+ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
+ elf_header->e_type);
+ return 1;
+ }
+
+ /* Get information from elf program header. */
+ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents);
+ check_ptr (elf_pheader);
+
+ /* The library is an elf library, now search for soname and
+ libc5/libc6. */
+ *flag = FLAG_ELF;
+
+ loadaddr = -1;
+ dynamic_addr = 0;
+ dynamic_size = 0;
+ program_interpreter = NULL;
+ for (i = 0, segment = elf_pheader;
+ i < elf_header->e_phnum; i++, segment++)
+ {
+ check_ptr (segment);
+
+ switch (segment->p_type)
{
- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name);
- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name);
- else
- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
+ case PT_LOAD:
+ if (loadaddr == (Elf32_Addr) -1)
+ loadaddr = segment->p_vaddr - segment->p_offset;
+ break;
+
+ case PT_DYNAMIC:
+ if (dynamic_addr)
+ error (0, 0, _("more than one dynamic segment\n"));
+
+ dynamic_addr = segment->p_offset;
+ dynamic_size = segment->p_filesz;
+ break;
+
+ case PT_INTERP:
+ program_interpreter = (char *) (file_contents + segment->p_offset);
+ check_ptr (program_interpreter);
+
+ /* Check if this is enough to classify the binary. */
+ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
+ ++j)
+ if (strcmp (program_interpreter, interpreters[j].soname) == 0)
+ {
+ *flag = interpreters[j].flag;
+ break;
+ }
+ break;
+
+ case PT_NOTE:
+ if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
+ {
+ Elf32_Word *abi_note = (Elf32_Word *) (file_contents
+ + segment->p_offset);
+ Elf32_Addr size = segment->p_filesz;
+
+ while (abi_note [0] != 4 || abi_note [1] != 16
+ || abi_note [2] != 1
+ || memcmp (abi_note + 3, "GNU", 4) != 0)
+ {
+#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word)))
+ Elf32_Addr) note_size = 3 * sizeof (Elf32_Word))
+ + ROUND (abi_note[0])
+ + ROUND (abi_note[1]);
+
+ if (size - 32 < note_size || note_size == 0)
+ {
+ size = 0;
+ break;
+ }
+ size -= note_size;
+ abi_note = (void *) abi_note + note_size;
+ }
+
+ if (size == 0)
+ break;
+
+ *osversion = (abi_note [4] << 24) |
+ ((abi_note [5] & 0xff) << 16) |
+ ((abi_note [6] & 0xff) << 8) |
+ (abi_note [7] & 0xff);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ if (loadaddr == (Elf32_Addr) -1)
+ {
+ /* Very strange. */
+ loadaddr = 0;
+ }
+
+ /* Now we can read the dynamic sections. */
+ if (dynamic_size == 0)
+ return 1;
+
+ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr);
+ check_ptr (dynamic_segment);
+
+ /* Find the string table. */
+ dynamic_strings = NULL;
+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
+ ++dyn_entry)
+ {
+ check_ptr (dyn_entry);
+ if (dyn_entry->d_tag == DT_STRTAB)
+ {
+ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
+ check_ptr (dynamic_strings);
+ break;
}
- return 1;
}
+ if (dynamic_strings == NULL)
+ return 1;
+
+ /* Now read the DT_NEEDED and DT_SONAME entries. */
+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
+ ++dyn_entry)
+ {
+ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
+ {
+ char *name = dynamic_strings + dyn_entry->d_un.d_val;
+ check_ptr (name);
+
+ if (dyn_entry->d_tag == DT_NEEDED)
+ {
+
+ if (*flag == FLAG_ELF)
+ {
+ /* Check if this is enough to classify the binary. */
+ for (j = 0;
+ j < sizeof (known_libs) / sizeof (known_libs [0]);
+ ++j)
+ if (strcmp (name, known_libs [j].soname) == 0)
+ {
+ *flag = known_libs [j].flag;
+ break;
+ }
+ }
+ }
+
+ else if (dyn_entry->d_tag == DT_SONAME)
+ *soname = xstrdup (name);
+
+ /* Do we have everything we need? */
+ if (*soname && *flag != FLAG_ELF)
+ return 0;
+ }
+ }
+
+ /* We reach this point only if the file doesn't contain a DT_SONAME
+ or if we can't classify the library. If it doesn't have a
+ soname, return the name of the library. */
+ if (*soname == NULL)
+ *soname = xstrdup (lib);
+
+ return 0;
+}
+
+int
+process_elf_file64 (const char *file_name, const char *lib, int *flag,
+ unsigned int *osversion, char **soname, void *file_contents,
+ size_t file_length)
+{
+ int i;
+ unsigned int j;
+ Elf64_Addr loadaddr;
+ unsigned int dynamic_addr;
+ size_t dynamic_size;
+ char *program_interpreter;
+
+ Elf64_Ehdr *elf_header;
+ Elf64_Phdr *elf_pheader, *segment;
+ Elf64_Dyn *dynamic_segment, *dyn_entry;
+ char *dynamic_strings;
+
+ elf_header = (Elf64_Ehdr *) file_contents;
+ *osversion = 0;
+
if (elf_header->e_type != ET_DYN)
{
error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
@@ -81,7 +254,7 @@ process_elf_file (const char *file_name,
}
/* Get information from elf program header. */
- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
+ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents);
check_ptr (elf_pheader);
/* The library is an elf library, now search for soname and
@@ -100,7 +273,7 @@ process_elf_file (const char *file_name,
switch (segment->p_type)
{
case PT_LOAD:
- if (loadaddr == (ElfW(Addr)) -1)
+ if (loadaddr == (Elf64_Addr) -1)
loadaddr = segment->p_vaddr - segment->p_offset;
break;
@@ -129,16 +302,16 @@ process_elf_file (const char *file_name,
case PT_NOTE:
if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
{
- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
+ Elf64_Word *abi_note = (Elf64_Word *) (file_contents
+ segment->p_offset);
- ElfW(Addr) size = segment->p_filesz;
+ Elf64_Addr size = segment->p_filesz;
while (abi_note [0] != 4 || abi_note [1] != 16
|| abi_note [2] != 1
|| memcmp (abi_note + 3, "GNU", 4) != 0)
{
-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
- ElfW(Addr) note_size = 3 * sizeof (ElfW(Word))
+#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word))