diff options
| -rw-r--r-- | meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch | 103 | ||||
| -rw-r--r-- | meta/recipes-core/glibc/ldconfig-native_2.12.1.bb | 1 |
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 @@ | |||
| 1 | From 9d62544090b08849218cd1fc52a36cdd5d90363e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuanjie Huang <yuanjie.huang@windriver.com> | ||
| 3 | Date: Fri, 24 Apr 2015 03:29:31 +0000 | ||
| 4 | Subject: [PATCH] Add 64-bit flag for ELF64 entries. | ||
| 5 | |||
| 6 | ldconfig-native was grepped from an old version of glibc, and its output | ||
| 7 | lacks neccessary 64bit flag in entries. | ||
| 8 | Due to this defect, ctypes.util.find_library() python function fails to | ||
| 9 | detect any library due to the old file format that ldconfig-native | ||
| 10 | creates. This fix sets architecture-dependent 64bit flags for 64-bit ELF. | ||
| 11 | |||
| 12 | Upstream-status: Inappropriate [embedded specific] | ||
| 13 | |||
| 14 | Signed-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 | |||
| 21 | diff --git a/cache.c b/cache.c | ||
| 22 | index 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: | ||
| 36 | diff --git a/ldconfig.h b/ldconfig.h | ||
| 37 | index 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" | ||
| 51 | diff --git a/readelflib.c b/readelflib.c | ||
| 52 | index 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 | ||
| 18 | PR = "r2" | 19 | PR = "r2" |
