summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc
diff options
context:
space:
mode:
authorYuanjie Huang <yuanjie.huang@windriver.com>2015-07-03 09:48:37 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-08 00:01:22 +0100
commit09febe09dc7481dcd08dc3cb033ea85e0e75abff (patch)
tree1cef95f37956c01c3cdfb76d6aeb6d70211740b3 /meta/recipes-core/glibc
parentdaec53e9772b48bd11b3a0b900f0fcb32b687df3 (diff)
downloadpoky-09febe09dc7481dcd08dc3cb033ea85e0e75abff.tar.gz
ldconfig-native: Add 64-bit flag for ELF64 entries
ldconfig-native was grepped from an old version of glibc, and its output lacks neccessary 64bit flag in entries. Due to this defect, ctypes.util.find_library() python function fails to detect any library due to the old file format that ldconfig-native creates. This fix sets architecture-dependent 64bit flags for 64-bit ELF. Since the host's elf.h may not have definition for new AArch64 machine type, a work-around is added to correctly flag 64-bit ARM libraries. (From OE-Core rev: 0b0e4d7aa64feded0a7bf89264d2367489808a38) Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glibc')
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch103
-rw-r--r--meta/recipes-core/glibc/ldconfig-native_2.12.1.bb1
2 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch
new file mode 100644
index 0000000000..a0fabae3af
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch
@@ -0,0 +1,103 @@
1From 9d62544090b08849218cd1fc52a36cdd5d90363e Mon Sep 17 00:00:00 2001
2From: Yuanjie Huang <yuanjie.huang@windriver.com>
3Date: Fri, 24 Apr 2015 03:29:31 +0000
4Subject: [PATCH] Add 64-bit flag for ELF64 entries.
5
6ldconfig-native was grepped from an old version of glibc, and its output
7lacks neccessary 64bit flag in entries.
8Due to this defect, ctypes.util.find_library() python function fails to
9detect any library due to the old file format that ldconfig-native
10creates. This fix sets architecture-dependent 64bit flags for 64-bit ELF.
11
12Upstream-status: Inappropriate [embedded specific]
13
14Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
15---
16 cache.c | 4 ++++
17 ldconfig.h | 4 ++++
18 readelflib.c | 34 ++++++++++++++++++++++++++++++++++
19 3 files changed, 42 insertions(+)
20
21diff --git a/cache.c b/cache.c
22index a904d44..c4f5411 100644
23--- a/cache.c
24+++ b/cache.c
25@@ -121,6 +121,10 @@ print_entry (const char *lib, int flag, unsigned int osversion,
26 break;
27 case FLAG_MIPS64_LIBN64:
28 fputs (",64bit", stdout);
29+ break;
30+ case FLAG_AARCH64_LIB64:
31+ fputs (",AArch64", stdout);
32+ break;
33 case 0:
34 break;
35 default:
36diff --git a/ldconfig.h b/ldconfig.h
37index fadd5ec..6a8a750 100644
38--- a/ldconfig.h
39+++ b/ldconfig.h
40@@ -34,6 +34,10 @@
41 #define FLAG_POWERPC_LIB64 0x0500
42 #define FLAG_MIPS64_LIBN32 0x0600
43 #define FLAG_MIPS64_LIBN64 0x0700
44+#define FLAG_X8664_LIBX32 0x0800
45+#define FLAG_ARM_LIBHF 0x0900
46+#define FLAG_AARCH64_LIB64 0x0a00
47+#define FLAG_ARM_LIBSF 0x0b00
48
49 /* Name of auxiliary cache. */
50 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
51diff --git a/readelflib.c b/readelflib.c
52index 0bf0de3..6e87afc 100644
53--- a/readelflib.c
54+++ b/readelflib.c
55@@ -28,6 +28,11 @@
56
57 #include "endian_extra.h"
58
59+/* Work-around for old host that does not have AArch64 defined in elf.h. */
60+#ifndef EM_AARCH64
61+#define EM_AARCH64 183 /* ARM AARCH64 */
62+#endif
63+
64 #undef check_ptr
65 #define check_ptr(ptr) \
66 do \
67@@ -290,6 +295,35 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
68 libc5/libc6. */
69 *flag = FLAG_ELF;
70
71+ /* Set flags according to information in ELF header to align with target
72+ ldconfig */
73+ switch (elf_header->e_machine)
74+ {
75+ case EM_IA_64:
76+ *flag |= FLAG_IA64_LIB64;
77+ break;
78+ case EM_X86_64:
79+ *flag |= FLAG_X8664_LIB64;
80+ break;
81+ case EM_S390:
82+ *flag |= FLAG_S390_LIB64;
83+ break;
84+ case EM_PPC64:
85+ *flag |= FLAG_POWERPC_LIB64;
86+ break;
87+ case EM_MIPS:
88+ case EM_MIPS_RS3_LE:
89+ *flag |= FLAG_MIPS64_LIBN64;
90+ break;
91+ case EM_AARCH64:
92+ *flag |= FLAG_AARCH64_LIB64;
93+ break;
94+ default:
95+ error(0, 0, "%s is a 64-bit ELF for unknown machine %lx\n",
96+ file_name, (long)elf_header->e_machine);
97+ break;
98+ }
99+
100 loadaddr = -1;
101 dynamic_addr = 0;
102 dynamic_size = 0;
103--
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 1debf8ee2f..93c0b18671 100644
--- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -13,6 +13,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
13 file://endianess-header.patch \ 13 file://endianess-header.patch \
14 file://ldconfig-default-to-all-multilib-dirs.patch \ 14 file://ldconfig-default-to-all-multilib-dirs.patch \
15 file://endian-ness_handling_fix.patch \ 15 file://endian-ness_handling_fix.patch \
16 file://add-64-bit-flag-for-ELF64-entries.patch \
16" 17"
17 18
18PR = "r2" 19PR = "r2"