From: Ulrich Drepper Date: Sun, 7 Aug 2005 08:12:22 +0000 (+0000) Subject: Add support for a few missing DT_ and R_* values. X-Git-Tag: elfutils-0.120~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b03b05785914250d53d31e966373617f6104bd9d;p=thirdparty%2Felfutils.git Add support for a few missing DT_ and R_* values. Import new elf.h. --- diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 8c4473fde..5553cc49e 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,15 @@ +2005-08-07 Ulrich Drepper + + * ppc_init.c: Add support for new DT_PPC_* and R_PPC_* values. + * ppc_symbol.c: Likewise. + * libebl_ppc.h: Likewise. + * ppc64_init.c: There is now also a dynamic_tag_check functions + * ppc64_symbol.c: Add dynamic_tag_check. + * libebl_ppc64.h: Add prototype. + * alpha_init.c: Add support for new DT_ALPHA_* value. + * alpha_symbol.c: Likewise. + * libebl_alpha.h: Likewise. + 2005-08-03 Ulrich Drepper * libebl_alpha.map: Remove unnecessary exports. diff --git a/libebl/alpha_init.c b/libebl/alpha_init.c index 17eff3734..327f3bd0d 100644 --- a/libebl/alpha_init.c +++ b/libebl/alpha_init.c @@ -34,6 +34,8 @@ alpha_init (elf, machine, eh, ehlen) eh->name = "Alpha"; eh->reloc_type_name = alpha_reloc_type_name; eh->reloc_type_check = alpha_reloc_type_check; + eh->dynamic_tag_name = alpha_dynamic_tag_name; + eh->dynamic_tag_check = alpha_dynamic_tag_check; eh->copy_reloc_p = alpha_copy_reloc_p; eh->destr = alpha_destr; diff --git a/libebl/alpha_symbol.c b/libebl/alpha_symbol.c index 49e7c72f6..3fcd18462 100644 --- a/libebl/alpha_symbol.c +++ b/libebl/alpha_symbol.c @@ -93,6 +93,29 @@ alpha_reloc_type_check (int type) && reloc_map_table[type] != NULL) ? true : false; } + +const char * +alpha_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_ALPHA_PLTRO: + return "ALPHA_PLTRO"; + default: + break; + } + return NULL; +} + + +bool +alpha_dynamic_tag_check (int64_t tag) +{ + return tag == DT_ALPHA_PLTRO; +} + + /* Check whether given relocation is a copy relocation. */ bool alpha_copy_reloc_p (int reloc) diff --git a/libebl/libebl_alpha.h b/libebl/libebl_alpha.h index 7990d9956..24a3500ed 100644 --- a/libebl/libebl_alpha.h +++ b/libebl/libebl_alpha.h @@ -31,6 +31,12 @@ extern const char *alpha_reloc_type_name (int type, char *buf, size_t len); /* Check relocation type. */ extern bool alpha_reloc_type_check (int type); +/* Name of dynamic tag. */ +extern const char *alpha_dynamic_tag_name (int64_t tag, char *buf, size_t len); + +/* Check dynamic tag. */ +extern bool alpha_dynamic_tag_check (int64_t tag); + /* Check whether given relocation is a copy relocation. */ extern bool alpha_copy_reloc_p (int reloc); diff --git a/libebl/libebl_ppc.h b/libebl/libebl_ppc.h index 1e646d4f5..e3c6d21cb 100644 --- a/libebl/libebl_ppc.h +++ b/libebl/libebl_ppc.h @@ -41,6 +41,12 @@ extern Elf_Type ppc_reloc_simple_type (Elf *elf, int type); extern bool ppc_core_note (const char *name, uint32_t type, uint32_t descsz, const char *desc); +/* Name of dynamic tag. */ +extern const char *ppc_dynamic_tag_name (int64_t tag, char *buf, size_t len); + +/* Check dynamic tag. */ +extern bool ppc_dynamic_tag_check (int64_t tag); + /* Check whether given relocation is a copy relocation. */ extern bool ppc_copy_reloc_p (int reloc); diff --git a/libebl/libebl_ppc64.h b/libebl/libebl_ppc64.h index e737c56a2..148e22495 100644 --- a/libebl/libebl_ppc64.h +++ b/libebl/libebl_ppc64.h @@ -44,6 +44,9 @@ extern bool ppc64_core_note (const char *name, uint32_t type, uint32_t descsz, /* Name of dynamic tag. */ extern const char *ppc64_dynamic_tag_name (int64_t tag, char *buf, size_t len); +/* Check dynamic tag. */ +extern bool ppc64_dynamic_tag_check (int64_t tag); + /* Check whether given relocation is a copy relocation. */ extern bool ppc64_copy_reloc_p (int reloc); diff --git a/libebl/ppc64_init.c b/libebl/ppc64_init.c index 8231a32dc..347444c03 100644 --- a/libebl/ppc64_init.c +++ b/libebl/ppc64_init.c @@ -37,6 +37,7 @@ ppc64_init (elf, machine, eh, ehlen) eh->reloc_valid_use = ppc64_reloc_valid_use; eh->reloc_simple_type = ppc64_reloc_simple_type; eh->dynamic_tag_name = ppc64_dynamic_tag_name; + eh->dynamic_tag_check = ppc64_dynamic_tag_check; eh->copy_reloc_p = ppc64_copy_reloc_p; eh->destr = ppc64_destr; diff --git a/libebl/ppc64_symbol.c b/libebl/ppc64_symbol.c index f844816b2..457e84e67 100644 --- a/libebl/ppc64_symbol.c +++ b/libebl/ppc64_symbol.c @@ -227,6 +227,15 @@ ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), return NULL; } +bool +ppc64_dynamic_tag_check (int64_t tag) +{ + return (tag == DT_PPC64_GLINK + || tag == DT_PPC64_OPD + || tag == DT_PPC64_OPDSZ); +} + + /* Check whether given relocation is a copy relocation. */ bool ppc64_copy_reloc_p (int reloc) diff --git a/libebl/ppc_init.c b/libebl/ppc_init.c index 4d72c46d4..dca780b58 100644 --- a/libebl/ppc_init.c +++ b/libebl/ppc_init.c @@ -36,6 +36,8 @@ ppc_init (elf, machine, eh, ehlen) eh->reloc_type_check = ppc_reloc_type_check; eh->reloc_valid_use = ppc_reloc_valid_use; eh->reloc_simple_type = ppc_reloc_simple_type; + eh->dynamic_tag_name = ppc_dynamic_tag_name; + eh->dynamic_tag_check = ppc_dynamic_tag_check; eh->copy_reloc_p = ppc_copy_reloc_p; eh->destr = ppc_destr; diff --git a/libebl/ppc_symbol.c b/libebl/ppc_symbol.c index 20beae31b..e865eaabc 100644 --- a/libebl/ppc_symbol.c +++ b/libebl/ppc_symbol.c @@ -103,8 +103,14 @@ static struct [R_PPC_GOT_DTPREL16] = { "R_PPC_GOT_DTPREL16", exec }, [R_PPC_GOT_DTPREL16_LO] = { "R_PPC_GOT_DTPREL16_LO", exec }, [R_PPC_GOT_DTPREL16_HI] = { "R_PPC_GOT_DTPREL16_HI", exec }, - [R_PPC_GOT_DTPREL16_HA] = { "R_PPC_GOT_DTPREL16_HA", exec } + [R_PPC_GOT_DTPREL16_HA] = { "R_PPC_GOT_DTPREL16_HA", exec }, + [R_PPC_REL16] = { "R_PPC_REL16", rel }, + [R_PPC_REL16_LO] = { "R_PPC_REL16_LO", rel }, + [R_PPC_REL16_HI] = { "R_PPC_REL16_HI", rel }, + [R_PPC_REL16_HA] = { "R_PPC_REL16_HA", rel }, }; +#define nreloc_map_table \ + (sizeof (reloc_map_table) / sizeof (reloc_map_table[0])) /* Determine relocation type string for PPC. */ @@ -112,7 +118,7 @@ const char * ppc_reloc_type_name (int type, char *buf __attribute__ ((unused)), size_t len __attribute__ ((unused))) { - if (type < 0 || type >= R_PPC_NUM) + if (type < 0 || (size_t) type >= nreloc_map_table) return NULL; return reloc_map_table[type].name; @@ -123,7 +129,7 @@ ppc_reloc_type_name (int type, char *buf __attribute__ ((unused)), bool ppc_reloc_type_check (int type) { - return (type >= R_PPC_NONE && type < R_PPC_NUM + return (type >= R_PPC_NONE && (size_t) type < nreloc_map_table && reloc_map_table[type].name != NULL) ? true : false; } @@ -166,6 +172,29 @@ ppc_reloc_simple_type (Elf *elf __attribute__ ((unused)), int type) } } + +const char * +ppc_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_PPC_GOT: + return "PPC_GOT"; + default: + break; + } + return NULL; +} + + +bool +ppc_dynamic_tag_check (int64_t tag) +{ + return tag == DT_PPC_GOT; +} + + /* Check whether given relocation is a copy relocation. */ bool ppc_copy_reloc_p (int reloc) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 4a8bc879b..aa2a0b11b 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2005-08-07 Ulrich Drepper + + * elf.h: Update from glibc. + 2005-08-06 Ulrich Drepper * Makefile.am (AM_CFLAGS): Add -fpic when BUILD_STATIC. diff --git a/libelf/elf.h b/libelf/elf.h index e246519fa..ef9e27ccc 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -1866,6 +1866,9 @@ typedef Elf32_Addr Elf32_Conflict; #define LITUSE_ALPHA_TLS_GD 4 #define LITUSE_ALPHA_TLS_LDM 5 +/* Legal values for d_tag of Elf64_Dyn. */ +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 /* PowerPC specific declarations */ @@ -1976,10 +1979,19 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ #define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ +/* GNU relocs used in PIC code sequences. */ +#define R_PPC_REL16 249 /* word32 (sym-.) */ +#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */ +#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */ +#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */ + /* This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files. */ #define R_PPC_TOC16 255 +/* PowerPC specific values for the Dyn d_tag field. */ +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_NUM 1 /* PowerPC64 relocations defined by the ABIs */ #define R_PPC64_NONE R_PPC_NONE diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh deleted file mode 100755 index ce5706c50..000000000 --- a/tests/run-elflint-self.sh +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/sh -# Copyright (C) 2005 Red Hat, Inc. -# Written by Ulrich Drepper , 2005. -# -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. -# -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -export LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH - -runtest() { -# Uncomment for debuging -# echo $1 - ../src/elflint --quiet --gnu-ld $1 -} - -runtest ../src/addr2line -runtest ../src/elfcmp -runtest ../src/elflint -runtest ../src/findtextrel -runtest ../src/ld -runtest ../src/nm -runtest ../src/objdump -runtest ../src/readelf -runtest ../src/size -runtest ../src/strip -runtest ../libelf/libelf.so -runtest ../libdw/libdw.so -runtest ../libasm/libasm.so -runtest ../libebl/libebl_alpha.so -runtest ../libebl/libebl_arm.so -runtest ../libebl/libebl_i386.so -runtest ../libebl/libebl_ia64.so -runtest ../libebl/libebl_ppc.so -runtest ../libebl/libebl_ppc64.so -runtest ../libebl/libebl_sh.so -runtest ../libebl/libebl_sparc.so -runtest ../libebl/libebl_x86_64.so - -