diff options
| author | Koen Kooi <koen@dominion.thruhere.net> | 2011-10-06 16:12:16 +0200 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-10-06 17:46:45 +0200 |
| commit | 6aea5cdadffc2dfc0beba228003ee979e02e9e9e (patch) | |
| tree | 3eb85036e8bff0fc77cc8ff160d64122f45c0df1 | |
| parent | ea53d5c61b3c9100c51089ce613e1387cd711357 (diff) | |
| download | meta-openembedded-6aea5cdadffc2dfc0beba228003ee979e02e9e9e.tar.gz | |
eglibc 2.12: import from oe-core
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
22 files changed, 1884 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/eglibc/cross-localedef-native_2.12.bb b/meta-oe/recipes-core/eglibc/cross-localedef-native_2.12.bb new file mode 100644 index 0000000000..52759afe60 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/cross-localedef-native_2.12.bb | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | DESCRIPTION = "Cross locale generation tool for eglibc" | ||
| 2 | HOMEPAGE = "http://www.eglibc.org/home" | ||
| 3 | SECTION = "libs" | ||
| 4 | LICENSE = "LGPL" | ||
| 5 | |||
| 6 | LIC_DIR = "${WORKDIR}/${EGLIBC_BRANCH}/libc" | ||
| 7 | LIC_FILES_CHKSUM = "file://${LIC_DIR}/LICENSES;md5=07a394b26e0902b9ffdec03765209770 \ | ||
| 8 | file://${LIC_DIR}/COPYING;md5=393a5ca445f6965873eca0259a17f833 \ | ||
| 9 | file://${LIC_DIR}/posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ | ||
| 10 | file://${LIC_DIR}/COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff " | ||
| 11 | |||
| 12 | |||
| 13 | inherit native | ||
| 14 | inherit autotools | ||
| 15 | |||
| 16 | PR = "r1" | ||
| 17 | SRCREV="11982" | ||
| 18 | EGLIBC_BRANCH="eglibc-2_12" | ||
| 19 | SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http " | ||
| 20 | S = "${WORKDIR}/${EGLIBC_BRANCH}/localedef" | ||
| 21 | |||
| 22 | do_unpack_append() { | ||
| 23 | bb.build.exec_func('do_move_ports', d) | ||
| 24 | } | ||
| 25 | |||
| 26 | do_move_ports() { | ||
| 27 | if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then | ||
| 28 | rm -rf ${WORKDIR}/libc/ports | ||
| 29 | mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${WORKDIR}/libc/ | ||
| 30 | fi | ||
| 31 | } | ||
| 32 | |||
| 33 | EXTRA_OECONF = "--with-glibc=${WORKDIR}/${EGLIBC_BRANCH}/libc" | ||
| 34 | |||
| 35 | do_configure () { | ||
| 36 | ./configure ${EXTRA_OECONF} | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | do_install() { | ||
| 41 | install -d ${D}${bindir} | ||
| 42 | install -m 0755 ${S}/localedef ${D}${bindir}/cross-localedef | ||
| 43 | } | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/IO-acquire-lock-fix.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/IO-acquire-lock-fix.patch new file mode 100644 index 0000000000..46b1584fa6 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/IO-acquire-lock-fix.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | Upstream-Status: Pending | ||
| 2 | |||
| 3 | import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html | ||
| 4 | |||
| 5 | Index: libc/bits/stdio-lock.h | ||
| 6 | =================================================================== | ||
| 7 | --- libc.orig/bits/stdio-lock.h 2009-10-28 14:34:19.000000000 -0700 | ||
| 8 | +++ libc/bits/stdio-lock.h 2009-10-28 14:34:54.000000000 -0700 | ||
| 9 | @@ -50,6 +50,8 @@ __libc_lock_define_recursive (typedef, _ | ||
| 10 | _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \ | ||
| 11 | _IO_flockfile (_fp) | ||
| 12 | |||
| 13 | +# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp) | ||
| 14 | + | ||
| 15 | # define _IO_release_lock(_fp) \ | ||
| 16 | _IO_funlockfile (_fp); \ | ||
| 17 | _IO_cleanup_region_end (0) | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/armv4-eabi-compile-fix.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/armv4-eabi-compile-fix.patch new file mode 100644 index 0000000000..c2407eea09 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/armv4-eabi-compile-fix.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | Source: http://sourceware.org/bugzilla/show_bug.cgi?id=12097 | ||
| 2 | Upstream-Status: Submitted | ||
| 3 | |||
| 4 | The patch should be merged into glibc-ports | ||
| 5 | |||
| 6 | -Khem | ||
| 7 | Index: libc/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S | ||
| 8 | =================================================================== | ||
| 9 | --- libc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S | ||
| 10 | +++ libc/ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S | ||
| 11 | @@ -16,6 +16,8 @@ | ||
| 12 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 13 | 02111-1307 USA. */ | ||
| 14 | |||
| 15 | +#if defined(__thumb__) | ||
| 16 | + | ||
| 17 | #include <sysdep.h> | ||
| 18 | |||
| 19 | /* Out-of-line syscall stub. We expect the system call number in ip | ||
| 20 | @@ -41,3 +43,5 @@ ENTRY (__libc_do_syscall) | ||
| 21 | pop {r7, pc} | ||
| 22 | .fnend | ||
| 23 | END (__libc_do_syscall) | ||
| 24 | + | ||
| 25 | +#endif /* __thumb__ */ | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/eglibc-svn-arm-lowlevellock-include-tls.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/eglibc-svn-arm-lowlevellock-include-tls.patch new file mode 100644 index 0000000000..1e7dfa7848 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/eglibc-svn-arm-lowlevellock-include-tls.patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | Upstream-Status: Pending | ||
| 2 | |||
| 3 | In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21: | ||
| 4 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private': | ||
| 5 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: warning: implicit declaration of function 'THREAD_GETMEM' | ||
| 6 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'THREAD_SELF' undeclared (first use in this function) | ||
| 7 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: (Each undeclared identifier is reported only once | ||
| 8 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: for each function it appears in.) | ||
| 9 | ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'header' undeclared (first use in this function) | ||
| 10 | 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 | ||
| 11 | |||
| 12 | --- libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h.orig | ||
| 13 | +++ libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h | ||
| 14 | @@ -25,6 +25,7 @@ | ||
| 15 | #include <atomic.h> | ||
| 16 | #include <sysdep.h> | ||
| 17 | #include <kernel-features.h> | ||
| 18 | +#include <tls.h> | ||
| 19 | |||
| 20 | #define FUTEX_WAIT 0 | ||
| 21 | #define FUTEX_WAKE 1 | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/etc/ld.so.conf b/meta-oe/recipes-core/eglibc/eglibc-2.12/etc/ld.so.conf new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/etc/ld.so.conf | |||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/generate-supported.mk b/meta-oe/recipes-core/eglibc/eglibc-2.12/generate-supported.mk new file mode 100644 index 0000000000..d2a28c2dc6 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/generate-supported.mk | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #!/usr/bin/make | ||
| 2 | |||
| 3 | include $(IN) | ||
| 4 | |||
| 5 | all: | ||
| 6 | rm -f $(OUT) | ||
| 7 | touch $(OUT) | ||
| 8 | for locale in $(SUPPORTED-LOCALES); do \ | ||
| 9 | [ $$locale = true ] && continue; \ | ||
| 10 | echo $$locale | sed 's,/, ,' >> $(OUT); \ | ||
| 11 | done | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch new file mode 100644 index 0000000000..40ae6d37f4 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | ||
| 2 | |||
| 3 | The default lib search path order is: | ||
| 4 | |||
| 5 | 1) LD_LIBRARY_PATH | ||
| 6 | 2) RPATH from the binary | ||
| 7 | 3) ld.so.cache | ||
| 8 | 4) default search paths embedded in the linker | ||
| 9 | |||
| 10 | For nativesdk binaries which are being used alongside binaries on a host system, we | ||
| 11 | need the search paths to firstly search the shipped nativesdk libs but then also | ||
| 12 | cover the host system. For example we want the host system's libGL and this may be | ||
| 13 | in a non-standard location like /usr/lib/mesa. The only place the location is know | ||
| 14 | about is in the ld.so.cache of the host system. | ||
| 15 | |||
| 16 | Since nativesdk has a simple structure and doesn't need to use a cache itself, we | ||
| 17 | repurpose the cache for use as a last resort in finding host system binaries. This | ||
| 18 | means we need to switch the order of 3 and 4 above to make this work effectively. | ||
| 19 | |||
| 20 | RP 14/10/2010 | ||
| 21 | |||
| 22 | Index: libc/elf/dl-load.c | ||
| 23 | =================================================================== | ||
| 24 | --- libc.orig/elf/dl-load.c | ||
| 25 | +++ libc/elf/dl-load.c | ||
| 26 | @@ -2107,6 +2107,15 @@ _dl_map_object (struct link_map *loader, | ||
| 27 | &loader->l_runpath_dirs, &realname, &fb, loader, | ||
| 28 | LA_SER_RUNPATH, &found_other_class); | ||
| 29 | |||
| 30 | + /* try the default path. */ | ||
| 31 | + if (fd == -1 | ||
| 32 | + && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL | ||
| 33 | + || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) | ||
| 34 | + && rtld_search_dirs.dirs != (void *) -1) | ||
| 35 | + fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, | ||
| 36 | + &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); | ||
| 37 | + | ||
| 38 | + /* Finally try ld.so.cache */ | ||
| 39 | if (fd == -1 | ||
| 40 | && (__builtin_expect (! (mode & __RTLD_SECURE), 1) | ||
| 41 | || ! INTUSE(__libc_enable_secure))) | ||
| 42 | @@ -2169,14 +2178,6 @@ _dl_map_object (struct link_map *loader, | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | - /* Finally, try the default path. */ | ||
| 47 | - if (fd == -1 | ||
| 48 | - && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL | ||
| 49 | - || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) | ||
| 50 | - && rtld_search_dirs.dirs != (void *) -1) | ||
| 51 | - fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, | ||
| 52 | - &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); | ||
| 53 | - | ||
| 54 | /* Add another newline when we are tracing the library loading. */ | ||
| 55 | if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) | ||
| 56 | _dl_debug_printf ("\n"); | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch new file mode 100644 index 0000000000..186c705e56 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | Upstream-Status: Pending | ||
| 2 | |||
| 3 | On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic | ||
| 4 | section if a --version-script sets _RLD_MAP to local. This is apparently | ||
| 5 | a binutils bug, but libc shouldn't segfault in this case. | ||
| 6 | |||
| 7 | see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615 | ||
| 8 | |||
| 9 | 9/19/2010 - added by Qing He <qing.he@intel.com> | ||
| 10 | --- | ||
| 11 | diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h | ||
| 12 | --- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h 2009-05-16 16:36:20.000000000 +0800 | ||
| 13 | +++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h 2010-09-19 09:11:53.000000000 +0800 | ||
| 14 | @@ -70,7 +70,8 @@ | ||
| 15 | /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in | ||
| 16 | with the run-time address of the r_debug structure */ | ||
| 17 | #define ELF_MACHINE_DEBUG_SETUP(l,r) \ | ||
| 18 | -do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \ | ||
| 19 | +do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \ | ||
| 20 | + (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \ | ||
| 21 | *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \ | ||
| 22 | (ElfW(Addr)) (r); \ | ||
| 23 | } while (0) | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/ppc-enable-603e-cpu.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/ppc-enable-603e-cpu.patch new file mode 100644 index 0000000000..5c90e5bae0 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/ppc-enable-603e-cpu.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | We now pass --with-cpu option to eglibc this ends up with configure errors if we do | ||
| 2 | not pass a cpu which eglibc has support for in sysdeps | ||
| 3 | |||
| 4 | | checking sysdep dirs... configure: error: The 603e subspecies of powerpc is not supported. | ||
| 5 | | + bbfatal 'oe_runconf failed' | ||
| 6 | | + echo 'ERROR: oe_runconf failed' | ||
| 7 | |||
| 8 | We fix this by adding the 603e sub directories with Implies to generic | ||
| 9 | powerpc to overcome this error | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE config related] | ||
| 12 | |||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | |||
| 15 | Index: libc/ports/sysdeps/powerpc/powerpc32/603e/Implies | ||
| 16 | =================================================================== | ||
| 17 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 18 | +++ libc/ports/sysdeps/powerpc/powerpc32/603e/Implies 2011-09-17 19:18:57.593292084 -0700 | ||
| 19 | @@ -0,0 +1 @@ | ||
| 20 | +powerpc/powerpc32 | ||
| 21 | Index: libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/Implies | ||
| 22 | =================================================================== | ||
| 23 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 24 | +++ libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/Implies 2011-09-17 19:17:48.613292100 -0700 | ||
| 25 | @@ -0,0 +1 @@ | ||
| 26 | +powerpc/powerpc32 | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-2.12/shorten-build-commands.patch b/meta-oe/recipes-core/eglibc/eglibc-2.12/shorten-build-commands.patch new file mode 100644 index 0000000000..90e644ec3c --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-2.12/shorten-build-commands.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | Upstream-Status: Pending | ||
| 2 | |||
| 3 | Source: http://sourceware.org/ml/libc-alpha/2010-03/msg00064.html | ||
| 4 | |||
| 5 | This patch scratches an itch. Each individual gcc command in the | ||
| 6 | glibc build is over 1K, which means it takes up a good chunk of my | ||
| 7 | terminal. Most of that is include paths. Any version of GCC new | ||
| 8 | enough to build glibc supports response files, which were added in | ||
| 9 | 2005. So use a response file for the static list of include paths. | ||
| 10 | Now the build commands are a lot shorter, and easier to use when | ||
| 11 | developing glibc. | ||
| 12 | |||
| 13 | Tested on x86_64-linux-gnu. Please apply if acceptable. | ||
| 14 | |||
| 15 | -- | ||
| 16 | Daniel Jacobowitz | ||
| 17 | CodeSourcery | ||
| 18 | |||
| 19 | 2010-03-30 Daniel Jacobowitz <dan@codesourcery.com> | ||
| 20 | |||
| 21 | * Makeconfig (+common-includes): Define. | ||
| 22 | (+includes): Use @$(common-objpfx)includes. | ||
| 23 | * Makefile (postclean): Remove includes and includes.mk. | ||
| 24 | * Makerules ($(common-objpfx)includes.mk): Include and create | ||
| 25 | includes.mk. Create includes. | ||
| 26 | |||
| 27 | Index: libc/Makeconfig | ||
| 28 | =================================================================== | ||
| 29 | --- libc.orig/Makeconfig 2009-10-13 22:55:12.000000000 -0700 | ||
| 30 | +++ libc/Makeconfig 2010-03-31 16:02:37.120489733 -0700 | ||
| 31 | @@ -678,9 +678,10 @@ endif # $(+cflags) == "" | ||
| 32 | # library source directory, in the include directory, and in the | ||
| 33 | # current directory. | ||
| 34 | +sysdep-includes = $(addprefix -I,$(+sysdep_dirs)) | ||
| 35 | ++common-includes = $(+sysdep-includes) $(includes) $(sysincludes) | ||
| 36 | +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \ | ||
| 37 | - $(+sysdep-includes) $(includes) \ | ||
| 38 | - $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) | ||
| 39 | + @$(common-objpfx)includes \ | ||
| 40 | + $(patsubst %/,-I%,$(..)) $(libio-include) -I. | ||
| 41 | |||
| 42 | # Since libio has several internal header files, we use a -I instead | ||
| 43 | # of many little headers in the include directory. | ||
| 44 | Index: libc/Makefile | ||
| 45 | =================================================================== | ||
| 46 | --- libc.orig/Makefile 2009-12-09 12:06:28.000000000 -0800 | ||
| 47 | +++ libc/Makefile 2010-03-31 16:02:37.132481508 -0700 | ||
| 48 | @@ -247,7 +247,7 @@ parent-mostlyclean: common-mostlyclean # | ||
| 49 | parent-clean: parent-mostlyclean common-clean | ||
| 50 | |||
| 51 | postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \ | ||
| 52 | - $(addprefix $(objpfx),sysd-dirs sysd-rules) \ | ||
| 53 | + $(addprefix $(objpfx),sysd-dirs sysd-rules includes includes.mk) \ | ||
| 54 | $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i) | ||
| 55 | |||
| 56 | clean: parent-clean | ||
| 57 | Index: libc/Makerules | ||
| 58 | =================================================================== | ||
| 59 | --- libc.orig/Makerules 2009-12-09 12:06:28.000000000 -0800 | ||
| 60 | +++ libc/Makerules 2010-03-31 16:02:37.140481645 -0700 | ||
| 61 | @@ -254,6 +254,20 @@ ifndef sysd-rules-done | ||
| 62 | no_deps=t | ||
| 63 | endif | ||
| 64 | |||
| 65 | +-include $(common-objpfx)includes.mk | ||
| 66 | +ifneq ($(+common-includes),$(saved-includes)) | ||
| 67 | +# Recreate includes.mk (and includes). | ||
| 68 | +includes-force = FORCE | ||
| 69 | +FORCE: | ||
| 70 | +endif | ||
| 71 | +$(common-objpfx)includes.mk: $(includes-force) | ||
| 72 | + -@rm -f $@T $(common-objpfx)includesT | ||
| 73 | + for inc in $(+common-includes); do echo "$$inc"; done \ | ||
| 74 | + > $(common-objpfx)includesT | ||
| 75 | + mv -f $(common-objpfx)includesT $(common-objpfx)includes | ||
| 76 | + echo 'saved-includes := $(+common-includes)' > $@T | ||
| 77 | + mv -f $@T $@ | ||
| 78 | + | ||
| 79 | define o-iterator-doit | ||
| 80 | $(objpfx)%$o: %.S $(before-compile); $$(compile-command.S) | ||
| 81 | endef | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-initial_2.12.bb b/meta-oe/recipes-core/eglibc/eglibc-initial_2.12.bb new file mode 100644 index 0000000000..6951e526e5 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-initial_2.12.bb | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | require eglibc_${PV}.bb | ||
| 2 | require recipes-core/eglibc/eglibc-initial.inc | ||
| 3 | |||
| 4 | do_configure_prepend () { | ||
| 5 | unset CFLAGS | ||
| 6 | } | ||
diff --git a/meta-oe/recipes-core/eglibc/eglibc-locale_2.12.bb b/meta-oe/recipes-core/eglibc/eglibc-locale_2.12.bb new file mode 100644 index 0000000000..bf682e7939 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc-locale_2.12.bb | |||
| @@ -0,0 +1 @@ | |||
| require recipes-core/eglibc/eglibc-locale.inc | |||
diff --git a/meta-oe/recipes-core/eglibc/eglibc_2.12.bb b/meta-oe/recipes-core/eglibc/eglibc_2.12.bb new file mode 100644 index 0000000000..7bdd629cf3 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/eglibc_2.12.bb | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | require recipes-core/eglibc/eglibc.inc | ||
| 2 | |||
| 3 | DEPENDS += "gperf-native" | ||
| 4 | PR = "r27" | ||
| 5 | |||
| 6 | SRCREV = "14158" | ||
| 7 | |||
| 8 | EGLIBC_BRANCH="eglibc-2_12" | ||
| 9 | SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \ | ||
| 10 | file://eglibc-svn-arm-lowlevellock-include-tls.patch \ | ||
| 11 | file://IO-acquire-lock-fix.patch \ | ||
| 12 | file://shorten-build-commands.patch \ | ||
| 13 | file://mips-rld-map-check.patch \ | ||
| 14 | file://armv4-eabi-compile-fix.patch \ | ||
| 15 | file://ppc-enable-603e-cpu.patch \ | ||
| 16 | file://etc/ld.so.conf \ | ||
| 17 | file://generate-supported.mk \ | ||
| 18 | " | ||
| 19 | SRC_URI_append_virtclass-nativesdk = " file://ld-search-order.patch" | ||
| 20 | S = "${WORKDIR}/${EGLIBC_BRANCH}/libc" | ||
| 21 | B = "${WORKDIR}/build-${TARGET_SYS}" | ||
| 22 | |||
| 23 | PACKAGES_DYNAMIC = "libc6*" | ||
| 24 | RPROVIDES_${PN}-dev = "libc6-dev virtual-libc-dev" | ||
| 25 | PROVIDES_${PN}-dbg = "glibc-dbg" | ||
| 26 | |||
| 27 | # the -isystem in bitbake.conf screws up glibc do_stage | ||
| 28 | BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" | ||
| 29 | TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${layout_includedir}" | ||
| 30 | |||
| 31 | GLIBC_ADDONS ?= "ports,nptl,libidn" | ||
| 32 | |||
| 33 | 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" | ||
| 34 | |||
| 35 | FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/eglibc-${PV}', '${FILE_DIRNAME}/eglibc', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}" | ||
| 36 | |||
| 37 | # | ||
| 38 | # For now, we will skip building of a gcc package if it is a uclibc one | ||
| 39 | # and our build is not a uclibc one, and we skip a glibc one if our build | ||
| 40 | # is a uclibc build. | ||
| 41 | # | ||
| 42 | # See the note in gcc/gcc_3.4.0.oe | ||
| 43 | # | ||
| 44 | |||
| 45 | python __anonymous () { | ||
| 46 | import bb, re | ||
| 47 | uc_os = (re.match('.*uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None) | ||
| 48 | if uc_os: | ||
| 49 | raise bb.parse.SkipPackage("incompatible with target %s" % | ||
| 50 | bb.data.getVar('TARGET_OS', d, 1)) | ||
| 51 | } | ||
| 52 | |||
| 53 | export libc_cv_slibdir = "${base_libdir}" | ||
| 54 | |||
| 55 | EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ | ||
| 56 | --without-cvs --disable-profile --disable-debug --without-gd \ | ||
| 57 | --enable-clocale=gnu \ | ||
| 58 | --enable-add-ons=${GLIBC_ADDONS},ports \ | ||
| 59 | --with-headers=${STAGING_INCDIR} \ | ||
| 60 | --without-selinux \ | ||
| 61 | ${GLIBC_EXTRA_OECONF}" | ||
| 62 | |||
| 63 | EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" | ||
| 64 | |||
| 65 | do_unpack_append() { | ||
| 66 | bb.build.exec_func('do_move_ports', d) | ||
| 67 | } | ||
| 68 | |||
| 69 | do_move_ports() { | ||
| 70 | if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then | ||
| 71 | rm -rf ${S}/ports | ||
| 72 | mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${S}/ | ||
| 73 | fi | ||
| 74 | } | ||
| 75 | |||
| 76 | do_configure () { | ||
| 77 | # override this function to avoid the autoconf/automake/aclocal/autoheader | ||
| 78 | # calls for now | ||
| 79 | # don't pass CPPFLAGS into configure, since it upsets the kernel-headers | ||
| 80 | # version check and doesn't really help with anything | ||
| 81 | if [ -z "`which rpcgen`" ]; then | ||
| 82 | echo "rpcgen not found. Install glibc-devel." | ||
| 83 | exit 1 | ||
| 84 | fi | ||
| 85 | (cd ${S} && gnu-configize) || die "failure in running gnu-configize" | ||
| 86 | find ${S} -name "configure" | xargs touch | ||
| 87 | CPPFLAGS="" oe_runconf | ||
| 88 | } | ||
| 89 | |||
| 90 | rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \ | ||
| 91 | yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \ | ||
| 92 | rusers.x spray.x nfs_prot.x rquota.x key_prot.x" | ||
| 93 | |||
| 94 | do_compile () { | ||
| 95 | # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging | ||
| 96 | unset LDFLAGS | ||
| 97 | base_do_compile | ||
| 98 | ( | ||
| 99 | cd ${S}/sunrpc/rpcsvc | ||
| 100 | for r in ${rpcsvc}; do | ||
| 101 | h=`echo $r|sed -e's,\.x$,.h,'` | ||
| 102 | rpcgen -h $r -o $h || bbwarn "unable to generate header for $r" | ||
| 103 | done | ||
| 104 | ) | ||
| 105 | } | ||
| 106 | |||
| 107 | require recipes-core/eglibc/eglibc-package.inc | ||
| 108 | |||
| 109 | BBCLASSEXTEND = "nativesdk" | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch new file mode 100644 index 0000000000..cdfeaeadd8 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch | |||
| @@ -0,0 +1,331 @@ | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | ||
| 2 | |||
| 3 | We run the ldconfig in the cross fashion. make the code bitsize aware so that | ||
| 4 | we can cross build ldconfig cache for various architectures. | ||
| 5 | |||
| 6 | Richard Purdie <richard.purdie@linuxfoundation.org> 2009/05/19 | ||
| 7 | Nitin A Kamble <nitin.a.kamble@intel.com> 2009/03/29 | ||
| 8 | |||
| 9 | Index: ldconfig-native-2.12.1/readelflib.c | ||
| 10 | =================================================================== | ||
| 11 | --- ldconfig-native-2.12.1.orig/readelflib.c | ||
| 12 | +++ ldconfig-native-2.12.1/readelflib.c | ||
| 13 | @@ -40,39 +40,212 @@ do \ | ||
| 14 | |||
| 15 | /* Returns 0 if everything is ok, != 0 in case of error. */ | ||
| 16 | int | ||
| 17 | -process_elf_file (const char *file_name, const char *lib, int *flag, | ||
| 18 | +process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
| 19 | unsigned int *osversion, char **soname, void *file_contents, | ||
| 20 | size_t file_length) | ||
| 21 | { | ||
| 22 | int i; | ||
| 23 | unsigned int j; | ||
| 24 | - ElfW(Addr) loadaddr; | ||
| 25 | + Elf32_Addr loadaddr; | ||
| 26 | unsigned int dynamic_addr; | ||
| 27 | size_t dynamic_size; | ||
| 28 | char *program_interpreter; | ||
| 29 | |||
| 30 | - ElfW(Ehdr) *elf_header; | ||
| 31 | - ElfW(Phdr) *elf_pheader, *segment; | ||
| 32 | - ElfW(Dyn) *dynamic_segment, *dyn_entry; | ||
| 33 | + Elf32_Ehdr *elf_header; | ||
| 34 | + Elf32_Phdr *elf_pheader, *segment; | ||
| 35 | + Elf32_Dyn *dynamic_segment, *dyn_entry; | ||
| 36 | char *dynamic_strings; | ||
| 37 | |||
| 38 | - elf_header = (ElfW(Ehdr) *) file_contents; | ||
| 39 | + elf_header = (Elf32_Ehdr *) file_contents; | ||
| 40 | *osversion = 0; | ||
| 41 | |||
| 42 | - if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS)) | ||
| 43 | + if (elf_header->e_type != ET_DYN) | ||
| 44 | { | ||
| 45 | - if (opt_verbose) | ||
| 46 | + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
| 47 | + elf_header->e_type); | ||
| 48 | + return 1; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /* Get information from elf program header. */ | ||
| 52 | + elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); | ||
| 53 | + check_ptr (elf_pheader); | ||
| 54 | + | ||
| 55 | + /* The library is an elf library, now search for soname and | ||
| 56 | + libc5/libc6. */ | ||
| 57 | + *flag = FLAG_ELF; | ||
| 58 | + | ||
| 59 | + loadaddr = -1; | ||
| 60 | + dynamic_addr = 0; | ||
| 61 | + dynamic_size = 0; | ||
| 62 | + program_interpreter = NULL; | ||
| 63 | + for (i = 0, segment = elf_pheader; | ||
| 64 | + i < elf_header->e_phnum; i++, segment++) | ||
| 65 | + { | ||
| 66 | + check_ptr (segment); | ||
| 67 | + | ||
| 68 | + switch (segment->p_type) | ||
| 69 | { | ||
| 70 | - if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) | ||
| 71 | - error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name); | ||
| 72 | - else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) | ||
| 73 | - error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name); | ||
| 74 | - else | ||
| 75 | - error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); | ||
| 76 | + case PT_LOAD: | ||
| 77 | + if (loadaddr == (Elf32_Addr) -1) | ||
| 78 | + loadaddr = segment->p_vaddr - segment->p_offset; | ||
| 79 | + break; | ||
| 80 | + | ||
| 81 | + case PT_DYNAMIC: | ||
| 82 | + if (dynamic_addr) | ||
| 83 | + error (0, 0, _("more than one dynamic segment\n")); | ||
| 84 | + | ||
| 85 | + dynamic_addr = segment->p_offset; | ||
| 86 | + dynamic_size = segment->p_filesz; | ||
| 87 | + break; | ||
| 88 | + | ||
| 89 | + case PT_INTERP: | ||
| 90 | + program_interpreter = (char *) (file_contents + segment->p_offset); | ||
| 91 | + check_ptr (program_interpreter); | ||
| 92 | + | ||
| 93 | + /* Check if this is enough to classify the binary. */ | ||
| 94 | + for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]); | ||
| 95 | + ++j) | ||
| 96 | + if (strcmp (program_interpreter, interpreters[j].soname) == 0) | ||
| 97 | + { | ||
| 98 | + *flag = interpreters[j].flag; | ||
| 99 | + break; | ||
| 100 | + } | ||
| 101 | + break; | ||
| 102 | + | ||
| 103 | + case PT_NOTE: | ||
| 104 | + if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
| 105 | + { | ||
| 106 | + Elf32_Word *abi_note = (Elf32_Word *) (file_contents | ||
| 107 | + + segment->p_offset); | ||
| 108 | + Elf32_Addr size = segment->p_filesz; | ||
| 109 | + | ||
| 110 | + while (abi_note [0] != 4 || abi_note [1] != 16 | ||
| 111 | + || abi_note [2] != 1 | ||
| 112 | + || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
| 113 | + { | ||
| 114 | +#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) | ||
| 115 | + Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) | ||
| 116 | + + ROUND (abi_note[0]) | ||
| 117 | + + ROUND (abi_note[1]); | ||
| 118 | + | ||
| 119 | + if (size - 32 < note_size || note_size == 0) | ||
| 120 | + { | ||
| 121 | + size = 0; | ||
| 122 | + break; | ||
| 123 | + } | ||
| 124 | + size -= note_size; | ||
| 125 | + abi_note = (void *) abi_note + note_size; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + if (size == 0) | ||
| 129 | + break; | ||
| 130 | + | ||
| 131 | + *osversion = (abi_note [4] << 24) | | ||
| 132 | + ((abi_note [5] & 0xff) << 16) | | ||
| 133 | + ((abi_note [6] & 0xff) << 8) | | ||
| 134 | + (abi_note [7] & 0xff); | ||
| 135 | + } | ||
| 136 | + break; | ||
| 137 | + | ||
| 138 | + default: | ||
| 139 | + break; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + } | ||
| 143 | + if (loadaddr == (Elf32_Addr) -1) | ||
| 144 | + { | ||
| 145 | + /* Very strange. */ | ||
| 146 | + loadaddr = 0; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /* Now we can read the dynamic sections. */ | ||
| 150 | + if (dynamic_size == 0) | ||
| 151 | + return 1; | ||
| 152 | + | ||
| 153 | + dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr); | ||
| 154 | + check_ptr (dynamic_segment); | ||
| 155 | + | ||
| 156 | + /* Find the string table. */ | ||
| 157 | + dynamic_strings = NULL; | ||
| 158 | + for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 159 | + ++dyn_entry) | ||
| 160 | + { | ||
| 161 | + check_ptr (dyn_entry); | ||
| 162 | + if (dyn_entry->d_tag == DT_STRTAB) | ||
| 163 | + { | ||
| 164 | + dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); | ||
| 165 | + check_ptr (dynamic_strings); | ||
| 166 | + break; | ||
| 167 | } | ||
| 168 | - return 1; | ||
| 169 | } | ||
| 170 | |||
| 171 | + if (dynamic_strings == NULL) | ||
| 172 | + return 1; | ||
| 173 | + | ||
| 174 | + /* Now read the DT_NEEDED and DT_SONAME entries. */ | ||
| 175 | + for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 176 | + ++dyn_entry) | ||
| 177 | + { | ||
| 178 | + if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) | ||
| 179 | + { | ||
| 180 | + char *name = dynamic_strings + dyn_entry->d_un.d_val; | ||
| 181 | + check_ptr (name); | ||
| 182 | + | ||
| 183 | + if (dyn_entry->d_tag == DT_NEEDED) | ||
| 184 | + { | ||
| 185 | + | ||
| 186 | + if (*flag == FLAG_ELF) | ||
| 187 | + { | ||
| 188 | + /* Check if this is enough to classify the binary. */ | ||
| 189 | + for (j = 0; | ||
| 190 | + j < sizeof (known_libs) / sizeof (known_libs [0]); | ||
| 191 | + ++j) | ||
| 192 | + if (strcmp (name, known_libs [j].soname) == 0) | ||
| 193 | + { | ||
| 194 | + *flag = known_libs [j].flag; | ||
| 195 | + break; | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + else if (dyn_entry->d_tag == DT_SONAME) | ||
| 201 | + *soname = xstrdup (name); | ||
| 202 | + | ||
| 203 | + /* Do we have everything we need? */ | ||
| 204 | + if (*soname && *flag != FLAG_ELF) | ||
| 205 | + return 0; | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + /* We reach this point only if the file doesn't contain a DT_SONAME | ||
| 210 | + or if we can't classify the library. If it doesn't have a | ||
| 211 | + soname, return the name of the library. */ | ||
| 212 | + if (*soname == NULL) | ||
| 213 | + *soname = xstrdup (lib); | ||
| 214 | + | ||
| 215 | + return 0; | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | +int | ||
| 219 | +process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
| 220 | + unsigned int *osversion, char **soname, void *file_contents, | ||
| 221 | + size_t file_length) | ||
| 222 | +{ | ||
| 223 | + int i; | ||
| 224 | + unsigned int j; | ||
| 225 | + Elf64_Addr loadaddr; | ||
| 226 | + unsigned int dynamic_addr; | ||
| 227 | + size_t dynamic_size; | ||
| 228 | + char *program_interpreter; | ||
| 229 | + | ||
| 230 | + Elf64_Ehdr *elf_header; | ||
| 231 | + Elf64_Phdr *elf_pheader, *segment; | ||
| 232 | + Elf64_Dyn *dynamic_segment, *dyn_entry; | ||
| 233 | + char *dynamic_strings; | ||
| 234 | + | ||
| 235 | + elf_header = (Elf64_Ehdr *) file_contents; | ||
| 236 | + *osversion = 0; | ||
| 237 | + | ||
| 238 | if (elf_header->e_type != ET_DYN) | ||
| 239 | { | ||
| 240 | error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
| 241 | @@ -81,7 +254,7 @@ process_elf_file (const char *file_name, | ||
| 242 | } | ||
| 243 | |||
| 244 | /* Get information from elf program header. */ | ||
| 245 | - elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); | ||
| 246 | + elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); | ||
| 247 | check_ptr (elf_pheader); | ||
| 248 | |||
| 249 | /* The library is an elf library, now search for soname and | ||
| 250 | @@ -100,7 +273,7 @@ process_elf_file (const char *file_name, | ||
| 251 | switch (segment->p_type) | ||
| 252 | { | ||
| 253 | case PT_LOAD: | ||
| 254 | - if (loadaddr == (ElfW(Addr)) -1) | ||
| 255 | + if (loadaddr == (Elf64_Addr) -1) | ||
| 256 | loadaddr = segment->p_vaddr - segment->p_offset; | ||
| 257 | break; | ||
| 258 | |||
| 259 | @@ -129,16 +302,16 @@ process_elf_file (const char *file_name, | ||
| 260 | case PT_NOTE: | ||
| 261 | if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
| 262 | { | ||
| 263 | - ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents | ||
| 264 | + Elf64_Word *abi_note = (Elf64_Word *) (file_contents | ||
| 265 | + segment->p_offset); | ||
| 266 | - ElfW(Addr) size = segment->p_filesz; | ||
| 267 | + Elf64_Addr size = segment->p_filesz; | ||
| 268 | |||
| 269 | while (abi_note [0] != 4 || abi_note [1] != 16 | ||
| 270 | || abi_note [2] != 1 | ||
| 271 | || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
| 272 | { | ||
| 273 | -#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word))) | ||
| 274 | - ElfW(Addr) note_size = 3 * sizeof (ElfW(Word)) | ||
| 275 | +#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) | ||
| 276 | + Elf64_Addr note_size = 3 * sizeof (Elf64_Word) | ||
| 277 | + ROUND (abi_note[0]) | ||
| 278 | + ROUND (abi_note[1]); | ||
| 279 | |||
| 280 | @@ -166,7 +339,7 @@ process_elf_file (const char *file_name, | ||
| 281 | } | ||
| 282 | |||
| 283 | } | ||
| 284 | - if (loadaddr == (ElfW(Addr)) -1) | ||
| 285 | + if (loadaddr == (Elf64_Addr) -1) | ||
| 286 | { | ||
| 287 | /* Very strange. */ | ||
| 288 | loadaddr = 0; | ||
| 289 | @@ -176,7 +349,7 @@ process_elf_file (const char *file_name, | ||
| 290 | if (dynamic_size == 0) | ||
| 291 | return 1; | ||
| 292 | |||
| 293 | - dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr); | ||
| 294 | + dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr); | ||
| 295 | check_ptr (dynamic_segment); | ||
| 296 | |||
| 297 | /* Find the string table. */ | ||
| 298 | @@ -233,3 +406,33 @@ process_elf_file (const char *file_name, | ||
| 299 | |||
| 300 | return 0; | ||
| 301 | } | ||
| 302 | +/* Returns 0 if everything is ok, != 0 in case of error. */ | ||
| 303 | +int | ||
| 304 | +process_elf_file (const char *file_name, const char *lib, int *flag, | ||
| 305 | + unsigned int *osversion, char **soname, void *file_contents, | ||
| 306 | + size_t file_length) | ||
| 307 | +{ | ||
| 308 | + int i; | ||
| 309 | + unsigned int j; | ||
| 310 | + ElfW(Addr) loadaddr; | ||
| 311 | + unsigned int dynamic_addr; | ||
| 312 | + size_t dynamic_size; | ||
| 313 | + char *program_interpreter; | ||
| 314 | + | ||
| 315 | + ElfW(Ehdr) *elf_header; | ||
| 316 | + ElfW(Phdr) *elf_pheader, *segment; | ||
| 317 | + ElfW(Dyn) *dynamic_segment, *dyn_entry; | ||
| 318 | + char *dynamic_strings; | ||
| 319 | + | ||
| 320 | + elf_header = (ElfW(Ehdr) *) file_contents; | ||
| 321 | + *osversion = 0; | ||
| 322 | + | ||
| 323 | + if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) | ||
| 324 | + return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length); | ||
| 325 | + else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) | ||
| 326 | + return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length); | ||
| 327 | + error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); | ||
| 328 | + return 1; | ||
| 329 | +} | ||
| 330 | + | ||
| 331 | + | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/README b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/README new file mode 100644 index 0000000000..43fb983729 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/README | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | The files are pulled verbatim from glibc 2.5 and then patched to allow | ||
| 2 | standalone compilation of ldconfig. | ||
| 3 | |||
| 4 | Richard Purdie | ||
| 5 | OpenedHand Ltd. | ||
| 6 | |||
| 7 | Upgraded the ldconfig recipe to eglibc 2.12.1 | ||
| 8 | Nitin A Kamble <nitin.a.kamble@intel.com> 2011/03/29 | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch new file mode 100644 index 0000000000..7f8e4db78a --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch | |||
| @@ -0,0 +1,454 @@ | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | ||
| 2 | |||
| 3 | Do data input/output handling according to endien-ness of the library file. That | ||
| 4 | enables use of ldconfig in the cross fashion for any architecture. | ||
| 5 | |||
| 6 | 2011/04/04 | ||
| 7 | Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 8 | Nitin Kamble <nitin.a.kamble@intel.com> | ||
| 9 | |||
| 10 | Index: ldconfig-native-2.12.1/readelflib.c | ||
| 11 | =================================================================== | ||
| 12 | --- ldconfig-native-2.12.1.orig/readelflib.c | ||
| 13 | +++ ldconfig-native-2.12.1/readelflib.c | ||
| 14 | @@ -38,6 +38,28 @@ do \ | ||
| 15 | } \ | ||
| 16 | while (0); | ||
| 17 | |||
| 18 | +int be; | ||
| 19 | +static uint16_t read16(uint16_t x, int be) | ||
| 20 | +{ | ||
| 21 | + if (be) | ||
| 22 | + return be16toh(x); | ||
| 23 | + return le16toh(x); | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +static uint32_t read32(uint32_t x, int be) | ||
| 27 | +{ | ||
| 28 | + if (be) | ||
| 29 | + return be32toh(x); | ||
| 30 | + return le32toh(x); | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +static uint64_t read64(uint64_t x, int be) | ||
| 34 | +{ | ||
| 35 | + if (be) | ||
| 36 | + return be64toh(x); | ||
| 37 | + return le64toh(x); | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | /* Returns 0 if everything is ok, != 0 in case of error. */ | ||
| 41 | int | ||
| 42 | process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
| 43 | @@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam | ||
| 44 | elf_header = (Elf32_Ehdr *) file_contents; | ||
| 45 | *osversion = 0; | ||
| 46 | |||
| 47 | - if (elf_header->e_type != ET_DYN) | ||
| 48 | + be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); | ||
| 49 | + | ||
| 50 | + if (read16(elf_header->e_type, be) != ET_DYN) | ||
| 51 | { | ||
| 52 | error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
| 53 | - elf_header->e_type); | ||
| 54 | + read16(elf_header->e_type, be)); | ||
| 55 | return 1; | ||
| 56 | } | ||
| 57 | |||
| 58 | /* Get information from elf program header. */ | ||
| 59 | - elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); | ||
| 60 | + elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents); | ||
| 61 | check_ptr (elf_pheader); | ||
| 62 | |||
| 63 | /* The library is an elf library, now search for soname and | ||
| 64 | @@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam | ||
| 65 | dynamic_size = 0; | ||
| 66 | program_interpreter = NULL; | ||
| 67 | for (i = 0, segment = elf_pheader; | ||
| 68 | - i < elf_header->e_phnum; i++, segment++) | ||
| 69 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
| 70 | { | ||
| 71 | check_ptr (segment); | ||
| 72 | |||
| 73 | - switch (segment->p_type) | ||
| 74 | + switch (read32(segment->p_type, be)) | ||
| 75 | { | ||
| 76 | case PT_LOAD: | ||
| 77 | if (loadaddr == (Elf32_Addr) -1) | ||
| 78 | - loadaddr = segment->p_vaddr - segment->p_offset; | ||
| 79 | + loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); | ||
| 80 | break; | ||
| 81 | |||
| 82 | case PT_DYNAMIC: | ||
| 83 | if (dynamic_addr) | ||
| 84 | error (0, 0, _("more than one dynamic segment\n")); | ||
| 85 | |||
| 86 | - dynamic_addr = segment->p_offset; | ||
| 87 | - dynamic_size = segment->p_filesz; | ||
| 88 | + dynamic_addr = read32(segment->p_offset, be); | ||
| 89 | + dynamic_size = read32(segment->p_filesz, be); | ||
| 90 | break; | ||
| 91 | |||
| 92 | case PT_INTERP: | ||
| 93 | - program_interpreter = (char *) (file_contents + segment->p_offset); | ||
| 94 | + program_interpreter = (char *) (file_contents + read32(segment->p_offset, be)); | ||
| 95 | check_ptr (program_interpreter); | ||
| 96 | |||
| 97 | /* Check if this is enough to classify the binary. */ | ||
| 98 | @@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam | ||
| 99 | break; | ||
| 100 | |||
| 101 | case PT_NOTE: | ||
| 102 | - if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
| 103 | + if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4) | ||
| 104 | { | ||
| 105 | Elf32_Word *abi_note = (Elf32_Word *) (file_contents | ||
| 106 | - + segment->p_offset); | ||
| 107 | - Elf32_Addr size = segment->p_filesz; | ||
| 108 | + + read32(segment->p_offset, be)); | ||
| 109 | + Elf32_Addr size = read32(segment->p_filesz, be); | ||
| 110 | |||
| 111 | - while (abi_note [0] != 4 || abi_note [1] != 16 | ||
| 112 | - || abi_note [2] != 1 | ||
| 113 | + while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 | ||
| 114 | + || read32(abi_note [2], be) != 1 | ||
| 115 | || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
| 116 | { | ||
| 117 | -#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) | ||
| 118 | - Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) | ||
| 119 | - + ROUND (abi_note[0]) | ||
| 120 | - + ROUND (abi_note[1]); | ||
| 121 | +#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word)) | ||
| 122 | + Elf32_Addr note_size = 3 * sizeof (Elf32_Word) | ||
| 123 | + + ROUND (read32(abi_note[0], be)) | ||
| 124 | + + ROUND (read32(abi_note[1], be)); | ||
| 125 | |||
| 126 | if (size - 32 < note_size || note_size == 0) | ||
| 127 | { | ||
| 128 | @@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam | ||
| 129 | if (size == 0) | ||
| 130 | break; | ||
| 131 | |||
| 132 | - *osversion = (abi_note [4] << 24) | | ||
| 133 | - ((abi_note [5] & 0xff) << 16) | | ||
| 134 | - ((abi_note [6] & 0xff) << 8) | | ||
| 135 | - (abi_note [7] & 0xff); | ||
| 136 | + *osversion = (read32(abi_note [4], be) << 24) | | ||
| 137 | + ((read32(abi_note [5], be) & 0xff) << 16) | | ||
| 138 | + ((read32(abi_note [6], be) & 0xff) << 8) | | ||
| 139 | + (read32(abi_note [7], be) & 0xff); | ||
| 140 | } | ||
| 141 | break; | ||
| 142 | |||
| 143 | @@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam | ||
| 144 | |||
| 145 | /* Find the string table. */ | ||
| 146 | dynamic_strings = NULL; | ||
| 147 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 148 | + for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; | ||
| 149 | ++dyn_entry) | ||
| 150 | { | ||
| 151 | check_ptr (dyn_entry); | ||
| 152 | - if (dyn_entry->d_tag == DT_STRTAB) | ||
| 153 | + if (read32(dyn_entry->d_tag, be) == DT_STRTAB) | ||
| 154 | { | ||
| 155 | - dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); | ||
| 156 | + dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr); | ||
| 157 | check_ptr (dynamic_strings); | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | @@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam | ||
| 161 | return 1; | ||
| 162 | |||
| 163 | /* Now read the DT_NEEDED and DT_SONAME entries. */ | ||
| 164 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 165 | + for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; | ||
| 166 | ++dyn_entry) | ||
| 167 | { | ||
| 168 | - if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) | ||
| 169 | + if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME) | ||
| 170 | { | ||
| 171 | - char *name = dynamic_strings + dyn_entry->d_un.d_val; | ||
| 172 | + char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be); | ||
| 173 | check_ptr (name); | ||
| 174 | |||
| 175 | - if (dyn_entry->d_tag == DT_NEEDED) | ||
| 176 | + if (read32(dyn_entry->d_tag, be) == DT_NEEDED) | ||
| 177 | { | ||
| 178 | |||
| 179 | if (*flag == FLAG_ELF) | ||
| 180 | @@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | - else if (dyn_entry->d_tag == DT_SONAME) | ||
| 185 | + else if (read32(dyn_entry->d_tag, be) == DT_SONAME) | ||
| 186 | *soname = xstrdup (name); | ||
| 187 | |||
| 188 | /* Do we have everything we need? */ | ||
| 189 | @@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam | ||
| 190 | elf_header = (Elf64_Ehdr *) file_contents; | ||
| 191 | *osversion = 0; | ||
| 192 | |||
| 193 | - if (elf_header->e_type != ET_DYN) | ||
| 194 | + be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); | ||
| 195 | + | ||
| 196 | + if (read16(elf_header->e_type, be) != ET_DYN) | ||
| 197 | { | ||
| 198 | error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
| 199 | - elf_header->e_type); | ||
| 200 | + read16(elf_header->e_type, be)); | ||
| 201 | return 1; | ||
| 202 | } | ||
| 203 | |||
| 204 | /* Get information from elf program header. */ | ||
| 205 | - elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); | ||
| 206 | + elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents); | ||
| 207 | check_ptr (elf_pheader); | ||
| 208 | |||
| 209 | /* The library is an elf library, now search for soname and | ||
| 210 | @@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam | ||
| 211 | dynamic_size = 0; | ||
| 212 | program_interpreter = NULL; | ||
| 213 | for (i = 0, segment = elf_pheader; | ||
| 214 | - i < elf_header->e_phnum; i++, segment++) | ||
| 215 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
| 216 | { | ||
| 217 | check_ptr (segment); | ||
| 218 | |||
| 219 | - switch (segment->p_type) | ||
| 220 | + switch (read32(segment->p_type, be)) | ||
| 221 | { | ||
| 222 | case PT_LOAD: | ||
| 223 | if (loadaddr == (Elf64_Addr) -1) | ||
| 224 | - loadaddr = segment->p_vaddr - segment->p_offset; | ||
| 225 | + loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); | ||
| 226 | break; | ||
| 227 | |||
| 228 | case PT_DYNAMIC: | ||
| 229 | if (dynamic_addr) | ||
| 230 | error (0, 0, _("more than one dynamic segment\n")); | ||
| 231 | |||
| 232 | - dynamic_addr = segment->p_offset; | ||
| 233 | - dynamic_size = segment->p_filesz; | ||
| 234 | + dynamic_addr = read64(segment->p_offset, be); | ||
| 235 | + dynamic_size = read32(segment->p_filesz, be); | ||
| 236 | break; | ||
| 237 | |||
| 238 | case PT_INTERP: | ||
| 239 | - program_interpreter = (char *) (file_contents + segment->p_offset); | ||
| 240 | + program_interpreter = (char *) (file_contents + read64(segment->p_offset, be)); | ||
| 241 | check_ptr (program_interpreter); | ||
| 242 | |||
| 243 | /* Check if this is enough to classify the binary. */ | ||
| 244 | @@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam | ||
| 245 | break; | ||
| 246 | |||
| 247 | case PT_NOTE: | ||
| 248 | - if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
| 249 | + if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4) | ||
| 250 | { | ||
| 251 | Elf64_Word *abi_note = (Elf64_Word *) (file_contents | ||
| 252 | - + segment->p_offset); | ||
| 253 | - Elf64_Addr size = segment->p_filesz; | ||
| 254 | + + read64(segment->p_offset, be)); | ||
| 255 | + Elf64_Addr size = read32(segment->p_filesz, be); | ||
| 256 | |||
| 257 | - while (abi_note [0] != 4 || abi_note [1] != 16 | ||
| 258 | - || abi_note [2] != 1 | ||
| 259 | + while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 | ||
| 260 | + || read32(abi_note [2], be) != 1 | ||
| 261 | || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
| 262 | { | ||
| 263 | +#undef ROUND | ||
| 264 | #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) | ||
| 265 | Elf64_Addr note_size = 3 * sizeof (Elf64_Word) | ||
| 266 | - + ROUND (abi_note[0]) | ||
| 267 | - + ROUND (abi_note[1]); | ||
| 268 | + + ROUND (read32(abi_note[0], be)) | ||
| 269 | + + ROUND (read32(abi_note[1], be)); | ||
| 270 | |||
| 271 | if (size - 32 < note_size || note_size == 0) | ||
| 272 | { | ||
| 273 | @@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam | ||
| 274 | if (size == 0) | ||
| 275 | break; | ||
| 276 | |||
| 277 | - *osversion = (abi_note [4] << 24) | | ||
| 278 | - ((abi_note [5] & 0xff) << 16) | | ||
| 279 | - ((abi_note [6] & 0xff) << 8) | | ||
| 280 | - (abi_note [7] & 0xff); | ||
| 281 | + *osversion = (read32(abi_note [4], be) << 24) | | ||
| 282 | + ((read32(abi_note [5], be) & 0xff) << 16) | | ||
| 283 | + ((read32(abi_note [6], be) & 0xff) << 8) | | ||
| 284 | + (read32(abi_note [7], be) & 0xff); | ||
| 285 | } | ||
| 286 | break; | ||
| 287 | |||
| 288 | @@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam | ||
| 289 | |||
| 290 | /* Find the string table. */ | ||
| 291 | dynamic_strings = NULL; | ||
| 292 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 293 | + for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; | ||
| 294 | ++dyn_entry) | ||
| 295 | { | ||
| 296 | check_ptr (dyn_entry); | ||
| 297 | - if (dyn_entry->d_tag == DT_STRTAB) | ||
| 298 | + if (read64(dyn_entry->d_tag, be) == DT_STRTAB) | ||
| 299 | { | ||
| 300 | - dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); | ||
| 301 | + dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr); | ||
| 302 | check_ptr (dynamic_strings); | ||
| 303 | break; | ||
| 304 | } | ||
| 305 | @@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam | ||
| 306 | return 1; | ||
| 307 | |||
| 308 | /* Now read the DT_NEEDED and DT_SONAME entries. */ | ||
| 309 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
| 310 | + for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; | ||
| 311 | ++dyn_entry) | ||
| 312 | { | ||
| 313 | - if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) | ||
| 314 | + if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME) | ||
| 315 | { | ||
| 316 | - char *name = dynamic_strings + dyn_entry->d_un.d_val; | ||
| 317 | + char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be); | ||
| 318 | check_ptr (name); | ||
| 319 | |||
| 320 | - if (dyn_entry->d_tag == DT_NEEDED) | ||
| 321 | + if (read64(dyn_entry->d_tag, be) == DT_NEEDED) | ||
| 322 | { | ||
| 323 | |||
| 324 | if (*flag == FLAG_ELF) | ||
| 325 | @@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 329 | - else if (dyn_entry->d_tag == DT_SONAME) | ||
| 330 | + else if (read64(dyn_entry->d_tag, be) == DT_SONAME) | ||
| 331 | *soname = xstrdup (name); | ||
| 332 | |||
| 333 | /* Do we have everything we need? */ | ||
| 334 | Index: ldconfig-native-2.12.1/readlib.c | ||
| 335 | =================================================================== | ||
| 336 | --- ldconfig-native-2.12.1.orig/readlib.c | ||
| 337 | +++ ldconfig-native-2.12.1/readlib.c | ||
| 338 | @@ -169,7 +169,8 @@ process_file (const char *real_file_name | ||
| 339 | ret = 1; | ||
| 340 | } | ||
| 341 | /* Libraries have to be shared object files. */ | ||
| 342 | - else if (elf_header->e_type != ET_DYN) | ||
| 343 | + else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) || | ||
| 344 | + (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN)) | ||
| 345 | ret = 1; | ||
| 346 | else if (process_elf_file (file_name, lib, flag, osversion, soname, | ||
| 347 | file_contents, statbuf.st_size)) | ||
| 348 | Index: ldconfig-native-2.12.1/cache.c | ||
| 349 | =================================================================== | ||
| 350 | --- ldconfig-native-2.12.1.orig/cache.c | ||
| 351 | +++ ldconfig-native-2.12.1/cache.c | ||
| 352 | @@ -39,6 +39,29 @@ | ||
| 353 | # define N_(msgid) msgid | ||
| 354 | #define _(msg) msg | ||
| 355 | |||
| 356 | +extern int be; | ||
| 357 | + | ||
| 358 | +static uint16_t write16(uint16_t x, int be) | ||
| 359 | +{ | ||
| 360 | + if (be) | ||
| 361 | + return htobe16(x); | ||
| 362 | + return htole16(x); | ||
| 363 | +} | ||
| 364 | + | ||
| 365 | +static uint32_t write32(uint32_t x, int be) | ||
| 366 | +{ | ||
| 367 | + if (be) | ||
| 368 | + return htobe32(x); | ||
| 369 | + return htole32(x); | ||
| 370 | +} | ||
| 371 | + | ||
| 372 | +static uint64_t write64(uint64_t x, int be) | ||
| 373 | +{ | ||
| 374 | + if (be) | ||
| 375 | + return htobe64(x); | ||
| 376 | + return htole64(x); | ||
| 377 | +} | ||
| 378 | + | ||
| 379 | struct cache_entry | ||
| 380 | { | ||
| 381 | char *lib; /* Library name. */ | ||
| 382 | @@ -279,7 +302,12 @@ save_cache (const char *cache_name) | ||
| 383 | /* Number of normal cache entries. */ | ||
| 384 | int cache_entry_old_count = 0; | ||
| 385 | |||
| 386 | - for (entry = entries; entry != NULL; entry = entry->next) | ||
| 387 | + if (be) | ||
| 388 | + printf("saving cache in big endian encoding\n"); | ||
| 389 | + else | ||
| 390 | + printf("saving cache in little endian encoding\n"); | ||
| 391 | + | ||
| 392 | + for (entry = entries; entry != NULL; entry = entry->next) | ||
| 393 | { | ||
| 394 | /* Account the final NULs. */ | ||
| 395 | total_strlen += strlen (entry->lib) + strlen (entry->path) + 2; | ||
| 396 | @@ -310,7 +338,7 @@ save_cache (const char *cache_name) | ||
| 397 | memset (file_entries, '\0', sizeof (struct cache_file)); | ||
| 398 | memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1); | ||
| 399 | |||
| 400 | - file_entries->nlibs = cache_entry_old_count; | ||
| 401 | + file_entries->nlibs = write32(cache_entry_old_count, be); | ||
| 402 | } | ||
| 403 | |||
| 404 | struct cache_file_new *file_entries_new = NULL; | ||
| 405 | @@ -330,8 +358,8 @@ save_cache (const char *cache_name) | ||
| 406 | memcpy (file_entries_new->version, CACHE_VERSION, | ||
| 407 | sizeof CACHE_VERSION - 1); | ||
| 408 | |||
| 409 | - file_entries_new->nlibs = cache_entry_count; | ||
| 410 | - file_entries_new->len_strings = total_strlen; | ||
| 411 | + file_entries_new->nlibs = write32(cache_entry_count, be); | ||
| 412 | + file_entries_new->len_strings = write32(total_strlen, be); | ||
| 413 | } | ||
| 414 | |||
| 415 | /* Pad for alignment of cache_file_new. */ | ||
| 416 | @@ -358,9 +386,9 @@ save_cache (const char *cache_name) | ||
| 417 | /* First the library. */ | ||
| 418 | if (opt_format != 2 && entry->hwcap == 0) | ||
| 419 | { | ||
| 420 | - file_entries->libs[idx_old].flags = entry->flags; | ||
| 421 | + file_entries->libs[idx_old].flags = write32(entry->flags, be); | ||
| 422 | /* XXX: Actually we can optimize here and remove duplicates. */ | ||
| 423 | - file_entries->libs[idx_old].key = str_offset + pad; | ||
| 424 | + file_entries->libs[idx_old].key = write32(str_offset + pad, be); | ||
| 425 | } | ||
| 426 | if (opt_format != 0) | ||
| 427 | { | ||
| 428 | @@ -368,10 +396,10 @@ save_cache (const char *cache_name) | ||
| 429 | not doing so makes the code easier, the string table | ||
| 430 | always begins at the beginning of the the new cache | ||
| 431 | struct. */ | ||
| 432 | - file_entries_new->libs[idx_new].flags = entry->flags; | ||
| 433 | - file_entries_new->libs[idx_new].osversion = entry->osversion; | ||
| 434 | - file_entries_new->libs[idx_new].hwcap = entry->hwcap; | ||
| 435 | - file_entries_new->libs[idx_new].key = str_offset; | ||
| 436 | + file_entries_new->libs[idx_new].flags = write32(entry->flags, be); | ||
| 437 | + file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be); | ||
| 438 | + file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be); | ||
| 439 | + file_entries_new->libs[idx_new].key = write32(str_offset, be); | ||
| 440 | } | ||
| 441 | |||
| 442 | size_t len = strlen (entry->lib) + 1; | ||
| 443 | @@ -379,9 +407,9 @@ save_cache (const char *cache_name) | ||
| 444 | str_offset += len; | ||
| 445 | /* Then the path. */ | ||
| 446 | if (opt_format != 2 && entry->hwcap == 0) | ||
| 447 | - file_entries->libs[idx_old].value = str_offset + pad; | ||
| 448 | + file_entries->libs[idx_old].value = write32(str_offset + pad, be); | ||
| 449 | if (opt_format != 0) | ||
| 450 | - file_entries_new->libs[idx_new].value = str_offset; | ||
| 451 | + file_entries_new->libs[idx_new].value = write32(str_offset, be); | ||
| 452 | len = strlen (entry->path) + 1; | ||
| 453 | str = mempcpy (str, entry->path, len); | ||
| 454 | str_offset += len; | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch new file mode 100644 index 0000000000..a18b2c20de --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | Upstream-Status: Inappropriate [fix poky patch] | ||
| 2 | |||
| 3 | This patch fixes build issues with a previous endian-ness_handling.patch on | ||
| 4 | distros that don't have macros referenced | ||
| 5 | |||
| 6 | 7/20/2011 | ||
| 7 | Matthew McClintock <msm@freescale.com> | ||
| 8 | |||
| 9 | diff -purN ldconfig-native-2.12.1.orig/endian_extra.h ldconfig-native-2.12.1/endian_extra.h | ||
| 10 | --- ldconfig-native-2.12.1.orig/endian_extra.h 1969-12-31 18:00:00.000000000 -0600 | ||
| 11 | +++ ldconfig-native-2.12.1/endian_extra.h 2011-07-19 18:09:14.323048417 -0500 | ||
| 12 | @@ -0,0 +1,64 @@ | ||
| 13 | +/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc. | ||
| 14 | + This file is part of the GNU C Library. | ||
| 15 | + | ||
| 16 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 17 | + modify it under the terms of the GNU Lesser General Public | ||
| 18 | + License as published by the Free Software Foundation; either | ||
| 19 | + version 2.1 of the License, or (at your option) any later version. | ||
| 20 | + | ||
| 21 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 22 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 24 | + Lesser General Public License for more details. | ||
| 25 | + | ||
| 26 | + You should have received a copy of the GNU Lesser General Public | ||
| 27 | + License along with the GNU C Library; if not, write to the Free | ||
| 28 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 29 | + 02111-1307 USA. */ | ||
| 30 | + | ||
| 31 | +#include <endian.h> | ||
| 32 | + | ||
| 33 | +#ifndef _ENDIAN_EXTRA_H | ||
| 34 | +#define _ENDIAN_EXTRA_H 1 | ||
| 35 | + | ||
| 36 | +/* Don't redefine these macros if they already exist */ | ||
| 37 | +#ifndef htobe16 | ||
| 38 | +#ifdef __USE_BSD | ||
| 39 | +/* Conversion interfaces. */ | ||
| 40 | +# include <byteswap.h> | ||
| 41 | + | ||
| 42 | +# if __BYTE_ORDER == __LITTLE_ENDIAN | ||
| 43 | +# define htobe16(x) __bswap_16 (x) | ||
| 44 | +# define htole16(x) (x) | ||
| 45 | +# define be16toh(x) __bswap_16 (x) | ||
| 46 | +# define le16toh(x) (x) | ||
| 47 | + | ||
| 48 | +# define htobe32(x) __bswap_32 (x) | ||
| 49 | +# define htole32(x) (x) | ||
| 50 | +# define be32toh(x) __bswap_32 (x) | ||
| 51 | +# define le32toh(x) (x) | ||
| 52 | + | ||
| 53 | +# define htobe64(x) __bswap_64 (x) | ||
| 54 | +# define htole64(x) (x) | ||
| 55 | +# define be64toh(x) __bswap_64 (x) | ||
| 56 | +# define le64toh(x) (x) | ||
| 57 | +# else | ||
| 58 | +# define htobe16(x) (x) | ||
| 59 | +# define htole16(x) __bswap_16 (x) | ||
| 60 | +# define be16toh(x) (x) | ||
| 61 | +# define le16toh(x) __bswap_16 (x) | ||
| 62 | + | ||
| 63 | +# define htobe32(x) (x) | ||
| 64 | +# define htole32(x) __bswap_32 (x) | ||
| 65 | +# define be32toh(x) (x) | ||
| 66 | +# define le32toh(x) __bswap_32 (x) | ||
| 67 | + | ||
| 68 | +# define htobe64(x) (x) | ||
| 69 | +# define htole64(x) __bswap_64 (x) | ||
| 70 | +# define be64toh(x) (x) | ||
| 71 | +# define le64toh(x) __bswap_64 (x) | ||
| 72 | +# endif | ||
| 73 | +#endif | ||
| 74 | +#endif | ||
| 75 | + | ||
| 76 | +#endif /* endian_extra.h */ | ||
| 77 | diff -purN ldconfig-native-2.12.1.orig/cache.c ldconfig-native-2.12.1/cache.c | ||
| 78 | --- ldconfig-native-2.12.1.orig/cache.c 2011-07-19 18:21:28.347041301 -0500 | ||
| 79 | +++ ldconfig-native-2.12.1/cache.c 2011-07-19 18:22:54.118048064 -0500 | ||
| 80 | @@ -39,6 +39,8 @@ | ||
| 81 | # define N_(msgid) msgid | ||
| 82 | #define _(msg) msg | ||
| 83 | |||
| 84 | +#include "endian_extra.h" | ||
| 85 | + | ||
| 86 | extern int be; | ||
| 87 | |||
| 88 | static uint16_t write16(uint16_t x, int be) | ||
| 89 | diff -purN ldconfig-native-2.12.1.orig/readelflib.c ldconfig-native-2.12.1/readelflib.c | ||
| 90 | --- ldconfig-native-2.12.1.orig/readelflib.c 2011-07-19 18:21:28.346041593 -0500 | ||
| 91 | +++ ldconfig-native-2.12.1/readelflib.c 2011-07-19 18:23:05.324059875 -0500 | ||
| 92 | @@ -25,6 +25,9 @@ | ||
| 93 | |||
| 94 | /* check_ptr checks that a pointer is in the mmaped file and doesn't | ||
| 95 | point outside it. */ | ||
| 96 | + | ||
| 97 | +#include "endian_extra.h" | ||
| 98 | + | ||
| 99 | #undef check_ptr | ||
| 100 | #define check_ptr(ptr) \ | ||
| 101 | do \ | ||
| 102 | diff -purN ldconfig-native-2.12.1.orig/readlib.c ldconfig-native-2.12.1/readlib.c | ||
| 103 | --- ldconfig-native-2.12.1.orig/readlib.c 2011-07-19 18:21:28.346041593 -0500 | ||
| 104 | +++ ldconfig-native-2.12.1/readlib.c 2011-07-19 18:23:23.877046210 -0500 | ||
| 105 | @@ -40,6 +40,8 @@ | ||
| 106 | |||
| 107 | #include "ldconfig.h" | ||
| 108 | |||
| 109 | +#include "endian_extra.h" | ||
| 110 | + | ||
| 111 | #define _(msg) msg | ||
| 112 | |||
| 113 | #define Elf32_CLASS ELFCLASS32 | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch new file mode 100644 index 0000000000..4e9aab9416 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | ||
| 2 | |||
| 3 | The native version of ldconfig was using native definition of LD_SO (i.e. | ||
| 4 | ld-linux-x86-64.so.2 ) which is not correct for doing the cross ldconfig. | ||
| 5 | This was causing libc.so on the target marked as ELF lib rather than | ||
| 6 | FLAG_ELF_LIBC6 in the ld.so.cache. | ||
| 7 | |||
| 8 | Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/4 | ||
| 9 | |||
| 10 | Index: ldconfig-native-2.12.1/readlib.c | ||
| 11 | =================================================================== | ||
| 12 | --- ldconfig-native-2.12.1.orig/readlib.c | ||
| 13 | +++ ldconfig-native-2.12.1/readlib.c | ||
| 14 | @@ -51,6 +51,10 @@ struct known_names | ||
| 15 | int flag; | ||
| 16 | }; | ||
| 17 | |||
| 18 | +/* don't use host's definition of LD_SO */ | ||
| 19 | +#undef LD_SO | ||
| 20 | +#define LD_SO "ld.so.1" | ||
| 21 | + | ||
| 22 | static struct known_names interpreters[] = | ||
| 23 | { | ||
| 24 | { "/lib/" LD_SO, FLAG_ELF_LIBC6 }, | ||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 new file mode 100644 index 0000000000..dc1e79888e --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 | |||
| Binary files differ | |||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch new file mode 100644 index 0000000000..52986e61c7 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch | |||
| @@ -0,0 +1,471 @@ | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | ||
| 2 | |||
| 3 | enable standalone building of ldconfig | ||
| 4 | |||
| 5 | --- | ||
| 6 | cache.c | 11 +- | ||
| 7 | chroot_canon.c | 7 + | ||
| 8 | dl-cache.c | 235 --------------------------------------------------------- | ||
| 9 | dl-cache.h | 3 | ||
| 10 | ldconfig.c | 27 ++++-- | ||
| 11 | readlib.c | 7 + | ||
| 12 | xstrdup.c | 11 -- | ||
| 13 | 7 files changed, 45 insertions(+), 256 deletions(-) | ||
| 14 | |||
| 15 | Index: ldconfig-native-2.12.1/cache.c | ||
| 16 | =================================================================== | ||
| 17 | --- ldconfig-native-2.12.1.orig/cache.c | ||
| 18 | +++ ldconfig-native-2.12.1/cache.c | ||
| 19 | @@ -16,6 +16,9 @@ | ||
| 20 | along with this program; if not, write to the Free Software Foundation, | ||
| 21 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
| 22 | |||
| 23 | +#define _LARGEFILE64_SOURCE | ||
| 24 | +#define _GNU_SOURCE | ||
| 25 | + | ||
| 26 | #include <errno.h> | ||
| 27 | #include <error.h> | ||
| 28 | #include <dirent.h> | ||
| 29 | @@ -31,8 +34,10 @@ | ||
| 30 | #include <sys/stat.h> | ||
| 31 | #include <sys/types.h> | ||
| 32 | |||
| 33 | -#include <ldconfig.h> | ||
| 34 | -#include <dl-cache.h> | ||
| 35 | +#include "ldconfig.h" | ||
| 36 | +#include "dl-cache.h" | ||
| 37 | +# define N_(msgid) msgid | ||
| 38 | +#define _(msg) msg | ||
| 39 | |||
| 40 | struct cache_entry | ||
| 41 | { | ||
| 42 | Index: ldconfig-native-2.12.1/chroot_canon.c | ||
| 43 | =================================================================== | ||
| 44 | --- ldconfig-native-2.12.1.orig/chroot_canon.c | ||
| 45 | +++ ldconfig-native-2.12.1/chroot_canon.c | ||
| 46 | @@ -17,6 +17,9 @@ | ||
| 47 | along with this program; if not, write to the Free Software Foundation, | ||
| 48 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
| 49 | |||
| 50 | +#define _LARGEFILE64_SOURCE | ||
| 51 | +#define _GNU_SOURCE | ||
| 52 | + | ||
| 53 | #include <stdlib.h> | ||
| 54 | #include <string.h> | ||
| 55 | #include <unistd.h> | ||
| 56 | @@ -27,7 +30,9 @@ | ||
| 57 | #include <stddef.h> | ||
| 58 | #include <stdint.h> | ||
| 59 | |||
| 60 | -#include <ldconfig.h> | ||
| 61 | +#include "ldconfig.h" | ||
| 62 | + | ||
| 63 | +#define __set_errno(Val) errno = (Val) | ||
| 64 | |||
| 65 | #ifndef PATH_MAX | ||
| 66 | #define PATH_MAX 1024 | ||
| 67 | Index: ldconfig-native-2.12.1/dl-cache.c | ||
| 68 | =================================================================== | ||
| 69 | --- ldconfig-native-2.12.1.orig/dl-cache.c | ||
| 70 | +++ ldconfig-native-2.12.1/dl-cache.c | ||
| 71 | @@ -20,12 +20,12 @@ | ||
| 72 | |||
| 73 | #include <assert.h> | ||
| 74 | #include <unistd.h> | ||
| 75 | -#include <ldsodefs.h> | ||
| 76 | +//#include "ldsodefs.h" | ||
| 77 | #include <sys/mman.h> | ||
| 78 | #include <dl-cache.h> | ||
| 79 | #include <dl-procinfo.h> | ||
| 80 | |||
| 81 | -#include <stdio-common/_itoa.h> | ||
| 82 | +//#include "_itoa.h" | ||
| 83 | |||
| 84 | #ifndef _DL_PLATFORMS_COUNT | ||
| 85 | # define _DL_PLATFORMS_COUNT 0 | ||
| 86 | @@ -39,103 +39,7 @@ static size_t cachesize; | ||
| 87 | /* 1 if cache_data + PTR points into the cache. */ | ||
| 88 | #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) | ||
| 89 | |||
| 90 | -#define SEARCH_CACHE(cache) \ | ||
| 91 | -/* We use binary search since the table is sorted in the cache file. \ | ||
| 92 | - The first matching entry in the table is returned. \ | ||
| 93 | - It is important to use the same algorithm as used while generating \ | ||
| 94 | - the cache file. */ \ | ||
| 95 | -do \ | ||
| 96 | - { \ | ||
| 97 | - left = 0; \ | ||
| 98 | - right = cache->nlibs - 1; \ | ||
| 99 | - \ | ||
| 100 | - while (left <= right) \ | ||
| 101 | - { \ | ||
| 102 | - __typeof__ (cache->libs[0].key) key; \ | ||
| 103 | - \ | ||
| 104 | - middle = (left + right) / 2; \ | ||
| 105 | - \ | ||
| 106 | - key = cache->libs[middle].key; \ | ||
| 107 | - \ | ||
| 108 | - /* Make sure string table indices are not bogus before using \ | ||
| 109 | - them. */ \ | ||
| 110 | - if (! _dl_cache_verify_ptr (key)) \ | ||
| 111 | - { \ | ||
| 112 | - cmpres = 1; \ | ||
| 113 | - break; \ | ||
| 114 | - } \ | ||
| 115 | - \ | ||
| 116 | - /* Actually compare the entry with the key. */ \ | ||
| 117 | - cmpres = _dl_cache_libcmp (name, cache_data + key); \ | ||
| 118 | - if (__builtin_expect (cmpres == 0, 0)) \ | ||
| 119 | - { \ | ||
| 120 | - /* Found it. LEFT now marks the last entry for which we \ | ||
| 121 | - know the name is correct. */ \ | ||
| 122 | - left = middle; \ | ||
| 123 | - \ | ||
| 124 | - /* There might be entries with this name before the one we \ | ||
| 125 | - found. So we have to find the beginning. */ \ | ||
| 126 | - while (middle > 0) \ | ||
| 127 | - { \ | ||
| 128 | - __typeof__ (cache->libs[0].key) key; \ | ||
| 129 | - \ | ||
| 130 | - key = cache->libs[middle - 1].key; \ | ||
| 131 | - /* Make sure string table indices are not bogus before \ | ||
| 132 | - using them. */ \ | ||
| 133 | - if (! _dl_cache_verify_ptr (key) \ | ||
| 134 | - /* Actually compare the entry. */ \ | ||
| 135 | - || _dl_cache_libcmp (name, cache_data + key) != 0) \ | ||
| 136 | - break; \ | ||
| 137 | - --middle; \ | ||
| 138 | - } \ | ||
| 139 | - \ | ||
| 140 | - do \ | ||
| 141 | - { \ | ||
| 142 | - int flags; \ | ||
| 143 | - __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \ | ||
| 144 | - \ | ||
| 145 | - /* Only perform the name test if necessary. */ \ | ||
| 146 | - if (middle > left \ | ||
| 147 | - /* We haven't seen this string so far. Test whether the \ | ||
| 148 | - index is ok and whether the name matches. Otherwise \ | ||
| 149 | - we are done. */ \ | ||
| 150 | - && (! _dl_cache_verify_ptr (lib->key) \ | ||
| 151 | - || (_dl_cache_libcmp (name, cache_data + lib->key) \ | ||
| 152 | - != 0))) \ | ||
| 153 | - break; \ | ||
| 154 | - \ | ||
| 155 | - flags = lib->flags; \ | ||
| 156 | - if (_dl_cache_check_flags (flags) \ | ||
| 157 | - && _dl_cache_verify_ptr (lib->value)) \ | ||
| 158 | - { \ | ||
| 159 | - if (best == NULL || flags == GLRO(dl_correct_cache_id)) \ | ||
| 160 | - { \ | ||
| 161 | - HWCAP_CHECK; \ | ||
| 162 | - best = cache_data + lib->value; \ | ||
| 163 | - \ | ||
| 164 | - if (flags == GLRO(dl_correct_cache_id)) \ | ||
| 165 | - /* We've found an exact match for the shared \ | ||
| 166 | - object and no general `ELF' release. Stop \ | ||
| 167 | - searching. */ \ | ||
| 168 | - break; \ | ||
| 169 | - } \ | ||
| 170 | - } \ | ||
| 171 | - } \ | ||
| 172 | - while (++middle <= right); \ | ||
| 173 | - break; \ | ||
| 174 | - } \ | ||
| 175 | - \ | ||
| 176 | - if (cmpres < 0) \ | ||
| 177 | - left = middle + 1; \ | ||
| 178 | - else \ | ||
| 179 | - right = middle - 1; \ | ||
| 180 | - } \ | ||
| 181 | - } \ | ||
| 182 | -while (0) | ||
| 183 | - | ||
| 184 | - | ||
| 185 | int | ||
| 186 | -internal_function | ||
| 187 | _dl_cache_libcmp (const char *p1, const char *p2) | ||
| 188 | { | ||
| 189 | while (*p1 != '\0') | ||
| 190 | @@ -172,139 +76,3 @@ _dl_cache_libcmp (const char *p1, const | ||
| 191 | } | ||
| 192 | return *p1 - *p2; | ||
| 193 | } | ||
| 194 | - | ||
| 195 | - | ||
| 196 | -/* Look up NAME in ld.so.cache and return the file name stored there, | ||
| 197 | - or null if none is found. */ | ||
| 198 | - | ||
| 199 | -const char * | ||
| 200 | -internal_function | ||
| 201 | -_dl_load_cache_lookup (const char *name) | ||
| 202 | -{ | ||
| 203 | - int left, right, middle; | ||
| 204 | - int cmpres; | ||
| 205 | - const char *cache_data; | ||
| 206 | - uint32_t cache_data_size; | ||
| 207 | - const char *best; | ||
| 208 | - | ||
| 209 | - /* Print a message if the loading of libs is traced. */ | ||
| 210 | - if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) | ||
| 211 | - _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); | ||
| 212 | - | ||
| 213 | - if (cache == NULL) | ||
| 214 | - { | ||
| 215 | - /* Read the contents of the file. */ | ||
| 216 | - void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, | ||
| 217 | - PROT_READ); | ||
| 218 | - | ||
| 219 | - /* We can handle three different cache file formats here: | ||
| 220 | - - the old libc5/glibc2.0/2.1 format | ||
| 221 | - - the old format with the new format in it | ||
| 222 | - - only the new format | ||
| 223 | - The following checks if the cache contains any of these formats. */ | ||
| 224 | - if (file != MAP_FAILED && cachesize > sizeof *cache | ||
| 225 | - && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0) | ||
| 226 | - { | ||
| 227 | - size_t offset; | ||
| 228 | - /* Looks ok. */ | ||
| 229 | - cache = file; | ||
| 230 | - | ||
| 231 | - /* Check for new version. */ | ||
| 232 | - offset = ALIGN_CACHE (sizeof (struct cache_file) | ||
| 233 | - + cache->nlibs * sizeof (struct file_entry)); | ||
| 234 | - | ||
| 235 | - cache_new = (struct cache_file_new *) ((void *) cache + offset); | ||
| 236 | - if (cachesize < (offset + sizeof (struct cache_file_new)) | ||
| 237 | - || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW, | ||
| 238 | - sizeof CACHEMAGIC_VERSION_NEW - 1) != 0) | ||
| 239 | - cache_new = (void *) -1; | ||
| 240 | - } | ||
| 241 | - else if (file != MAP_FAILED && cachesize > sizeof *cache_new | ||
| 242 | - && memcmp (file, CACHEMAGIC_VERSION_NEW, | ||
| 243 | - sizeof CACHEMAGIC_VERSION_NEW - 1) == 0) | ||
| 244 | - { | ||
| 245 | - cache_new = file; | ||
| 246 | - cache = file; | ||
| 247 | - } | ||
| 248 | - else | ||
| 249 | - { | ||
| 250 | - if (file != MAP_FAILED) | ||
| 251 | - __munmap (file, cachesize); | ||
| 252 | - cache = (void *) -1; | ||
| 253 | - } | ||
| 254 | - | ||
| 255 | - assert (cache != NULL); | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - if (cache == (void *) -1) | ||
| 259 | - /* Previously looked for the cache file and didn't find it. */ | ||
| 260 | - return NULL; | ||
| 261 | - | ||
| 262 | - best = NULL; | ||
| 263 | - | ||
| 264 | - if (cache_new != (void *) -1) | ||
| 265 | - { | ||
| 266 | - uint64_t platform; | ||
| 267 | - | ||
| 268 | - /* This is where the strings start. */ | ||
| 269 | - cache_data = (const char *) cache_new; | ||
| 270 | - | ||
| 271 | - /* Now we can compute how large the string table is. */ | ||
| 272 | - cache_data_size = (const char *) cache + cachesize - cache_data; | ||
| 273 | - | ||
| 274 | - platform = _dl_string_platform (GLRO(dl_platform)); | ||
| 275 | - if (platform != (uint64_t) -1) | ||
| 276 | - platform = 1ULL << platform; | ||
| 277 | - | ||
| 278 | -#define _DL_HWCAP_TLS_MASK (1LL << 63) | ||
| 279 | - uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask)) | ||
| 280 | - | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK); | ||
| 281 | - | ||
| 282 | - /* Only accept hwcap if it's for the right platform. */ | ||
| 283 | -#define HWCAP_CHECK \ | ||
| 284 | - if (lib->hwcap & hwcap_exclude) \ | ||
| 285 | - continue; \ | ||
| 286 | - if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \ | ||
| 287 | - continue; \ | ||
| 288 | - if (_DL_PLATFORMS_COUNT \ | ||
| 289 | - && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ | ||
| 290 | - && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ | ||
| 291 | - continue | ||
| 292 | - SEARCH_CACHE (cache_new); | ||
| 293 | - } | ||
| 294 | - else | ||
| 295 | - { | ||
| 296 | - /* This is where the strings start. */ | ||
| 297 | - cache_data = (const char *) &cache->libs[cache->nlibs]; | ||
| 298 | - | ||
| 299 | - /* Now we can compute how large the string table is. */ | ||
| 300 | - cache_data_size = (const char *) cache + cachesize - cache_data; | ||
| 301 | - | ||
| 302 | -#undef HWCAP_CHECK | ||
| 303 | -#define HWCAP_CHECK do {} while (0) | ||
| 304 | - SEARCH_CACHE (cache); | ||
| 305 | - } | ||
| 306 | - | ||
| 307 | - /* Print our result if wanted. */ | ||
| 308 | - if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0) | ||
| 309 | - && best != NULL) | ||
| 310 | - _dl_debug_printf (" trying file=%s\n", best); | ||
| 311 | - | ||
| 312 | - return best; | ||
| 313 | -} | ||
| 314 | - | ||
| 315 | -#ifndef MAP_COPY | ||
| 316 | -/* If the system does not support MAP_COPY we cannot leave the file open | ||
| 317 | - all the time since this would create problems when the file is replaced. | ||
| 318 | - Therefore we provide this function to close the file and open it again | ||
| 319 | - once needed. */ | ||
| 320 | -void | ||
| 321 | -_dl_unload_cache (void) | ||
| 322 | -{ | ||
| 323 | - if (cache != NULL && cache != (struct cache_file *) -1) | ||
| 324 | - { | ||
| 325 | - __munmap (cache, cachesize); | ||
| 326 | - cache = NULL; | ||
| 327 | - } | ||
| 328 | -} | ||
| 329 | -#endif | ||
| 330 | Index: ldconfig-native-2.12.1/dl-cache.h | ||
| 331 | =================================================================== | ||
| 332 | --- ldconfig-native-2.12.1.orig/dl-cache.h | ||
| 333 | +++ ldconfig-native-2.12.1/dl-cache.h | ||
| 334 | @@ -101,5 +101,4 @@ struct cache_file_new | ||
| 335 | (((addr) + __alignof__ (struct cache_file_new) -1) \ | ||
| 336 | & (~(__alignof__ (struct cache_file_new) - 1))) | ||
| 337 | |||
| 338 | -extern int _dl_cache_libcmp (const char *p1, const char *p2) | ||
| 339 | - internal_function; | ||
| 340 | +extern int _dl_cache_libcmp (const char *p1, const char *p2); | ||
| 341 | Index: ldconfig-native-2.12.1/ldconfig.c | ||
| 342 | =================================================================== | ||
| 343 | --- ldconfig-native-2.12.1.orig/ldconfig.c | ||
| 344 | +++ ldconfig-native-2.12.1/ldconfig.c | ||
| 345 | @@ -16,6 +16,9 @@ | ||
| 346 | along with this program; if not, write to the Free Software Foundation, | ||
| 347 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
| 348 | |||
| 349 | +#define _LARGEFILE64_SOURCE | ||
| 350 | +#define _GNU_SOURCE | ||
| 351 | + | ||
| 352 | #define PROCINFO_CLASS static | ||
| 353 | #include <alloca.h> | ||
| 354 | #include <argp.h> | ||
| 355 | @@ -39,10 +42,20 @@ | ||
| 356 | #include <glob.h> | ||
| 357 | #include <libgen.h> | ||
| 358 | |||
| 359 | -#include <ldconfig.h> | ||
| 360 | -#include <dl-cache.h> | ||
| 361 | +#include "ldconfig.h" | ||
| 362 | +#include "dl-cache.h" | ||
| 363 | + | ||
| 364 | +#include "dl-procinfo.h" | ||
| 365 | + | ||
| 366 | +#include "argp.h" | ||
| 367 | + | ||
| 368 | + | ||
| 369 | +#define SYSCONFDIR "/etc" | ||
| 370 | +#define LIBDIR "/usr/lib" | ||
| 371 | +#define SLIBDIR "/lib" | ||
| 372 | +# define N_(msgid) msgid | ||
| 373 | +#define _(msg) msg | ||
| 374 | |||
| 375 | -#include <dl-procinfo.h> | ||
| 376 | |||
| 377 | #ifdef _DL_FIRST_PLATFORM | ||
| 378 | # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) | ||
| 379 | @@ -55,7 +68,7 @@ | ||
| 380 | #endif | ||
| 381 | |||
| 382 | /* Get libc version number. */ | ||
| 383 | -#include <version.h> | ||
| 384 | +#include "version.h" | ||
| 385 | |||
| 386 | #define PACKAGE _libc_intl_domainname | ||
| 387 | |||
| 388 | @@ -152,8 +165,8 @@ static const struct argp_option options[ | ||
| 389 | { NULL, 0, NULL, 0, NULL, 0 } | ||
| 390 | }; | ||
| 391 | |||
| 392 | -#define PROCINFO_CLASS static | ||
| 393 | -#include <dl-procinfo.c> | ||
| 394 | +//#define PROCINFO_CLASS static | ||
| 395 | +//#include <dl-procinfo.c> | ||
| 396 | |||
| 397 | /* Short description of program. */ | ||
| 398 | static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings."); | ||
| 399 | @@ -291,6 +304,7 @@ parse_opt (int key, char *arg, struct ar | ||
| 400 | return 0; | ||
| 401 | } | ||
| 402 | |||
| 403 | +#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org" | ||
| 404 | /* Print bug-reporting information in the help message. */ | ||
| 405 | static char * | ||
| 406 | more_help (int key, const char *text, void *input) | ||
| 407 | @@ -315,7 +329,7 @@ For bug reporting instructions, please s | ||
| 408 | static void | ||
| 409 | print_version (FILE *stream, struct argp_state *state) | ||
| 410 | { | ||
| 411 | - fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION); | ||
| 412 | + fprintf (stream, "ldconfig (Hacked Poky Version)\n"); | ||
| 413 | fprintf (stream, gettext ("\ | ||
| 414 | Copyright (C) %s Free Software Foundation, Inc.\n\ | ||
| 415 | This is free software; see the source for copying conditions. There is NO\n\ | ||
| 416 | @@ -1233,6 +1247,7 @@ set_hwcap (void) | ||
| 417 | hwcap_mask = strtoul (mask, NULL, 0); | ||
| 418 | } | ||
| 419 | |||
| 420 | +const char _libc_intl_domainname[] = "libc"; | ||
| 421 | |||
| 422 | int | ||
| 423 | main (int argc, char **argv) | ||
| 424 | Index: ldconfig-native-2.12.1/readlib.c | ||
| 425 | =================================================================== | ||
| 426 | --- ldconfig-native-2.12.1.orig/readlib.c | ||
| 427 | +++ ldconfig-native-2.12.1/readlib.c | ||
| 428 | @@ -22,6 +22,9 @@ | ||
| 429 | development version. Besides the simplification, it has also been | ||
| 430 | modified to read some other file formats. */ | ||
| 431 | |||
| 432 | +#define _LARGEFILE64_SOURCE | ||
| 433 | +#define _GNU_SOURCE | ||
| 434 | + | ||
| 435 | #include <a.out.h> | ||
| 436 | #include <elf.h> | ||
| 437 | #include <error.h> | ||
| 438 | @@ -35,7 +38,9 @@ | ||
| 439 | #include <sys/stat.h> | ||
| 440 | #include <gnu/lib-names.h> | ||
| 441 | |||
| 442 | -#include <ldconfig.h> | ||
| 443 | +#include "ldconfig.h" | ||
| 444 | + | ||
| 445 | +#define _(msg) msg | ||
| 446 | |||
| 447 | #define Elf32_CLASS ELFCLASS32 | ||
| 448 | #define Elf64_CLASS ELFCLASS64 | ||
| 449 | Index: ldconfig-native-2.12.1/xstrdup.c | ||
| 450 | =================================================================== | ||
| 451 | --- ldconfig-native-2.12.1.orig/xstrdup.c | ||
| 452 | +++ ldconfig-native-2.12.1/xstrdup.c | ||
| 453 | @@ -16,15 +16,10 @@ | ||
| 454 | along with this program; if not, write to the Free Software Foundation, | ||
| 455 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
| 456 | |||
| 457 | -#ifdef HAVE_CONFIG_H | ||
| 458 | -# include <config.h> | ||
| 459 | -#endif | ||
| 460 | +#define _GNU_SOURCE | ||
| 461 | + | ||
| 462 | +#include <string.h> | ||
| 463 | |||
| 464 | -#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC | ||
| 465 | -# include <string.h> | ||
| 466 | -#else | ||
| 467 | -# include <strings.h> | ||
| 468 | -#endif | ||
| 469 | void *xmalloc (size_t n) __THROW; | ||
| 470 | char *xstrdup (char *string) __THROW; | ||
| 471 | |||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch new file mode 100644 index 0000000000..27bc411078 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | Upstream-Status: Pending | ||
| 2 | |||
| 3 | Coming from this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11149 | ||
| 4 | |||
| 5 | Nitin A Kamble <nitin.a.kamble@intel.com>2011/03/29 | ||
| 6 | |||
| 7 | --- ldconfig-native-2.12.1.orig/ldconfig.c | ||
| 8 | +++ ldconfig-native-2.12.1/ldconfig.c | ||
| 9 | @@ -1359,14 +1359,9 @@ main (int argc, char **argv) | ||
| 10 | |||
| 11 | const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; | ||
| 12 | if (opt_chroot) | ||
| 13 | - { | ||
| 14 | - aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); | ||
| 15 | - if (aux_cache_file == NULL) | ||
| 16 | - error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), | ||
| 17 | - _PATH_LDCONFIG_AUX_CACHE); | ||
| 18 | - } | ||
| 19 | + aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); | ||
| 20 | |||
| 21 | - if (! opt_ignore_aux_cache) | ||
| 22 | + if (! opt_ignore_aux_cache && aux_cache_file) | ||
| 23 | load_aux_cache (aux_cache_file); | ||
| 24 | else | ||
| 25 | init_aux_cache (); | ||
| 26 | @@ -1376,7 +1371,8 @@ main (int argc, char **argv) | ||
| 27 | if (opt_build_cache) | ||
| 28 | { | ||
| 29 | save_cache (cache_file); | ||
| 30 | - save_aux_cache (aux_cache_file); | ||
| 31 | + if (aux_cache_file) | ||
| 32 | + save_aux_cache (aux_cache_file); | ||
| 33 | } | ||
| 34 | |||
| 35 | return 0; | ||
| 36 | |||
diff --git a/meta-oe/recipes-core/eglibc/ldconfig-native_2.12.1.bb b/meta-oe/recipes-core/eglibc/ldconfig-native_2.12.1.bb new file mode 100644 index 0000000000..00edb6e875 --- /dev/null +++ b/meta-oe/recipes-core/eglibc/ldconfig-native_2.12.1.bb | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | DESCRIPTION = "A standalone native ldconfig build" | ||
| 2 | |||
| 3 | LICENSE = "GPLv2.1" | ||
| 4 | |||
| 5 | LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399" | ||
| 6 | |||
| 7 | SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \ | ||
| 8 | file://ldconfig.patch \ | ||
| 9 | file://ldconfig_aux-cache_path_fix.patch \ | ||
| 10 | file://32and64bit.patch \ | ||
| 11 | file://endian-ness_handling.patch \ | ||
| 12 | file://flag_fix.patch \ | ||
| 13 | file://endianess-header.patch" | ||
| 14 | |||
| 15 | PR = "r1" | ||
| 16 | |||
| 17 | inherit native | ||
| 18 | |||
| 19 | S = "${WORKDIR}/${PN}-${PV}" | ||
| 20 | |||
| 21 | do_compile () { | ||
| 22 | $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig | ||
| 23 | } | ||
| 24 | |||
| 25 | do_install () { | ||
| 26 | install -d ${D}/${bindir}/ | ||
| 27 | install ldconfig ${D}/${bindir}/ | ||
| 28 | } | ||
