diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-03-16 15:03:37 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-03-16 15:20:45 -0700 |
commit | f1a77b01f4e3a80782171297120e77ab112ce85d (patch) | |
tree | 75a6f8db458cd46c36a05f48b45e932cd1a7e558 /sysdeps/unix/sysv/linux/i386/readelflib.c | |
parent | c0c83bc8b299b08c4c0c5129da9a28ba740f087a (diff) | |
download | glibc-f1a77b01f4e3a80782171297120e77ab112ce85d.tar.gz glibc-f1a77b01f4e3a80782171297120e77ab112ce85d.tar.xz glibc-f1a77b01f4e3a80782171297120e77ab112ce85d.zip |
Add x32 support to ldconfig
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/readelflib.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/readelflib.c | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c index bdd5e70bc8..fab830ef5b 100644 --- a/sysdeps/unix/sysv/linux/i386/readelflib.c +++ b/sysdeps/unix/sysv/linux/i386/readelflib.c @@ -32,40 +32,52 @@ process_elf_file (const char *file_name, const char *lib, int *flag, size_t file_length) { ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents; - int ret; + int ret, file_flag = 0; - if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) - return process_elf32_file (file_name, lib, flag, osversion, soname, - file_contents, file_length); - else + switch (elf_header->e_machine) { - switch (elf_header->e_machine) + case EM_X86_64: + if (elf_header->e_ident[EI_CLASS] == ELFCLASS64) + /* X86-64 64bit libraries are always libc.so.6+. */ + file_flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6; + else + /* X32 libraries are always libc.so.6+. */ + file_flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6; + break; +#ifndef SKIP_EM_IA_64 + case EM_IA_64: + if (elf_header->e_ident[EI_CLASS] == ELFCLASS64) { - case EM_IA_64: - case EM_X86_64: + /* IA64 64bit libraries are always libc.so.6+. */ + file_flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6; break; - default: - error (0, 0, _("%s is for unknown machine %d.\n"), - file_name, elf_header->e_machine); - return 1; } + goto failed; +#endif + case EM_386: + if (elf_header->e_ident[EI_CLASS] == ELFCLASS32) + break; + /* Fall through. */ + default: +#ifndef SKIP_EM_IA_64 +failed: +#endif + error (0, 0, _("%s is for unknown machine %d.\n"), + file_name, elf_header->e_machine); + return 1; + } - ret = process_elf64_file (file_name, lib, flag, osversion, soname, - file_contents, file_length); - /* IA64/X86-64 64bit libraries are always libc.so.6+. */ - if (!ret) - switch (elf_header->e_machine) - { - case EM_IA_64: - *flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6; - break; - case EM_X86_64: - *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6; - break; - } + if (elf_header->e_ident[EI_CLASS] == ELFCLASS32) + ret = process_elf32_file (file_name, lib, flag, osversion, soname, + file_contents, file_length); + else + ret = process_elf64_file (file_name, lib, flag, osversion, soname, + file_contents, file_length); - return ret; - } + if (!ret && file_flag) + *flag = file_flag; + + return ret; } #undef __ELF_NATIVE_CLASS |