(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / unix / sysv / linux / mips / readelflib.c
blob73fd43f46fab0fc73c94f5face652b9b470606c9
1 /* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4 Based on work ../x86_64/readelflib.c,
5 contributed by Andreas Jaeger <aj@suse.de>, 1999 and
6 Jakub Jelinek <jakub@redhat.com>, 1999.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 02111-1307 USA. */
24 int process_elf32_file (const char *file_name, const char *lib, int *flag,
25 unsigned int *osversion, char **soname,
26 void *file_contents, size_t file_length);
27 int process_elf64_file (const char *file_name, const char *lib, int *flag,
28 unsigned int *osversion, char **soname,
29 void *file_contents, size_t file_length);
31 /* Returns 0 if everything is ok, != 0 in case of error. */
32 int
33 process_elf_file (const char *file_name, const char *lib, int *flag,
34 unsigned int *osversion, char **soname, void *file_contents,
35 size_t file_length)
37 ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
38 int ret;
40 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
42 ret = process_elf32_file (file_name, lib, flag, osversion, soname,
43 file_contents, file_length);
45 /* n32 libraries are always libc.so.6+. */
46 if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
47 *flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
49 else
51 ret = process_elf64_file (file_name, lib, flag, osversion, soname,
52 file_contents, file_length);
53 /* n64 libraries are always libc.so.6+. */
54 if (!ret)
55 *flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
58 return ret;
61 #undef __ELF_NATIVE_CLASS
62 #undef process_elf_file
63 #define process_elf_file process_elf32_file
64 #define __ELF_NATIVE_CLASS 32
65 #include "sysdeps/generic/readelflib.c"
67 #undef __ELF_NATIVE_CLASS
68 #undef process_elf_file
69 #define process_elf_file process_elf64_file
70 #define __ELF_NATIVE_CLASS 64
71 #include "sysdeps/generic/readelflib.c"