diff options
| author | Roland McGrath <[email protected]> | 2008-02-21 06:19:39 +0000 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2008-02-21 06:19:39 +0000 |
| commit | 059c83e5db89955913a39fe6705acca571c32c3f (patch) | |
| tree | 9eaf08fd255365d45be91bb3bf288194ffa423e5 /backends | |
| parent | 712d78eced9020ccfa1c27d32c2929cf16398293 (diff) | |
Finish elflint .gnu.attributes checking
Diffstat (limited to 'backends')
| -rw-r--r-- | backends/ChangeLog | 23 | ||||
| -rw-r--r-- | backends/Makefile.am | 6 | ||||
| -rw-r--r-- | backends/alpha_auxv.c | 46 | ||||
| -rw-r--r-- | backends/alpha_init.c | 3 | ||||
| -rw-r--r-- | backends/i386_corenote.c | 32 | ||||
| -rw-r--r-- | backends/ppc_attrs.c | 76 | ||||
| -rw-r--r-- | backends/ppc_corenote.c | 15 | ||||
| -rw-r--r-- | backends/ppc_init.c | 3 |
8 files changed, 195 insertions, 9 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 25155db3..681ba94c 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,26 @@ +2008-02-20 Roland McGrath <[email protected]> + + * ppc_attrs.c: New file. + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add it. + * ppc_init.c (ppc_init): Initialize check_object_attribute hook. + +2008-02-14 Roland McGrath <[email protected]> + + * alpha_auxv.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize auxv_info hook. + +2008-02-08 Roland McGrath <[email protected]> + + * ppc_corenote.c (spe_regs): New const variable. + (EXTRA_NOTES): Use it for NT_PPC_SPE. + +2008-01-02 Roland McGrath <[email protected]> + + * i386_corenote.c (tls_items): New const table. + (tls_info): New function, uses it. + (EXTRA_NOTES): Use it to handle NT_386_TLS. + 2008-01-08 Ulrich Drepper <[email protected]> * Makefile.am: Add x86-64 disassembler. diff --git a/backends/Makefile.am b/backends/Makefile.am index 79fccfdc..75eacde9 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -81,7 +81,7 @@ libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ - alpha_corenote.c + alpha_corenote.c alpha_auxv.c libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) @@ -95,12 +95,12 @@ libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ - ppc_corenote.c ppc_auxv.c + ppc_corenote.c ppc_auxv.c ppc_attrs.c libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) diff --git a/backends/alpha_auxv.c b/backends/alpha_auxv.c new file mode 100644 index 00000000..38a8bcdf --- /dev/null +++ b/backends/alpha_auxv.c @@ -0,0 +1,46 @@ +/* Alpha-specific auxv handling. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND alpha_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "bwx\0" "fix\0" "cix\0" "0x08\0" + "0x10\0" "0x20\0" "0x40\0" "0x80\0" + "max\0" "precise_trap\0" + "\0"; + return 1; +} diff --git a/backends/alpha_init.c b/backends/alpha_init.c index 794d412a..3c9e29d2 100644 --- a/backends/alpha_init.c +++ b/backends/alpha_init.c @@ -1,5 +1,5 @@ /* Initialization of Alpha specific backend library. - Copyright (C) 2002, 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2002. @@ -57,6 +57,7 @@ alpha_init (elf, machine, eh, ehlen) HOOK (eh, machine_section_flag_check); HOOK (eh, register_info); HOOK (eh, core_note); + HOOK (eh, auxv_info); eh->sysvhash_entrysize = sizeof (Elf64_Xword); return MODVERSION; diff --git a/backends/i386_corenote.c b/backends/i386_corenote.c index f6c4c1de..02d8ec38 100644 --- a/backends/i386_corenote.c +++ b/backends/i386_corenote.c @@ -1,5 +1,5 @@ /* i386 specific core note handling. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -101,6 +101,34 @@ static const Ebl_Register_Location prxfpreg_regs[] = }; #define EXTRA_NOTES \ - EXTRA_REGSET (NT_PRFPXREG, 512, prxfpreg_regs) + EXTRA_REGSET (NT_PRFPXREG, 512, prxfpreg_regs) \ + case NT_386_TLS: \ + return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); + +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ + +static const Ebl_Core_Item tls_items[] = + { + { .type = ELF_T_WORD, .offset = 0x0, .format = 'd', .name = "index" }, + { .type = ELF_T_WORD, .offset = 0x4, .format = 'x', .name = "base" }, + { .type = ELF_T_WORD, .offset = 0x8, .format = 'x', .name = "limit" }, + { .type = ELF_T_WORD, .offset = 0xc, .format = 'x', .name = "flags" }, + }; + +static int +tls_info (GElf_Word descsz, GElf_Word *regs_offset, + size_t *nregloc, const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **items) +{ + if (descsz % 16 != 0) + return 0; + + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + *nitems = sizeof tls_items / sizeof tls_items[0]; + *items = tls_items; + return 1; +} #include "linux-core-note.c" diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c new file mode 100644 index 00000000..733b8749 --- /dev/null +++ b/backends/ppc_attrs.c @@ -0,0 +1,76 @@ +/* Object attribute tags for PowerPC. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +bool +ppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) + Ebl *ebl __attribute__ ((unused)); + const char *vendor; + int tag; + uint64_t value; + const char **tag_name; + const char **value_name; +{ + if (!strcmp (vendor, "gnu")) + switch (tag) + { + case 4: + *tag_name = "GNU_Power_ABI_FP"; + static const char *fp_kinds[] = + { + "Hard or soft float", + "Hard float", + "Soft float", + }; + if (value < sizeof fp_kinds / sizeof fp_kinds[0]) + *value_name = fp_kinds[value]; + return true; + + case 8: + *tag_name = "GNU_Power_ABI_Vector"; + static const char *vector_kinds[] = + { + "Any", "Generic", "AltiVec", "SPE" + }; + if (value < sizeof vector_kinds / sizeof vector_kinds[0]) + *value_name = vector_kinds[value]; + return true; + } + + return false; +} + +__typeof (ppc_check_object_attribute) + ppc64_check_object_attribute + __attribute__ ((alias ("ppc_check_object_attribute"))); diff --git a/backends/ppc_corenote.c b/backends/ppc_corenote.c index daadbb48..59e619e1 100644 --- a/backends/ppc_corenote.c +++ b/backends/ppc_corenote.c @@ -1,5 +1,5 @@ /* PowerPC specific core note handling. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -81,8 +81,19 @@ static const Ebl_Register_Location altivec_regs[] = { .offset = 33 * 16, .regno = 356, .count = 1, .bits = 32, .pad = 12 } }; +static const Ebl_Register_Location spe_regs[] = + { + /* evr0-evr31 + { .offset = 0, .regno = ???, .count = 32, .bits = 32 }, + * acc * + { .offset = 32 * 4, .regno = ???, .count = 1, .bits = 64 }, */ + /* spefscr */ + { .offset = 34 * 4, .regno = 612, .count = 1, .bits = 32 } + }; + #define EXTRA_NOTES \ - EXTRA_REGSET (NT_PPC_VMX, 34 * 16, altivec_regs) + EXTRA_REGSET (NT_PPC_VMX, 34 * 16, altivec_regs) \ + EXTRA_REGSET (NT_PPC_SPE, 35 * 4, spe_regs) #if BITS == 32 # define ULONG uint32_t diff --git a/backends/ppc_init.c b/backends/ppc_init.c index 7edc8fad..2e587167 100644 --- a/backends/ppc_init.c +++ b/backends/ppc_init.c @@ -1,5 +1,5 @@ /* Initialization of PPC specific backend library. - Copyright (C) 2004, 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2004. @@ -59,6 +59,7 @@ ppc_init (elf, machine, eh, ehlen) HOOK (eh, register_info); HOOK (eh, core_note); HOOK (eh, auxv_info); + HOOK (eh, check_object_attribute); return MODVERSION; } |
