From 694db055f3729662e0e0193a31f2098be599877f Mon Sep 17 00:00:00 2001 From: Nitin A Kamble Date: Tue, 29 Mar 2011 12:55:18 -0700 Subject: ldconfig-native-2.12.1: newer recipe with eglibc sources This fixes [YOCTO #780] Handle the input/output data with different endian-ness correctly Also fix the definition of LD_SO for cross environment And remove the older 2.5 version of ldconfig-native recipe Signed-off-by: Richard Purdie Signed-off-by: Nitin A Kamble --- .../eglibc/ldconfig-native-2.12.1/32and64bit.patch | 323 ++++++++++++++ .../eglibc/ldconfig-native-2.12.1/README | 8 + .../endian-ness_handling.patch | 451 ++++++++++++++++++++ .../eglibc/ldconfig-native-2.12.1/flag_fix.patch | 22 + .../ldconfig-native-2.12.1.tar.bz2 | Bin 0 -> 21491 bytes .../eglibc/ldconfig-native-2.12.1/ldconfig.patch | 467 +++++++++++++++++++++ .../ldconfig_aux-cache_path_fix.patch | 34 ++ meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb | 27 ++ .../glibc/ldconfig-native-2.5/32and64bit.patch | 289 ------------- .../ldconfig-native-2.5.tar.bz2 | Bin 19454 -> 0 bytes .../glibc/ldconfig-native-2.5/ldconfig.patch | 460 -------------------- meta/recipes-core/glibc/ldconfig-native_2.5.bb | 24 -- 12 files changed, 1332 insertions(+), 773 deletions(-) create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/README create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch create mode 100644 meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch create mode 100644 meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb delete mode 100644 meta/recipes-core/glibc/ldconfig-native-2.5/32and64bit.patch delete mode 100644 meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig-native-2.5.tar.bz2 delete mode 100644 meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig.patch delete mode 100644 meta/recipes-core/glibc/ldconfig-native_2.5.bb (limited to 'meta/recipes-core') diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch new file mode 100644 index 0000000000..8069c8931d --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch @@ -0,0 +1,323 @@ +Index: ldconfig-native-2.12.1/readelflib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readelflib.c ++++ ldconfig-native-2.12.1/readelflib.c +@@ -40,39 +40,212 @@ do \ + + /* Returns 0 if everything is ok, != 0 in case of error. */ + int +-process_elf_file (const char *file_name, const char *lib, int *flag, ++process_elf_file32 (const char *file_name, const char *lib, int *flag, + unsigned int *osversion, char **soname, void *file_contents, + size_t file_length) + { + int i; + unsigned int j; +- ElfW(Addr) loadaddr; ++ Elf32_Addr loadaddr; + unsigned int dynamic_addr; + size_t dynamic_size; + char *program_interpreter; + +- ElfW(Ehdr) *elf_header; +- ElfW(Phdr) *elf_pheader, *segment; +- ElfW(Dyn) *dynamic_segment, *dyn_entry; ++ Elf32_Ehdr *elf_header; ++ Elf32_Phdr *elf_pheader, *segment; ++ Elf32_Dyn *dynamic_segment, *dyn_entry; + char *dynamic_strings; + +- elf_header = (ElfW(Ehdr) *) file_contents; ++ elf_header = (Elf32_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS)) ++ if (elf_header->e_type != ET_DYN) + { +- if (opt_verbose) ++ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, ++ elf_header->e_type); ++ return 1; ++ } ++ ++ /* Get information from elf program header. */ ++ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); ++ check_ptr (elf_pheader); ++ ++ /* The library is an elf library, now search for soname and ++ libc5/libc6. */ ++ *flag = FLAG_ELF; ++ ++ loadaddr = -1; ++ dynamic_addr = 0; ++ dynamic_size = 0; ++ program_interpreter = NULL; ++ for (i = 0, segment = elf_pheader; ++ i < elf_header->e_phnum; i++, segment++) ++ { ++ check_ptr (segment); ++ ++ switch (segment->p_type) + { +- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) +- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name); +- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) +- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name); +- else +- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); ++ case PT_LOAD: ++ if (loadaddr == (Elf32_Addr) -1) ++ loadaddr = segment->p_vaddr - segment->p_offset; ++ break; ++ ++ case PT_DYNAMIC: ++ if (dynamic_addr) ++ error (0, 0, _("more than one dynamic segment\n")); ++ ++ dynamic_addr = segment->p_offset; ++ dynamic_size = segment->p_filesz; ++ break; ++ ++ case PT_INTERP: ++ program_interpreter = (char *) (file_contents + segment->p_offset); ++ check_ptr (program_interpreter); ++ ++ /* Check if this is enough to classify the binary. */ ++ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]); ++ ++j) ++ if (strcmp (program_interpreter, interpreters[j].soname) == 0) ++ { ++ *flag = interpreters[j].flag; ++ break; ++ } ++ break; ++ ++ case PT_NOTE: ++ if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ { ++ Elf32_Word *abi_note = (Elf32_Word *) (file_contents ++ + segment->p_offset); ++ Elf32_Addr size = segment->p_filesz; ++ ++ while (abi_note [0] != 4 || abi_note [1] != 16 ++ || abi_note [2] != 1 ++ || memcmp (abi_note + 3, "GNU", 4) != 0) ++ { ++#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) ++ Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) ++ + ROUND (abi_note[0]) ++ + ROUND (abi_note[1]); ++ ++ if (size - 32 < note_size || note_size == 0) ++ { ++ size = 0; ++ break; ++ } ++ size -= note_size; ++ abi_note = (void *) abi_note + note_size; ++ } ++ ++ if (size == 0) ++ break; ++ ++ *osversion = (abi_note [4] << 24) | ++ ((abi_note [5] & 0xff) << 16) | ++ ((abi_note [6] & 0xff) << 8) | ++ (abi_note [7] & 0xff); ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ } ++ if (loadaddr == (Elf32_Addr) -1) ++ { ++ /* Very strange. */ ++ loadaddr = 0; ++ } ++ ++ /* Now we can read the dynamic sections. */ ++ if (dynamic_size == 0) ++ return 1; ++ ++ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr); ++ check_ptr (dynamic_segment); ++ ++ /* Find the string table. */ ++ dynamic_strings = NULL; ++ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ ++dyn_entry) ++ { ++ check_ptr (dyn_entry); ++ if (dyn_entry->d_tag == DT_STRTAB) ++ { ++ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ check_ptr (dynamic_strings); ++ break; + } +- return 1; + } + ++ if (dynamic_strings == NULL) ++ return 1; ++ ++ /* Now read the DT_NEEDED and DT_SONAME entries. */ ++ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ ++dyn_entry) ++ { ++ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ { ++ char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ check_ptr (name); ++ ++ if (dyn_entry->d_tag == DT_NEEDED) ++ { ++ ++ if (*flag == FLAG_ELF) ++ { ++ /* Check if this is enough to classify the binary. */ ++ for (j = 0; ++ j < sizeof (known_libs) / sizeof (known_libs [0]); ++ ++j) ++ if (strcmp (name, known_libs [j].soname) == 0) ++ { ++ *flag = known_libs [j].flag; ++ break; ++ } ++ } ++ } ++ ++ else if (dyn_entry->d_tag == DT_SONAME) ++ *soname = xstrdup (name); ++ ++ /* Do we have everything we need? */ ++ if (*soname && *flag != FLAG_ELF) ++ return 0; ++ } ++ } ++ ++ /* We reach this point only if the file doesn't contain a DT_SONAME ++ or if we can't classify the library. If it doesn't have a ++ soname, return the name of the library. */ ++ if (*soname == NULL) ++ *soname = xstrdup (lib); ++ ++ return 0; ++} ++ ++int ++process_elf_file64 (const char *file_name, const char *lib, int *flag, ++ unsigned int *osversion, char **soname, void *file_contents, ++ size_t file_length) ++{ ++ int i; ++ unsigned int j; ++ Elf64_Addr loadaddr; ++ unsigned int dynamic_addr; ++ size_t dynamic_size; ++ char *program_interpreter; ++ ++ Elf64_Ehdr *elf_header; ++ Elf64_Phdr *elf_pheader, *segment; ++ Elf64_Dyn *dynamic_segment, *dyn_entry; ++ char *dynamic_strings; ++ ++ elf_header = (Elf64_Ehdr *) file_contents; ++ *osversion = 0; ++ + if (elf_header->e_type != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +@@ -81,7 +254,7 @@ process_elf_file (const char *file_name, + } + + /* Get information from elf program header. */ +- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -100,7 +273,7 @@ process_elf_file (const char *file_name, + switch (segment->p_type) + { + case PT_LOAD: +- if (loadaddr == (ElfW(Addr)) -1) ++ if (loadaddr == (Elf64_Addr) -1) + loadaddr = segment->p_vaddr - segment->p_offset; + break; + +@@ -129,16 +302,16 @@ process_elf_file (const char *file_name, + case PT_NOTE: + if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) + { +- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents ++ Elf64_Word *abi_note = (Elf64_Word *) (file_contents + + segment->p_offset); +- ElfW(Addr) size = segment->p_filesz; ++ Elf64_Addr size = segment->p_filesz; + + while (abi_note [0] != 4 || abi_note [1] != 16 + || abi_note [2] != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { +-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word))) +- ElfW(Addr) note_size = 3 * sizeof (ElfW(Word)) ++#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) ++ Elf64_Addr note_size = 3 * sizeof (Elf64_Word) + + ROUND (abi_note[0]) + + ROUND (abi_note[1]); + +@@ -166,7 +339,7 @@ process_elf_file (const char *file_name, + } + + } +- if (loadaddr == (ElfW(Addr)) -1) ++ if (loadaddr == (Elf64_Addr) -1) + { + /* Very strange. */ + loadaddr = 0; +@@ -176,7 +349,7 @@ process_elf_file (const char *file_name, + if (dynamic_size == 0) + return 1; + +- dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr); ++ dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr); + check_ptr (dynamic_segment); + + /* Find the string table. */ +@@ -233,3 +406,33 @@ process_elf_file (const char *file_name, + + return 0; + } ++/* Returns 0 if everything is ok, != 0 in case of error. */ ++int ++process_elf_file (const char *file_name, const char *lib, int *flag, ++ unsigned int *osversion, char **soname, void *file_contents, ++ size_t file_length) ++{ ++ int i; ++ unsigned int j; ++ ElfW(Addr) loadaddr; ++ unsigned int dynamic_addr; ++ size_t dynamic_size; ++ char *program_interpreter; ++ ++ ElfW(Ehdr) *elf_header; ++ ElfW(Phdr) *elf_pheader, *segment; ++ ElfW(Dyn) *dynamic_segment, *dyn_entry; ++ char *dynamic_strings; ++ ++ elf_header = (ElfW(Ehdr) *) file_contents; ++ *osversion = 0; ++ ++ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) ++ return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length); ++ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) ++ return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length); ++ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); ++ return 1; ++} ++ ++ diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/README b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/README new file mode 100644 index 0000000000..43fb983729 --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/README @@ -0,0 +1,8 @@ +The files are pulled verbatim from glibc 2.5 and then patched to allow +standalone compilation of ldconfig. + +Richard Purdie +OpenedHand Ltd. + +Upgraded the ldconfig recipe to eglibc 2.12.1 +Nitin A Kamble 2011/03/29 diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch new file mode 100644 index 0000000000..77ba03c1af --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch @@ -0,0 +1,451 @@ +Do data input/output handling according to endien-ness of the library file. + +2011/04/04 +Richard Purdie +Nitin Kamble + +Index: ldconfig-native-2.12.1/readelflib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readelflib.c ++++ ldconfig-native-2.12.1/readelflib.c +@@ -38,6 +38,28 @@ do \ + } \ + while (0); + ++int be; ++static uint16_t read16(uint16_t x, int be) ++{ ++ if (be) ++ return be16toh(x); ++ return le16toh(x); ++} ++ ++static uint32_t read32(uint32_t x, int be) ++{ ++ if (be) ++ return be32toh(x); ++ return le32toh(x); ++} ++ ++static uint64_t read64(uint64_t x, int be) ++{ ++ if (be) ++ return be64toh(x); ++ return le64toh(x); ++} ++ + /* Returns 0 if everything is ok, != 0 in case of error. */ + int + process_elf_file32 (const char *file_name, const char *lib, int *flag, +@@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam + elf_header = (Elf32_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_type != ET_DYN) ++ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); ++ ++ if (read16(elf_header->e_type, be) != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +- elf_header->e_type); ++ read16(elf_header->e_type, be)); + return 1; + } + + /* Get information from elf program header. */ +- elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam + dynamic_size = 0; + program_interpreter = NULL; + for (i = 0, segment = elf_pheader; +- i < elf_header->e_phnum; i++, segment++) ++ i < read16(elf_header->e_phnum, be); i++, segment++) + { + check_ptr (segment); + +- switch (segment->p_type) ++ switch (read32(segment->p_type, be)) + { + case PT_LOAD: + if (loadaddr == (Elf32_Addr) -1) +- loadaddr = segment->p_vaddr - segment->p_offset; ++ loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); + break; + + case PT_DYNAMIC: + if (dynamic_addr) + error (0, 0, _("more than one dynamic segment\n")); + +- dynamic_addr = segment->p_offset; +- dynamic_size = segment->p_filesz; ++ dynamic_addr = read32(segment->p_offset, be); ++ dynamic_size = read32(segment->p_filesz, be); + break; + + case PT_INTERP: +- program_interpreter = (char *) (file_contents + segment->p_offset); ++ program_interpreter = (char *) (file_contents + read32(segment->p_offset, be)); + check_ptr (program_interpreter); + + /* Check if this is enough to classify the binary. */ +@@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam + break; + + case PT_NOTE: +- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4) + { + Elf32_Word *abi_note = (Elf32_Word *) (file_contents +- + segment->p_offset); +- Elf32_Addr size = segment->p_filesz; ++ + read32(segment->p_offset, be)); ++ Elf32_Addr size = read32(segment->p_filesz, be); + +- while (abi_note [0] != 4 || abi_note [1] != 16 +- || abi_note [2] != 1 ++ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 ++ || read32(abi_note [2], be) != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { +-#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) +- Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) +- + ROUND (abi_note[0]) +- + ROUND (abi_note[1]); ++#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word)) ++ Elf32_Addr note_size = 3 * sizeof (Elf32_Word) ++ + ROUND (read32(abi_note[0], be)) ++ + ROUND (read32(abi_note[1], be)); + + if (size - 32 < note_size || note_size == 0) + { +@@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam + if (size == 0) + break; + +- *osversion = (abi_note [4] << 24) | +- ((abi_note [5] & 0xff) << 16) | +- ((abi_note [6] & 0xff) << 8) | +- (abi_note [7] & 0xff); ++ *osversion = (read32(abi_note [4], be) << 24) | ++ ((read32(abi_note [5], be) & 0xff) << 16) | ++ ((read32(abi_note [6], be) & 0xff) << 8) | ++ (read32(abi_note [7], be) & 0xff); + } + break; + +@@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam + + /* Find the string table. */ + dynamic_strings = NULL; +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { + check_ptr (dyn_entry); +- if (dyn_entry->d_tag == DT_STRTAB) ++ if (read32(dyn_entry->d_tag, be) == DT_STRTAB) + { +- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr); + check_ptr (dynamic_strings); + break; + } +@@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam + return 1; + + /* Now read the DT_NEEDED and DT_SONAME entries. */ +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { +- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME) + { +- char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be); + check_ptr (name); + +- if (dyn_entry->d_tag == DT_NEEDED) ++ if (read32(dyn_entry->d_tag, be) == DT_NEEDED) + { + + if (*flag == FLAG_ELF) +@@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam + } + } + +- else if (dyn_entry->d_tag == DT_SONAME) ++ else if (read32(dyn_entry->d_tag, be) == DT_SONAME) + *soname = xstrdup (name); + + /* Do we have everything we need? */ +@@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam + elf_header = (Elf64_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_type != ET_DYN) ++ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); ++ ++ if (read16(elf_header->e_type, be) != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +- elf_header->e_type); ++ read16(elf_header->e_type, be)); + return 1; + } + + /* Get information from elf program header. */ +- elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam + dynamic_size = 0; + program_interpreter = NULL; + for (i = 0, segment = elf_pheader; +- i < elf_header->e_phnum; i++, segment++) ++ i < read16(elf_header->e_phnum, be); i++, segment++) + { + check_ptr (segment); + +- switch (segment->p_type) ++ switch (read32(segment->p_type, be)) + { + case PT_LOAD: + if (loadaddr == (Elf64_Addr) -1) +- loadaddr = segment->p_vaddr - segment->p_offset; ++ loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); + break; + + case PT_DYNAMIC: + if (dynamic_addr) + error (0, 0, _("more than one dynamic segment\n")); + +- dynamic_addr = segment->p_offset; +- dynamic_size = segment->p_filesz; ++ dynamic_addr = read64(segment->p_offset, be); ++ dynamic_size = read32(segment->p_filesz, be); + break; + + case PT_INTERP: +- program_interpreter = (char *) (file_contents + segment->p_offset); ++ program_interpreter = (char *) (file_contents + read64(segment->p_offset, be)); + check_ptr (program_interpreter); + + /* Check if this is enough to classify the binary. */ +@@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam + break; + + case PT_NOTE: +- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4) + { + Elf64_Word *abi_note = (Elf64_Word *) (file_contents +- + segment->p_offset); +- Elf64_Addr size = segment->p_filesz; ++ + read64(segment->p_offset, be)); ++ Elf64_Addr size = read32(segment->p_filesz, be); + +- while (abi_note [0] != 4 || abi_note [1] != 16 +- || abi_note [2] != 1 ++ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 ++ || read32(abi_note [2], be) != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { ++#undef ROUND + #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) + Elf64_Addr note_size = 3 * sizeof (Elf64_Word) +- + ROUND (abi_note[0]) +- + ROUND (abi_note[1]); ++ + ROUND (read32(abi_note[0], be)) ++ + ROUND (read32(abi_note[1], be)); + + if (size - 32 < note_size || note_size == 0) + { +@@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam + if (size == 0) + break; + +- *osversion = (abi_note [4] << 24) | +- ((abi_note [5] & 0xff) << 16) | +- ((abi_note [6] & 0xff) << 8) | +- (abi_note [7] & 0xff); ++ *osversion = (read32(abi_note [4], be) << 24) | ++ ((read32(abi_note [5], be) & 0xff) << 16) | ++ ((read32(abi_note [6], be) & 0xff) << 8) | ++ (read32(abi_note [7], be) & 0xff); + } + break; + +@@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam + + /* Find the string table. */ + dynamic_strings = NULL; +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { + check_ptr (dyn_entry); +- if (dyn_entry->d_tag == DT_STRTAB) ++ if (read64(dyn_entry->d_tag, be) == DT_STRTAB) + { +- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr); + check_ptr (dynamic_strings); + break; + } +@@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam + return 1; + + /* Now read the DT_NEEDED and DT_SONAME entries. */ +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { +- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME) + { +- char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be); + check_ptr (name); + +- if (dyn_entry->d_tag == DT_NEEDED) ++ if (read64(dyn_entry->d_tag, be) == DT_NEEDED) + { + + if (*flag == FLAG_ELF) +@@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam + } + } + +- else if (dyn_entry->d_tag == DT_SONAME) ++ else if (read64(dyn_entry->d_tag, be) == DT_SONAME) + *soname = xstrdup (name); + + /* Do we have everything we need? */ +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -169,7 +169,8 @@ process_file (const char *real_file_name + ret = 1; + } + /* Libraries have to be shared object files. */ +- else if (elf_header->e_type != ET_DYN) ++ else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) || ++ (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN)) + ret = 1; + else if (process_elf_file (file_name, lib, flag, osversion, soname, + file_contents, statbuf.st_size)) +Index: ldconfig-native-2.12.1/cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/cache.c ++++ ldconfig-native-2.12.1/cache.c +@@ -39,6 +39,29 @@ + # define N_(msgid) msgid + #define _(msg) msg + ++extern int be; ++ ++static uint16_t write16(uint16_t x, int be) ++{ ++ if (be) ++ return htobe16(x); ++ return htole16(x); ++} ++ ++static uint32_t write32(uint32_t x, int be) ++{ ++ if (be) ++ return htobe32(x); ++ return htole32(x); ++} ++ ++static uint64_t write64(uint64_t x, int be) ++{ ++ if (be) ++ return htobe64(x); ++ return htole64(x); ++} ++ + struct cache_entry + { + char *lib; /* Library name. */ +@@ -279,7 +302,12 @@ save_cache (const char *cache_name) + /* Number of normal cache entries. */ + int cache_entry_old_count = 0; + +- for (entry = entries; entry != NULL; entry = entry->next) ++ if (be) ++ printf("saving cache in big endian encoding\n"); ++ else ++ printf("saving cache in little endian encoding\n"); ++ ++ for (entry = entries; entry != NULL; entry = entry->next) + { + /* Account the final NULs. */ + total_strlen += strlen (entry->lib) + strlen (entry->path) + 2; +@@ -310,7 +338,7 @@ save_cache (const char *cache_name) + memset (file_entries, '\0', sizeof (struct cache_file)); + memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1); + +- file_entries->nlibs = cache_entry_old_count; ++ file_entries->nlibs = write32(cache_entry_old_count, be); + } + + struct cache_file_new *file_entries_new = NULL; +@@ -330,8 +358,8 @@ save_cache (const char *cache_name) + memcpy (file_entries_new->version, CACHE_VERSION, + sizeof CACHE_VERSION - 1); + +- file_entries_new->nlibs = cache_entry_count; +- file_entries_new->len_strings = total_strlen; ++ file_entries_new->nlibs = write32(cache_entry_count, be); ++ file_entries_new->len_strings = write32(total_strlen, be); + } + + /* Pad for alignment of cache_file_new. */ +@@ -358,9 +386,9 @@ save_cache (const char *cache_name) + /* First the library. */ + if (opt_format != 2 && entry->hwcap == 0) + { +- file_entries->libs[idx_old].flags = entry->flags; ++ file_entries->libs[idx_old].flags = write32(entry->flags, be); + /* XXX: Actually we can optimize here and remove duplicates. */ +- file_entries->libs[idx_old].key = str_offset + pad; ++ file_entries->libs[idx_old].key = write32(str_offset + pad, be); + } + if (opt_format != 0) + { +@@ -368,10 +396,10 @@ save_cache (const char *cache_name) + not doing so makes the code easier, the string table + always begins at the beginning of the the new cache + struct. */ +- file_entries_new->libs[idx_new].flags = entry->flags; +- file_entries_new->libs[idx_new].osversion = entry->osversion; +- file_entries_new->libs[idx_new].hwcap = entry->hwcap; +- file_entries_new->libs[idx_new].key = str_offset; ++ file_entries_new->libs[idx_new].flags = write32(entry->flags, be); ++ file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be); ++ file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be); ++ file_entries_new->libs[idx_new].key = write32(str_offset, be); + } + + size_t len = strlen (entry->lib) + 1; +@@ -379,9 +407,9 @@ save_cache (const char *cache_name) + str_offset += len; + /* Then the path. */ + if (opt_format != 2 && entry->hwcap == 0) +- file_entries->libs[idx_old].value = str_offset + pad; ++ file_entries->libs[idx_old].value = write32(str_offset + pad, be); + if (opt_format != 0) +- file_entries_new->libs[idx_new].value = str_offset; ++ file_entries_new->libs[idx_new].value = write32(str_offset, be); + len = strlen (entry->path) + 1; + str = mempcpy (str, entry->path, len); + str_offset += len; diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch new file mode 100644 index 0000000000..b148553055 --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch @@ -0,0 +1,22 @@ +The native version of ldconfig was using native definition of LD_SO (i.e. +ld-linux-x86-64.so.2 ) which is not correct for doing the cross ldconfig. +This was causing libc.so on the target marked as ELF lib rather than +FLAG_ELF_LIBC6 in the ld.so.cache. + +Nitin A Kamble 2011/04/4 + +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -51,6 +51,10 @@ struct known_names + int flag; + }; + ++/* don't use host's definition of LD_SO */ ++#undef LD_SO ++#define LD_SO "ld.so.1" ++ + static struct known_names interpreters[] = + { + { "/lib/" LD_SO, FLAG_ELF_LIBC6 }, diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 new file mode 100644 index 0000000000..dc1e79888e Binary files /dev/null and b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 differ diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch new file mode 100644 index 0000000000..52ab64c0d6 --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch @@ -0,0 +1,467 @@ +--- + cache.c | 11 +- + chroot_canon.c | 7 + + dl-cache.c | 235 --------------------------------------------------------- + dl-cache.h | 3 + ldconfig.c | 27 ++++-- + readlib.c | 7 + + xstrdup.c | 11 -- + 7 files changed, 45 insertions(+), 256 deletions(-) + +Index: ldconfig-native-2.12.1/cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/cache.c ++++ ldconfig-native-2.12.1/cache.c +@@ -16,6 +16,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -31,8 +34,10 @@ + #include + #include + +-#include +-#include ++#include "ldconfig.h" ++#include "dl-cache.h" ++# define N_(msgid) msgid ++#define _(msg) msg + + struct cache_entry + { +Index: ldconfig-native-2.12.1/chroot_canon.c +=================================================================== +--- ldconfig-native-2.12.1.orig/chroot_canon.c ++++ ldconfig-native-2.12.1/chroot_canon.c +@@ -17,6 +17,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -27,7 +30,9 @@ + #include + #include + +-#include ++#include "ldconfig.h" ++ ++#define __set_errno(Val) errno = (Val) + + #ifndef PATH_MAX + #define PATH_MAX 1024 +Index: ldconfig-native-2.12.1/dl-cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/dl-cache.c ++++ ldconfig-native-2.12.1/dl-cache.c +@@ -20,12 +20,12 @@ + + #include + #include +-#include ++//#include "ldsodefs.h" + #include + #include + #include + +-#include ++//#include "_itoa.h" + + #ifndef _DL_PLATFORMS_COUNT + # define _DL_PLATFORMS_COUNT 0 +@@ -39,103 +39,7 @@ static size_t cachesize; + /* 1 if cache_data + PTR points into the cache. */ + #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) + +-#define SEARCH_CACHE(cache) \ +-/* We use binary search since the table is sorted in the cache file. \ +- The first matching entry in the table is returned. \ +- It is important to use the same algorithm as used while generating \ +- the cache file. */ \ +-do \ +- { \ +- left = 0; \ +- right = cache->nlibs - 1; \ +- \ +- while (left <= right) \ +- { \ +- __typeof__ (cache->libs[0].key) key; \ +- \ +- middle = (left + right) / 2; \ +- \ +- key = cache->libs[middle].key; \ +- \ +- /* Make sure string table indices are not bogus before using \ +- them. */ \ +- if (! _dl_cache_verify_ptr (key)) \ +- { \ +- cmpres = 1; \ +- break; \ +- } \ +- \ +- /* Actually compare the entry with the key. */ \ +- cmpres = _dl_cache_libcmp (name, cache_data + key); \ +- if (__builtin_expect (cmpres == 0, 0)) \ +- { \ +- /* Found it. LEFT now marks the last entry for which we \ +- know the name is correct. */ \ +- left = middle; \ +- \ +- /* There might be entries with this name before the one we \ +- found. So we have to find the beginning. */ \ +- while (middle > 0) \ +- { \ +- __typeof__ (cache->libs[0].key) key; \ +- \ +- key = cache->libs[middle - 1].key; \ +- /* Make sure string table indices are not bogus before \ +- using them. */ \ +- if (! _dl_cache_verify_ptr (key) \ +- /* Actually compare the entry. */ \ +- || _dl_cache_libcmp (name, cache_data + key) != 0) \ +- break; \ +- --middle; \ +- } \ +- \ +- do \ +- { \ +- int flags; \ +- __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \ +- \ +- /* Only perform the name test if necessary. */ \ +- if (middle > left \ +- /* We haven't seen this string so far. Test whether the \ +- index is ok and whether the name matches. Otherwise \ +- we are done. */ \ +- && (! _dl_cache_verify_ptr (lib->key) \ +- || (_dl_cache_libcmp (name, cache_data + lib->key) \ +- != 0))) \ +- break; \ +- \ +- flags = lib->flags; \ +- if (_dl_cache_check_flags (flags) \ +- && _dl_cache_verify_ptr (lib->value)) \ +- { \ +- if (best == NULL || flags == GLRO(dl_correct_cache_id)) \ +- { \ +- HWCAP_CHECK; \ +- best = cache_data + lib->value; \ +- \ +- if (flags == GLRO(dl_correct_cache_id)) \ +- /* We've found an exact match for the shared \ +- object and no general `ELF' release. Stop \ +- searching. */ \ +- break; \ +- } \ +- } \ +- } \ +- while (++middle <= right); \ +- break; \ +- } \ +- \ +- if (cmpres < 0) \ +- left = middle + 1; \ +- else \ +- right = middle - 1; \ +- } \ +- } \ +-while (0) +- +- + int +-internal_function + _dl_cache_libcmp (const char *p1, const char *p2) + { + while (*p1 != '\0') +@@ -172,139 +76,3 @@ _dl_cache_libcmp (const char *p1, const + } + return *p1 - *p2; + } +- +- +-/* Look up NAME in ld.so.cache and return the file name stored there, +- or null if none is found. */ +- +-const char * +-internal_function +-_dl_load_cache_lookup (const char *name) +-{ +- int left, right, middle; +- int cmpres; +- const char *cache_data; +- uint32_t cache_data_size; +- const char *best; +- +- /* Print a message if the loading of libs is traced. */ +- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) +- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); +- +- if (cache == NULL) +- { +- /* Read the contents of the file. */ +- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, +- PROT_READ); +- +- /* We can handle three different cache file formats here: +- - the old libc5/glibc2.0/2.1 format +- - the old format with the new format in it +- - only the new format +- The following checks if the cache contains any of these formats. */ +- if (file != MAP_FAILED && cachesize > sizeof *cache +- && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0) +- { +- size_t offset; +- /* Looks ok. */ +- cache = file; +- +- /* Check for new version. */ +- offset = ALIGN_CACHE (sizeof (struct cache_file) +- + cache->nlibs * sizeof (struct file_entry)); +- +- cache_new = (struct cache_file_new *) ((void *) cache + offset); +- if (cachesize < (offset + sizeof (struct cache_file_new)) +- || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW, +- sizeof CACHEMAGIC_VERSION_NEW - 1) != 0) +- cache_new = (void *) -1; +- } +- else if (file != MAP_FAILED && cachesize > sizeof *cache_new +- && memcmp (file, CACHEMAGIC_VERSION_NEW, +- sizeof CACHEMAGIC_VERSION_NEW - 1) == 0) +- { +- cache_new = file; +- cache = file; +- } +- else +- { +- if (file != MAP_FAILED) +- __munmap (file, cachesize); +- cache = (void *) -1; +- } +- +- assert (cache != NULL); +- } +- +- if (cache == (void *) -1) +- /* Previously looked for the cache file and didn't find it. */ +- return NULL; +- +- best = NULL; +- +- if (cache_new != (void *) -1) +- { +- uint64_t platform; +- +- /* This is where the strings start. */ +- cache_data = (const char *) cache_new; +- +- /* Now we can compute how large the string table is. */ +- cache_data_size = (const char *) cache + cachesize - cache_data; +- +- platform = _dl_string_platform (GLRO(dl_platform)); +- if (platform != (uint64_t) -1) +- platform = 1ULL << platform; +- +-#define _DL_HWCAP_TLS_MASK (1LL << 63) +- uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask)) +- | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK); +- +- /* Only accept hwcap if it's for the right platform. */ +-#define HWCAP_CHECK \ +- if (lib->hwcap & hwcap_exclude) \ +- continue; \ +- if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \ +- continue; \ +- if (_DL_PLATFORMS_COUNT \ +- && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ +- && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ +- continue +- SEARCH_CACHE (cache_new); +- } +- else +- { +- /* This is where the strings start. */ +- cache_data = (const char *) &cache->libs[cache->nlibs]; +- +- /* Now we can compute how large the string table is. */ +- cache_data_size = (const char *) cache + cachesize - cache_data; +- +-#undef HWCAP_CHECK +-#define HWCAP_CHECK do {} while (0) +- SEARCH_CACHE (cache); +- } +- +- /* Print our result if wanted. */ +- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0) +- && best != NULL) +- _dl_debug_printf (" trying file=%s\n", best); +- +- return best; +-} +- +-#ifndef MAP_COPY +-/* If the system does not support MAP_COPY we cannot leave the file open +- all the time since this would create problems when the file is replaced. +- Therefore we provide this function to close the file and open it again +- once needed. */ +-void +-_dl_unload_cache (void) +-{ +- if (cache != NULL && cache != (struct cache_file *) -1) +- { +- __munmap (cache, cachesize); +- cache = NULL; +- } +-} +-#endif +Index: ldconfig-native-2.12.1/dl-cache.h +=================================================================== +--- ldconfig-native-2.12.1.orig/dl-cache.h ++++ ldconfig-native-2.12.1/dl-cache.h +@@ -101,5 +101,4 @@ struct cache_file_new + (((addr) + __alignof__ (struct cache_file_new) -1) \ + & (~(__alignof__ (struct cache_file_new) - 1))) + +-extern int _dl_cache_libcmp (const char *p1, const char *p2) +- internal_function; ++extern int _dl_cache_libcmp (const char *p1, const char *p2); +Index: ldconfig-native-2.12.1/ldconfig.c +=================================================================== +--- ldconfig-native-2.12.1.orig/ldconfig.c ++++ ldconfig-native-2.12.1/ldconfig.c +@@ -16,6 +16,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #define PROCINFO_CLASS static + #include + #include +@@ -39,10 +42,20 @@ + #include + #include + +-#include +-#include ++#include "ldconfig.h" ++#include "dl-cache.h" ++ ++#include "dl-procinfo.h" ++ ++#include "argp.h" ++ ++ ++#define SYSCONFDIR "/etc" ++#define LIBDIR "/usr/lib" ++#define SLIBDIR "/lib" ++# define N_(msgid) msgid ++#define _(msg) msg + +-#include + + #ifdef _DL_FIRST_PLATFORM + # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) +@@ -55,7 +68,7 @@ + #endif + + /* Get libc version number. */ +-#include ++#include "version.h" + + #define PACKAGE _libc_intl_domainname + +@@ -152,8 +165,8 @@ static const struct argp_option options[ + { NULL, 0, NULL, 0, NULL, 0 } + }; + +-#define PROCINFO_CLASS static +-#include ++//#define PROCINFO_CLASS static ++//#include + + /* Short description of program. */ + static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings."); +@@ -291,6 +304,7 @@ parse_opt (int key, char *arg, struct ar + return 0; + } + ++#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org" + /* Print bug-reporting information in the help message. */ + static char * + more_help (int key, const char *text, void *input) +@@ -315,7 +329,7 @@ For bug reporting instructions, please s + static void + print_version (FILE *stream, struct argp_state *state) + { +- fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION); ++ fprintf (stream, "ldconfig (Hacked Poky Version)\n"); + fprintf (stream, gettext ("\ + Copyright (C) %s Free Software Foundation, Inc.\n\ + This is free software; see the source for copying conditions. There is NO\n\ +@@ -1233,6 +1247,7 @@ set_hwcap (void) + hwcap_mask = strtoul (mask, NULL, 0); + } + ++const char _libc_intl_domainname[] = "libc"; + + int + main (int argc, char **argv) +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -22,6 +22,9 @@ + development version. Besides the simplification, it has also been + modified to read some other file formats. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -35,7 +38,9 @@ + #include + #include + +-#include ++#include "ldconfig.h" ++ ++#define _(msg) msg + + #define Elf32_CLASS ELFCLASS32 + #define Elf64_CLASS ELFCLASS64 +Index: ldconfig-native-2.12.1/xstrdup.c +=================================================================== +--- ldconfig-native-2.12.1.orig/xstrdup.c ++++ ldconfig-native-2.12.1/xstrdup.c +@@ -16,15 +16,10 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#define _GNU_SOURCE ++ ++#include + +-#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC +-# include +-#else +-# include +-#endif + void *xmalloc (size_t n) __THROW; + char *xstrdup (char *string) __THROW; + diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch new file mode 100644 index 0000000000..0312ca8833 --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch @@ -0,0 +1,34 @@ +Coming from this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11149 + +Nitin A Kamble 2011/03/29 + +--- ldconfig-native-2.12.1.orig/ldconfig.c ++++ ldconfig-native-2.12.1/ldconfig.c +@@ -1359,14 +1359,9 @@ main (int argc, char **argv) + + const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; + if (opt_chroot) +- { +- aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); +- if (aux_cache_file == NULL) +- error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), +- _PATH_LDCONFIG_AUX_CACHE); +- } ++ aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); + +- if (! opt_ignore_aux_cache) ++ if (! opt_ignore_aux_cache && aux_cache_file) + load_aux_cache (aux_cache_file); + else + init_aux_cache (); +@@ -1376,7 +1371,8 @@ main (int argc, char **argv) + if (opt_build_cache) + { + save_cache (cache_file); +- save_aux_cache (aux_cache_file); ++ if (aux_cache_file) ++ save_aux_cache (aux_cache_file); + } + + return 0; + diff --git a/meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb new file mode 100644 index 0000000000..bacf9f8dc4 --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb @@ -0,0 +1,27 @@ +DESCRIPTION = "A standalone native ldconfig build" + +LICENSE = "GPLv2.1" + +LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399" + +SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \ + file://ldconfig.patch \ + file://ldconfig_aux-cache_path_fix.patch \ + file://32and64bit.patch \ + file://endian-ness_handling.patch \ + file://flag_fix.patch " + +PR = "r0" + +inherit native + +S = "${WORKDIR}/${PN}-${PV}" + +do_compile () { + $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig +} + +do_install () { + install -d ${D}/${bindir}/ + install ldconfig ${D}/${bindir}/ +} diff --git a/meta/recipes-core/glibc/ldconfig-native-2.5/32and64bit.patch b/meta/recipes-core/glibc/ldconfig-native-2.5/32and64bit.patch deleted file mode 100644 index 4f8d3a39ca..0000000000 --- a/meta/recipes-core/glibc/ldconfig-native-2.5/32and64bit.patch +++ /dev/null @@ -1,289 +0,0 @@ -Index: ldconfig-native-2.5/readelflib.c -=================================================================== ---- ldconfig-native-2.5.orig/readelflib.c 2009-05-19 09:40:17.000000000 +0100 -+++ ldconfig-native-2.5/readelflib.c 2009-05-19 09:56:18.000000000 +0100 -@@ -40,38 +40,190 @@ - - /* Returns 0 if everything is ok, != 0 in case of error. */ - int --process_elf_file (const char *file_name, const char *lib, int *flag, -+process_elf_file32 (const char *file_name, const char *lib, int *flag, - unsigned int *osversion, char **soname, void *file_contents, - size_t file_length) - { - int i; - unsigned int j; -- ElfW(Addr) loadaddr; -+ Elf32_Addr loadaddr; - unsigned int dynamic_addr; - size_t dynamic_size; - char *program_interpreter; - -- ElfW(Ehdr) *elf_header; -- ElfW(Phdr) *elf_pheader, *segment; -- ElfW(Dyn) *dynamic_segment, *dyn_entry; -+ Elf32_Ehdr *elf_header; -+ Elf32_Phdr *elf_pheader, *segment; -+ Elf32_Dyn *dynamic_segment, *dyn_entry; - char *dynamic_strings; - -- elf_header = (ElfW(Ehdr) *) file_contents; -+ elf_header = (Elf32_Ehdr *) file_contents; - *osversion = 0; - -- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS)) -+ if (elf_header->e_type != ET_DYN) -+ { -+ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, -+ elf_header->e_type); -+ return 1; -+ } -+ -+ /* Get information from elf program header. */ -+ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); -+ check_ptr (elf_pheader); -+ -+ /* The library is an elf library, now search for soname and -+ libc5/libc6. */ -+ *flag = FLAG_ELF; -+ -+ loadaddr = -1; -+ dynamic_addr = 0; -+ dynamic_size = 0; -+ program_interpreter = NULL; -+ for (i = 0, segment = elf_pheader; -+ i < elf_header->e_phnum; i++, segment++) - { -- if (opt_verbose) -+ check_ptr (segment); -+ -+ switch (segment->p_type) - { -- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) -- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name); -- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) -- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name); -- else -- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); -+ case PT_LOAD: -+ if (loadaddr == (Elf32_Addr) -1) -+ loadaddr = segment->p_vaddr - segment->p_offset; -+ break; -+ -+ case PT_DYNAMIC: -+ if (dynamic_addr) -+ error (0, 0, _("more than one dynamic segment\n")); -+ -+ dynamic_addr = segment->p_offset; -+ dynamic_size = segment->p_filesz; -+ break; -+ -+ case PT_INTERP: -+ program_interpreter = (char *) (file_contents + segment->p_offset); -+ check_ptr (program_interpreter); -+ -+ /* Check if this is enough to classify the binary. */ -+ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]); -+ ++j) -+ if (strcmp (program_interpreter, interpreters[j].soname) == 0) -+ { -+ *flag = interpreters[j].flag; -+ break; -+ } -+ break; -+ -+ case PT_NOTE: -+ if (!*osversion && segment->p_filesz == 32 && segment->p_align >= 4) -+ { -+ Elf32_Word *abi_note = (Elf32_Word *) (file_contents -+ + segment->p_offset); -+ if (abi_note [0] == 4 && abi_note [1] == 16 && abi_note [2] == 1 -+ && memcmp (abi_note + 3, "GNU", 4) == 0) -+ *osversion = (abi_note [4] << 24) | -+ ((abi_note [5] & 0xff) << 16) | -+ ((abi_note [6] & 0xff) << 8) | -+ (abi_note [7] & 0xff); -+ } -+ break; -+ -+ default: -+ break; - } -- return 1; -+ - } -+ if (loadaddr == (Elf32_Addr) -1) -+ { -+ /* Very strange. */ -+ loadaddr = 0; -+ } -+ -+ /* Now we can read the dynamic sections. */ -+ if (dynamic_size == 0) -+ return 1; -+ -+ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr); -+ check_ptr (dynamic_segment); -+ -+ /* Find the string table. */ -+ dynamic_strings = NULL; -+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; -+ ++dyn_entry) -+ { -+ check_ptr (dyn_entry); -+ if (dyn_entry->d_tag == DT_STRTAB) -+ { -+ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); -+ check_ptr (dynamic_strings); -+ break; -+ } -+ } -+ -+ if (dynamic_strings == NULL) -+ return 1; -+ -+ /* Now read the DT_NEEDED and DT_SONAME entries. */ -+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; -+ ++dyn_entry) -+ { -+ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) -+ { -+ char *name = dynamic_strings + dyn_entry->d_un.d_val; -+ check_ptr (name); -+ -+ if (dyn_entry->d_tag == DT_NEEDED) -+ { -+ -+ if (*flag == FLAG_ELF) -+ { -+ /* Check if this is enough to classify the binary. */ -+ for (j = 0; -+ j < sizeof (known_libs) / sizeof (known_libs [0]); -+ ++j) -+ if (strcmp (name, known_libs [j].soname) == 0) -+ { -+ *flag = known_libs [j].flag; -+ break; -+ } -+ } -+ } -+ -+ else if (dyn_entry->d_tag == DT_SONAME) -+ *soname = xstrdup (name); -+ -+ /* Do we have everything we need? */ -+ if (*soname && *flag != FLAG_ELF) -+ return 0; -+ } -+ } -+ -+ /* We reach this point only if the file doesn't contain a DT_SONAME -+ or if we can't classify the library. If it doesn't have a -+ soname, return the name of the library. */ -+ if (*soname == NULL) -+ *soname = xstrdup (lib); -+ -+ return 0; -+} -+ -+int -+process_elf_file64 (const char *file_name, const char *lib, int *flag, -+ unsigned int *osversion, char **soname, void *file_contents, -+ size_t file_length) -+{ -+ int i; -+ unsigned int j; -+ Elf64_Addr loadaddr; -+ unsigned int dynamic_addr; -+ size_t dynamic_size; -+ char *program_interpreter; -+ -+ Elf64_Ehdr *elf_header; -+ Elf64_Phdr *elf_pheader, *segment; -+ Elf64_Dyn *dynamic_segment, *dyn_entry; -+ char *dynamic_strings; -+ -+ elf_header = (Elf64_Ehdr *) file_contents; -+ *osversion = 0; - - if (elf_header->e_type != ET_DYN) - { -@@ -81,7 +233,7 @@ - } - - /* Get information from elf program header. */ -- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); -+ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); - check_ptr (elf_pheader); - - /* The library is an elf library, now search for soname and -@@ -100,7 +252,7 @@ - switch (segment->p_type) - { - case PT_LOAD: -- if (loadaddr == (ElfW(Addr)) -1) -+ if (loadaddr == (Elf64_Addr) -1) - loadaddr = segment->p_vaddr - segment->p_offset; - break; - -@@ -129,7 +281,7 @@ - case PT_NOTE: - if (!*osversion && segment->p_filesz == 32 && segment->p_align >= 4) - { -- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents -+ Elf64_Word *abi_note = (Elf64_Word *) (file_contents - + segment->p_offset); - if (abi_note [0] == 4 && abi_note [1] == 16 && abi_note [2] == 1 - && memcmp (abi_note + 3, "GNU", 4) == 0) -@@ -145,7 +297,7 @@ - } - - } -- if (loadaddr == (ElfW(Addr)) -1) -+ if (loadaddr == (Elf64_Addr) -1) - { - /* Very strange. */ - loadaddr = 0; -@@ -155,7 +307,7 @@ - if (dynamic_size == 0) - return 1; - -- dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr); -+ dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr); - check_ptr (dynamic_segment); - - /* Find the string table. */ -@@ -218,3 +370,33 @@ - - return 0; - } -+/* Returns 0 if everything is ok, != 0 in case of error. */ -+int -+process_elf_file (const char *file_name, const char *lib, int *flag, -+ unsigned int *osversion, char **soname, void *file_contents, -+ size_t file_length) -+{ -+ int i; -+ unsigned int j; -+ ElfW(Addr) loadaddr; -+ unsigned int dynamic_addr; -+ size_t dynamic_size; -+ char *program_interpreter; -+ -+ ElfW(Ehdr) *elf_header; -+ ElfW(Phdr) *elf_pheader, *segment; -+ ElfW(Dyn) *dynamic_segment, *dyn_entry; -+ char *dynamic_strings; -+ -+ elf_header = (ElfW(Ehdr) *) file_contents; -+ *osversion = 0; -+ -+ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) -+ return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length); -+ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) -+ return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length); -+ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); -+ return 1; -+} -+ -+ diff --git a/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig-native-2.5.tar.bz2 b/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig-native-2.5.tar.bz2 deleted file mode 100644 index 693b35ced2..0000000000 Binary files a/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig-native-2.5.tar.bz2 and /dev/null differ diff --git a/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig.patch b/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig.patch deleted file mode 100644 index d143a075f5..0000000000 --- a/meta/recipes-core/glibc/ldconfig-native-2.5/ldconfig.patch +++ /dev/null @@ -1,460 +0,0 @@ ---- - cache.c | 11 +- - chroot_canon.c | 7 + - dl-cache.c | 235 --------------------------------------------------------- - dl-cache.h | 3 - ldconfig.c | 27 ++++-- - readlib.c | 7 + - xstrdup.c | 11 -- - 7 files changed, 45 insertions(+), 256 deletions(-) - -Index: 1/cache.c -=================================================================== ---- 1.orig/cache.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/cache.c 2007-11-23 17:05:56.000000000 +0000 -@@ -15,6 +15,9 @@ - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -+#define _LARGEFILE64_SOURCE -+#define _GNU_SOURCE -+ - #include - #include - #include -@@ -29,8 +32,10 @@ - #include - #include - --#include --#include -+#include "ldconfig.h" -+#include "dl-cache.h" -+# define N_(msgid) msgid -+#define _(msg) msg - - struct cache_entry - { -@@ -230,8 +235,6 @@ init_cache (void) - entries = NULL; - } - -- -- - static - int compare (const struct cache_entry *e1, const struct cache_entry *e2) - { -Index: 1/chroot_canon.c -=================================================================== ---- 1.orig/chroot_canon.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/chroot_canon.c 2007-11-23 17:05:56.000000000 +0000 -@@ -16,6 +16,9 @@ - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -+#define _LARGEFILE64_SOURCE -+#define _GNU_SOURCE -+ - #include - #include - #include -@@ -26,7 +29,9 @@ - #include - #include - --#include -+#include "ldconfig.h" -+ -+#define __set_errno(Val) errno = (Val) - - #ifndef PATH_MAX - #define PATH_MAX 1024 -Index: 1/dl-cache.c -=================================================================== ---- 1.orig/dl-cache.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/dl-cache.c 2007-11-23 17:05:56.000000000 +0000 -@@ -19,12 +19,12 @@ - - #include - #include --#include -+//#include "ldsodefs.h" - #include - #include - #include - --#include -+//#include "_itoa.h" - - #ifndef _DL_PLATFORMS_COUNT - # define _DL_PLATFORMS_COUNT 0 -@@ -38,103 +38,7 @@ static size_t cachesize; - /* 1 if cache_data + PTR points into the cache. */ - #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) - --#define SEARCH_CACHE(cache) \ --/* We use binary search since the table is sorted in the cache file. \ -- The first matching entry in the table is returned. \ -- It is important to use the same algorithm as used while generating \ -- the cache file. */ \ --do \ -- { \ -- left = 0; \ -- right = cache->nlibs - 1; \ -- \ -- while (left <= right) \ -- { \ -- __typeof__ (cache->libs[0].key) key; \ -- \ -- middle = (left + right) / 2; \ -- \ -- key = cache->libs[middle].key; \ -- \ -- /* Make sure string table indices are not bogus before using \ -- them. */ \ -- if (! _dl_cache_verify_ptr (key)) \ -- { \ -- cmpres = 1; \ -- break; \ -- } \ -- \ -- /* Actually compare the entry with the key. */ \ -- cmpres = _dl_cache_libcmp (name, cache_data + key); \ -- if (__builtin_expect (cmpres == 0, 0)) \ -- { \ -- /* Found it. LEFT now marks the last entry for which we \ -- know the name is correct. */ \ -- left = middle; \ -- \ -- /* There might be entries with this name before the one we \ -- found. So we have to find the beginning. */ \ -- while (middle > 0) \ -- { \ -- __typeof__ (cache->libs[0].key) key; \ -- \ -- key = cache->libs[middle - 1].key; \ -- /* Make sure string table indices are not bogus before \ -- using them. */ \ -- if (! _dl_cache_verify_ptr (key) \ -- /* Actually compare the entry. */ \ -- || _dl_cache_libcmp (name, cache_data + key) != 0) \ -- break; \ -- --middle; \ -- } \ -- \ -- do \ -- { \ -- int flags; \ -- __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \ -- \ -- /* Only perform the name test if necessary. */ \ -- if (middle > left \ -- /* We haven't seen this string so far. Test whether the \ -- index is ok and whether the name matches. Otherwise \ -- we are done. */ \ -- && (! _dl_cache_verify_ptr (lib->key) \ -- || (_dl_cache_libcmp (name, cache_data + lib->key) \ -- != 0))) \ -- break; \ -- \ -- flags = lib->flags; \ -- if (_dl_cache_check_flags (flags) \ -- && _dl_cache_verify_ptr (lib->value)) \ -- { \ -- if (best == NULL || flags == GLRO(dl_correct_cache_id)) \ -- { \ -- HWCAP_CHECK; \ -- best = cache_data + lib->value; \ -- \ -- if (flags == GLRO(dl_correct_cache_id)) \ -- /* We've found an exact match for the shared \ -- object and no general `ELF' release. Stop \ -- searching. */ \ -- break; \ -- } \ -- } \ -- } \ -- while (++middle <= right); \ -- break; \ -- } \ -- \ -- if (cmpres < 0) \ -- left = middle + 1; \ -- else \ -- right = middle - 1; \ -- } \ -- } \ --while (0) -- -- - int --internal_function - _dl_cache_libcmp (const char *p1, const char *p2) - { - while (*p1 != '\0') -@@ -173,139 +77,4 @@ _dl_cache_libcmp (const char *p1, const - } - - --/* Look up NAME in ld.so.cache and return the file name stored there, -- or null if none is found. */ - --const char * --internal_function --_dl_load_cache_lookup (const char *name) --{ -- int left, right, middle; -- int cmpres; -- const char *cache_data; -- uint32_t cache_data_size; -- const char *best; -- -- /* Print a message if the loading of libs is traced. */ -- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)) -- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); -- -- if (cache == NULL) -- { -- /* Read the contents of the file. */ -- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, -- PROT_READ); -- -- /* We can handle three different cache file formats here: -- - the old libc5/glibc2.0/2.1 format -- - the old format with the new format in it -- - only the new format -- The following checks if the cache contains any of these formats. */ -- if (file != MAP_FAILED && cachesize > sizeof *cache -- && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0) -- { -- size_t offset; -- /* Looks ok. */ -- cache = file; -- -- /* Check for new version. */ -- offset = ALIGN_CACHE (sizeof (struct cache_file) -- + cache->nlibs * sizeof (struct file_entry)); -- -- cache_new = (struct cache_file_new *) ((void *) cache + offset); -- if (cachesize < (offset + sizeof (struct cache_file_new)) -- || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW, -- sizeof CACHEMAGIC_VERSION_NEW - 1) != 0) -- cache_new = (void *) -1; -- } -- else if (file != MAP_FAILED && cachesize > sizeof *cache_new -- && memcmp (file, CACHEMAGIC_VERSION_NEW, -- sizeof CACHEMAGIC_VERSION_NEW - 1) == 0) -- { -- cache_new = file; -- cache = file; -- } -- else -- { -- if (file != MAP_FAILED) -- __munmap (file, cachesize); -- cache = (void *) -1; -- } -- -- assert (cache != NULL); -- } -- -- if (cache == (void *) -1) -- /* Previously looked for the cache file and didn't find it. */ -- return NULL; -- -- best = NULL; -- -- if (cache_new != (void *) -1) -- { -- uint64_t platform; -- -- /* This is where the strings start. */ -- cache_data = (const char *) cache_new; -- -- /* Now we can compute how large the string table is. */ -- cache_data_size = (const char *) cache + cachesize - cache_data; -- -- platform = _dl_string_platform (GLRO(dl_platform)); -- if (platform != (uint64_t) -1) -- platform = 1ULL << platform; -- -- /* Only accept hwcap if it's for the right platform. */ --#ifdef USE_TLS --# define _DL_HWCAP_TLS_MASK (1LL << 63) --#else --# define _DL_HWCAP_TLS_MASK 0 --#endif --#define HWCAP_CHECK \ -- if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \ -- continue; \ -- if (_DL_PLATFORMS_COUNT \ -- && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ -- && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ -- continue; \ -- if (lib->hwcap \ -- & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK)) \ -- continue -- SEARCH_CACHE (cache_new); -- } -- else -- { -- /* This is where the strings start. */ -- cache_data = (const char *) &cache->libs[cache->nlibs]; -- -- /* Now we can compute how large the string table is. */ -- cache_data_size = (const char *) cache + cachesize - cache_data; -- --#undef HWCAP_CHECK --#define HWCAP_CHECK do {} while (0) -- SEARCH_CACHE (cache); -- } -- -- /* Print our result if wanted. */ -- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0) -- && best != NULL) -- _dl_debug_printf (" trying file=%s\n", best); -- -- return best; --} -- --#ifndef MAP_COPY --/* If the system does not support MAP_COPY we cannot leave the file open -- all the time since this would create problems when the file is replaced. -- Therefore we provide this function to close the file and open it again -- once needed. */ --void --_dl_unload_cache (void) --{ -- if (cache != NULL && cache != (struct cache_file *) -1) -- { -- __munmap (cache, cachesize); -- cache = NULL; -- } --} --#endif -Index: 1/dl-cache.h -=================================================================== ---- 1.orig/dl-cache.h 2007-11-23 17:05:44.000000000 +0000 -+++ 1/dl-cache.h 2007-11-23 17:05:56.000000000 +0000 -@@ -101,5 +101,4 @@ struct cache_file_new - (((addr) + __alignof__ (struct cache_file_new) -1) \ - & (~(__alignof__ (struct cache_file_new) - 1))) - --extern int _dl_cache_libcmp (const char *p1, const char *p2) -- internal_function; -+extern int _dl_cache_libcmp (const char *p1, const char *p2); -Index: 1/ldconfig.c -=================================================================== ---- 1.orig/ldconfig.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/ldconfig.c 2007-11-23 17:05:56.000000000 +0000 -@@ -15,6 +15,9 @@ - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -+#define _LARGEFILE64_SOURCE -+#define _GNU_SOURCE -+ - #define PROCINFO_CLASS static - #include - #include -@@ -37,10 +40,20 @@ - #include - #include - --#include --#include -+#include "ldconfig.h" -+#include "dl-cache.h" -+ -+#include "dl-procinfo.h" -+ -+#include "argp.h" -+ -+ -+#define SYSCONFDIR "/etc" -+#define LIBDIR "/usr/lib" -+#define SLIBDIR "/lib" -+# define N_(msgid) msgid -+#define _(msg) msg - --#include - - #ifdef _DL_FIRST_PLATFORM - # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) -@@ -53,7 +66,7 @@ - #endif - - /* Get libc version number. */ --#include -+#include "version.h" - - #define PACKAGE _libc_intl_domainname - -@@ -143,8 +156,8 @@ static const struct argp_option options[ - { NULL, 0, NULL, 0, NULL, 0 } - }; - --#define PROCINFO_CLASS static --#include -+//#define PROCINFO_CLASS static -+//#include - - /* Short description of program. */ - static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings."); -@@ -281,7 +294,7 @@ parse_opt (int key, char *arg, struct ar - static void - print_version (FILE *stream, struct argp_state *state) - { -- fprintf (stream, "ldconfig (GNU %s) %s\n", PACKAGE, VERSION); -+ fprintf (stream, "ldconfig (Hacked Poky Version)\n"); - fprintf (stream, gettext ("\ - Copyright (C) %s Free Software Foundation, Inc.\n\ - This is free software; see the source for copying conditions. There is NO\n\ -Index: 1/readlib.c -=================================================================== ---- 1.orig/readlib.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/readlib.c 2007-11-23 17:05:56.000000000 +0000 -@@ -21,6 +21,9 @@ - development version. Besides the simplification, it has also been - modified to read some other file formats. */ - -+#define _LARGEFILE64_SOURCE -+#define _GNU_SOURCE -+ - #include - #include - #include -@@ -34,7 +37,9 @@ - #include - #include - --#include -+#include "ldconfig.h" -+ -+#define _(msg) msg - - #define Elf32_CLASS ELFCLASS32 - #define Elf64_CLASS ELFCLASS64 -Index: 1/xstrdup.c -=================================================================== ---- 1.orig/xstrdup.c 2007-11-23 17:05:44.000000000 +0000 -+++ 1/xstrdup.c 2007-11-23 17:05:56.000000000 +0000 -@@ -15,15 +15,10 @@ - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - --#ifdef HAVE_CONFIG_H --# include --#endif -+#define _GNU_SOURCE -+ -+#include - --#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC --# include --#else --# include --#endif - void *xmalloc (size_t n) __THROW; - char *xstrdup (char *string) __THROW; - diff --git a/meta/recipes-core/glibc/ldconfig-native_2.5.bb b/meta/recipes-core/glibc/ldconfig-native_2.5.bb deleted file mode 100644 index 39c8ce35e5..0000000000 --- a/meta/recipes-core/glibc/ldconfig-native_2.5.bb +++ /dev/null @@ -1,24 +0,0 @@ -DESCRIPTION = "A standalone native ldconfig build" - -LICENSE = "GPLv2" - -LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=16;md5=8b3df71ec5b0feeeeab79025096aa92c" - -SRC_URI = "file://ldconfig-native-2.5.tar.bz2 \ - file://ldconfig.patch;patch=1 \ - file://32and64bit.patch;patch=1" - -PR = "r1" - -inherit native - -S = "${WORKDIR}/${PN}-${PV}" - -do_compile () { - $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig -} - -do_install () { - install -d ${D}/${bindir}/ - install ldconfig ${D}/${bindir}/ -} -- cgit v1.2.3