summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2006-09-15 22:13:02 +0000
committerDmitry V. Levin <ldv@altlinux.org>2006-09-15 22:13:02 +0000
commit6ed4181bde4cfb24f696f872953907ba5427cca7 (patch)
treeb689b942d21fd22066e0c27b325e3296b98369ec
parent28a96befd2d2f66da13f0753fedcfc88366ab3f1 (diff)
downloadelfutils-6ed4181bde4cfb24f696f872953907ba5427cca7.tar.gz
0.123-alt10.123-alt1
- Updated to 0.123.
-rw-r--r--elfutils-0.122-rh-robustify.patch (renamed from elfutils-0.120-rh-robustify.patch)436
-rw-r--r--elfutils.spec7
-rw-r--r--elfutils/ChangeLog9
-rw-r--r--elfutils/Makefile.in2
-rw-r--r--elfutils/NEWS39
-rw-r--r--elfutils/TODO8
-rw-r--r--elfutils/backends/ChangeLog49
-rw-r--r--elfutils/backends/Makefile.am8
-rw-r--r--elfutils/backends/Makefile.in14
-rw-r--r--elfutils/backends/alpha_init.c3
-rw-r--r--elfutils/backends/common-reloc.c20
-rw-r--r--elfutils/backends/i386_regs.c12
-rw-r--r--elfutils/backends/ia64_init.c4
-rw-r--r--elfutils/backends/ia64_regs.c246
-rw-r--r--elfutils/backends/ia64_reloc.def4
-rw-r--r--elfutils/backends/ia64_retval.c368
-rw-r--r--elfutils/backends/ppc64_retval.c6
-rw-r--r--elfutils/backends/ppc_regs.c8
-rw-r--r--elfutils/backends/s390_init.c4
-rw-r--r--elfutils/backends/s390_regs.c4
-rw-r--r--elfutils/backends/sparc_regs.c4
-rw-r--r--elfutils/config.h.in10
-rw-r--r--elfutils/config/Makefile.in2
-rw-r--r--elfutils/config/elfutils.spec.in28
-rwxr-xr-xelfutils/configure41
-rw-r--r--elfutils/configure.ac17
-rw-r--r--elfutils/elfutils.spec30
-rw-r--r--elfutils/lib/Makefile.in2
-rw-r--r--elfutils/libasm/Makefile.in2
-rw-r--r--elfutils/libcpu/Makefile.in2
-rw-r--r--elfutils/libdw/ChangeLog29
-rw-r--r--elfutils/libdw/Makefile.in2
-rw-r--r--elfutils/libdw/dwarf_child.c4
-rw-r--r--elfutils/libdw/dwarf_getabbrev.c4
-rw-r--r--elfutils/libdw/dwarf_getaranges.c11
-rw-r--r--elfutils/libdw/dwarf_tag.c4
-rw-r--r--elfutils/libdw/libdw.h20
-rw-r--r--elfutils/libdw/libdw.map8
-rw-r--r--elfutils/libdw/libdw_form.c4
-rw-r--r--elfutils/libdw/memory-access.c6
-rw-r--r--elfutils/libdwfl/ChangeLog85
-rw-r--r--elfutils/libdwfl/Makefile.am4
-rw-r--r--elfutils/libdwfl/Makefile.in16
-rw-r--r--elfutils/libdwfl/cu.c60
-rw-r--r--elfutils/libdwfl/dwfl_addrmodule.c4
-rw-r--r--elfutils/libdwfl/dwfl_error.c6
-rw-r--r--elfutils/libdwfl/dwfl_line_comp_dir.c64
-rw-r--r--elfutils/libdwfl/dwfl_linecu.c62
-rw-r--r--elfutils/libdwfl/dwfl_lineinfo.c4
-rw-r--r--elfutils/libdwfl/dwfl_module.c24
-rw-r--r--elfutils/libdwfl/dwfl_module_addrname.c70
-rw-r--r--elfutils/libdwfl/dwfl_module_getdwarf.c80
-rw-r--r--elfutils/libdwfl/dwfl_module_getsym.c116
-rw-r--r--elfutils/libdwfl/dwfl_module_return_value_location.c8
-rw-r--r--elfutils/libdwfl/elf-from-memory.c6
-rw-r--r--elfutils/libdwfl/find-debuginfo.c5
-rw-r--r--elfutils/libdwfl/libdwfl.h53
-rw-r--r--elfutils/libdwfl/libdwflP.h13
-rw-r--r--elfutils/libdwfl/lines.c4
-rw-r--r--elfutils/libdwfl/linux-kernel-modules.c58
-rw-r--r--elfutils/libdwfl/relocate.c43
-rw-r--r--elfutils/libebl/ChangeLog37
-rw-r--r--elfutils/libebl/Makefile.am6
-rw-r--r--elfutils/libebl/Makefile.in13
-rw-r--r--elfutils/libebl/ebl-hooks.h8
-rw-r--r--elfutils/libebl/ebldynamictagcheck.c4
-rw-r--r--elfutils/libebl/ebldynamictagname.c7
-rw-r--r--elfutils/libebl/eblnonerelocp.c64
-rw-r--r--elfutils/libebl/eblopenbackend.c38
-rw-r--r--elfutils/libebl/eblrelativerelocp.c64
-rw-r--r--elfutils/libebl/eblsectiontypename.c4
-rw-r--r--elfutils/libebl/eblsysvhashentrysize.c63
-rw-r--r--elfutils/libebl/libebl.h19
-rw-r--r--elfutils/libebl/libeblP.h6
-rw-r--r--elfutils/libelf-po/libelf.pot2
-rw-r--r--elfutils/libelf/ChangeLog40
-rw-r--r--elfutils/libelf/Makefile.am7
-rw-r--r--elfutils/libelf/Makefile.in10
-rw-r--r--elfutils/libelf/elf.h10
-rw-r--r--elfutils/libelf/elf32_updatefile.c34
-rw-r--r--elfutils/libelf/elf32_updatenull.c2
-rw-r--r--elfutils/libelf/elf_begin.c6
-rw-r--r--elfutils/libelf/elf_getdata.c22
-rw-r--r--elfutils/libelf/elf_gnu_hash.c68
-rw-r--r--elfutils/libelf/gelf_xlate.c9
-rw-r--r--elfutils/libelf/gnuhash_xlate.h95
-rw-r--r--elfutils/libelf/libelf.h15
-rw-r--r--elfutils/libelf/libelf.map5
-rw-r--r--elfutils/libelf/libelfP.h17
-rw-r--r--elfutils/m4/Makefile.in2
-rw-r--r--elfutils/po/elfutils.pot997
-rw-r--r--elfutils/src/ChangeLog161
-rw-r--r--elfutils/src/Makefile.am13
-rw-r--r--elfutils/src/Makefile.in68
-rw-r--r--elfutils/src/addr2line.c29
-rw-r--r--elfutils/src/elflint.c522
-rw-r--r--elfutils/src/i386_ld.c88
-rw-r--r--elfutils/src/ld.c109
-rw-r--r--elfutils/src/ld.h27
-rw-r--r--elfutils/src/ldgeneric.c457
-rw-r--r--elfutils/src/ldscript.c453
-rw-r--r--elfutils/src/ldscript.y33
-rw-r--r--elfutils/src/readelf.c333
-rw-r--r--elfutils/tests/ChangeLog12
-rw-r--r--elfutils/tests/Makefile.am3
-rw-r--r--elfutils/tests/Makefile.in5
-rw-r--r--elfutils/tests/allregs.c5
-rwxr-xr-xelfutils/tests/run-allregs.sh170
-rw-r--r--elfutils/tests/testfile30.bz2bin0 -> 753 bytes
-rw-r--r--elfutils/tests/testfile31.bz2bin0 -> 769 bytes
110 files changed, 4798 insertions, 1630 deletions
diff --git a/elfutils-0.120-rh-robustify.patch b/elfutils-0.122-rh-robustify.patch
index fed1a592..edc1d586 100644
--- a/elfutils-0.120-rh-robustify.patch
+++ b/elfutils-0.122-rh-robustify.patch
@@ -65,8 +65,8 @@ src/
(check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic,
check_symtab_shndx, check_hash, check_versym): Robustify.
---- elfutils-0.120/libelf/elf32_getphdr.c
-+++ elfutils-0.120/libelf/elf32_getphdr.c
+--- elfutils-0.122/libelf/elf32_getphdr.c
++++ elfutils-0.122/libelf/elf32_getphdr.c
@@ -115,6 +115,16 @@ elfw2(LIBELFBITS,getphdr) (elf)
if (elf->map_address != NULL)
@@ -84,8 +84,8 @@ src/
/* All the data is already mapped. Use it. */
if (ehdr->e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
---- elfutils-0.120/libelf/elf32_getshdr.c
-+++ elfutils-0.120/libelf/elf32_getshdr.c
+--- elfutils-0.122/libelf/elf32_getshdr.c
++++ elfutils-0.122/libelf/elf32_getshdr.c
@@ -101,11 +101,12 @@ elfw2(LIBELFBITS,getshdr) (scn)
goto out;
@@ -118,8 +118,8 @@ src/
/* Now copy the data and at the same time convert the byte
order. */
if (ALLOW_UNALIGNED
---- elfutils-0.120/libelf/elf32_newphdr.c
-+++ elfutils-0.120/libelf/elf32_newphdr.c
+--- elfutils-0.122/libelf/elf32_newphdr.c
++++ elfutils-0.122/libelf/elf32_newphdr.c
@@ -124,6 +124,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count)
else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count
|| elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
@@ -133,8 +133,8 @@ src/
/* Allocate a new program header with the appropriate number of
elements. */
result = (ElfW2(LIBELFBITS,Phdr) *)
---- elfutils-0.120/libelf/elf32_updatefile.c
-+++ elfutils-0.120/libelf/elf32_updatefile.c
+--- elfutils-0.122/libelf/elf32_updatefile.c
++++ elfutils-0.122/libelf/elf32_updatefile.c
@@ -201,6 +201,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf
/* Write all the sections. Well, only those which are modified. */
if (shnum > 0)
@@ -145,7 +145,7 @@ src/
Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *));
char *const shdr_start = ((char *) elf->map_address + elf->start_offset
-@@ -545,6 +548,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf
+@@ -571,6 +574,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf
/* Write all the sections. Well, only those which are modified. */
if (shnum > 0)
{
@@ -156,8 +156,8 @@ src/
off_t shdr_offset = elf->start_offset + ehdr->e_shoff;
#if EV_NUM != 2
xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR];
---- elfutils-0.120/libelf/elf_begin.c
-+++ elfutils-0.120/libelf/elf_begin.c
+--- elfutils-0.122/libelf/elf_begin.c
++++ elfutils-0.122/libelf/elf_begin.c
@@ -155,7 +155,8 @@ get_shnum (void *map_address, unsigned c
if (unlikely (result == 0) && ehdr.e32->e_shoff != 0)
@@ -212,20 +212,16 @@ src/
= (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff);
+
if (ehdr->e_phnum > 0)
-- /* Assign a value only if there really is a program
-- header. Otherwise the value remains NULL. */
-- elf->state.elf32.phdr
-- = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ {
-+ /* Assign a value only if there really is a program
-+ header. Otherwise the value remains NULL. */
+ /* Assign a value only if there really is a program
+ header. Otherwise the value remains NULL. */
+ if (unlikely (ehdr->e_phoff >= maxsize)
+ || unlikely (ehdr->e_phoff
+ + ehdr->e_phnum
+ * sizeof (Elf32_Phdr) > maxsize))
+ goto free_and_out;
-+ elf->state.elf32.phdr
-+ = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ elf->state.elf32.phdr
+ = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ }
for (size_t cnt = 0; cnt < scncnt; ++cnt)
@@ -243,26 +239,22 @@ src/
= (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff);
+
if (ehdr->e_phnum > 0)
-- /* Assign a value only if there really is a program
-- header. Otherwise the value remains NULL. */
-- elf->state.elf64.phdr
-- = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ {
-+ /* Assign a value only if there really is a program
-+ header. Otherwise the value remains NULL. */
+ /* Assign a value only if there really is a program
+ header. Otherwise the value remains NULL. */
+ if (unlikely (ehdr->e_phoff >= maxsize)
+ || unlikely (ehdr->e_phoff
+ + ehdr->e_phnum
+ * sizeof (Elf32_Phdr) > maxsize))
+ goto free_and_out;
-+ elf->state.elf64.phdr
-+ = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ elf->state.elf64.phdr
+ = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff);
+ }
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
---- elfutils-0.120/libelf/elf_getarsym.c
-+++ elfutils-0.120/libelf/elf_getarsym.c
+--- elfutils-0.122/libelf/elf_getarsym.c
++++ elfutils-0.122/libelf/elf_getarsym.c
@@ -179,6 +179,9 @@ elf_getarsym (elf, ptr)
size_t index_size = atol (tmpbuf);
@@ -273,8 +265,8 @@ src/
|| n * sizeof (uint32_t) > index_size)
{
/* This index table cannot be right since it does not fit into
---- elfutils-0.120/libelf/elf_getshstrndx.c
-+++ elfutils-0.120/libelf/elf_getshstrndx.c
+--- elfutils-0.122/libelf/elf_getshstrndx.c
++++ elfutils-0.122/libelf/elf_getshstrndx.c
@@ -125,10 +125,25 @@ elf_getshstrndx (elf, dst)
if (elf->map_address != NULL
&& elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA
@@ -283,8 +275,6 @@ src/
+ || (((size_t) ((char *) elf->map_address
+ + elf->start_offset + offset))
& (__alignof__ (Elf32_Shdr) - 1)) == 0))
-- /* We can directly access the memory. */
-- num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link;
+ {
+ /* First see whether the information in the ELF header is
+ valid and it does not ask for too much. */
@@ -297,7 +287,8 @@ src/
+ goto out;
+ }
+
-+ /* We can directly access the memory. */
+ /* We can directly access the memory. */
+- num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link;
+ num = ((Elf32_Shdr *) (elf->map_address + elf->start_offset
+ + offset))->sh_link;
+ }
@@ -312,8 +303,6 @@ src/
+ || (((size_t) ((char *) elf->map_address
+ + elf->start_offset + offset))
& (__alignof__ (Elf64_Shdr) - 1)) == 0))
-- /* We can directly access the memory. */
-- num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link;
+ {
+ /* First see whether the information in the ELF header is
+ valid and it does not ask for too much. */
@@ -326,16 +315,17 @@ src/
+ goto out;
+ }
+
-+ /* We can directly access the memory. */
+ /* We can directly access the memory. */
+- num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link;
+ num = ((Elf64_Shdr *) (elf->map_address
+ + elf->start_offset + offset))->sh_link;
+ }
else
{
/* We avoid reading in all the section headers. Just read
---- elfutils-0.120/libelf/elf_newscn.c
-+++ elfutils-0.120/libelf/elf_newscn.c
-@@ -104,13 +104,21 @@ elf_newscn (elf)
+--- elfutils-0.122/libelf/elf_newscn.c
++++ elfutils-0.122/libelf/elf_newscn.c
+@@ -104,10 +104,18 @@ elf_newscn (elf)
else
{
/* We must allocate a new element. */
@@ -344,9 +334,6 @@ src/
assert (elf->state.elf.scnincr > 0);
-- newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList)
-- + ((elf->state.elf.scnincr *= 2)
-- * sizeof (Elf_Scn)), 1);
+ if (
+#if SIZE_MAX <= 4294967295U
+ likely (elf->state.elf.scnincr
@@ -355,14 +342,11 @@ src/
+ 1
+#endif
+ )
-+ newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList)
-+ + ((elf->state.elf.scnincr *= 2)
-+ * sizeof (Elf_Scn)), 1);
- if (newp == NULL)
- {
- __libelf_seterrno (ELF_E_NOMEM);
---- elfutils-0.120/libelf/gelf_getdyn.c
-+++ elfutils-0.120/libelf/gelf_getdyn.c
+ newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList)
+ + ((elf->state.elf.scnincr *= 2)
+ * sizeof (Elf_Scn)), 1);
+--- elfutils-0.122/libelf/gelf_getdyn.c
++++ elfutils-0.122/libelf/gelf_getdyn.c
@@ -93,7 +93,8 @@ gelf_getdyn (data, ndx, dst)
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
@@ -383,8 +367,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_getlib.c
-+++ elfutils-0.120/libelf/gelf_getlib.c
+--- elfutils-0.122/libelf/gelf_getlib.c
++++ elfutils-0.122/libelf/gelf_getlib.c
@@ -86,7 +86,8 @@ gelf_getlib (data, ndx, dst)
/* The data is already in the correct form. Just make sure the
index is OK. */
@@ -395,8 +379,8 @@ src/
__libelf_seterrno (ELF_E_INVALID_INDEX);
else
{
---- elfutils-0.120/libelf/gelf_getmove.c
-+++ elfutils-0.120/libelf/gelf_getmove.c
+--- elfutils-0.122/libelf/gelf_getmove.c
++++ elfutils-0.122/libelf/gelf_getmove.c
@@ -83,7 +83,8 @@ gelf_getmove (data, ndx, dst)
/* The data is already in the correct form. Just make sure the
@@ -407,8 +391,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_getrela.c
-+++ elfutils-0.120/libelf/gelf_getrela.c
+--- elfutils-0.122/libelf/gelf_getrela.c
++++ elfutils-0.122/libelf/gelf_getrela.c
@@ -71,12 +71,6 @@ gelf_getrela (data, ndx, dst)
if (data_scn == NULL)
return NULL;
@@ -442,8 +426,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
---- elfutils-0.120/libelf/gelf_getrel.c
-+++ elfutils-0.120/libelf/gelf_getrel.c
+--- elfutils-0.122/libelf/gelf_getrel.c
++++ elfutils-0.122/libelf/gelf_getrel.c
@@ -71,12 +71,6 @@ gelf_getrel (data, ndx, dst)
if (data_scn == NULL)
return NULL;
@@ -477,8 +461,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
---- elfutils-0.120/libelf/gelf_getsym.c
-+++ elfutils-0.120/libelf/gelf_getsym.c
+--- elfutils-0.122/libelf/gelf_getsym.c
++++ elfutils-0.122/libelf/gelf_getsym.c
@@ -90,7 +90,8 @@ gelf_getsym (data, ndx, dst)
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
@@ -499,8 +483,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_getsyminfo.c
-+++ elfutils-0.120/libelf/gelf_getsyminfo.c
+--- elfutils-0.122/libelf/gelf_getsyminfo.c
++++ elfutils-0.122/libelf/gelf_getsyminfo.c
@@ -84,7 +84,8 @@ gelf_getsyminfo (data, ndx, dst)
/* The data is already in the correct form. Just make sure the
@@ -511,8 +495,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_getsymshndx.c
-+++ elfutils-0.120/libelf/gelf_getsymshndx.c
+--- elfutils-0.122/libelf/gelf_getsymshndx.c
++++ elfutils-0.122/libelf/gelf_getsymshndx.c
@@ -90,7 +90,9 @@ gelf_getsymshndx (symdata, shndxdata, nd
section index table. */
if (likely (shndxdata_scn != NULL))
@@ -544,8 +528,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_getversym.c
-+++ elfutils-0.120/libelf/gelf_getversym.c
+--- elfutils-0.122/libelf/gelf_getversym.c
++++ elfutils-0.122/libelf/gelf_getversym.c
@@ -92,7 +92,8 @@ gelf_getversym (data, ndx, dst)
/* The data is already in the correct form. Just make sure the
@@ -556,8 +540,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
---- elfutils-0.120/libelf/gelf_update_dyn.c
-+++ elfutils-0.120/libelf/gelf_update_dyn.c
+--- elfutils-0.122/libelf/gelf_update_dyn.c
++++ elfutils-0.122/libelf/gelf_update_dyn.c
@@ -71,12 +71,6 @@ gelf_update_dyn (data, ndx, src)
if (data == NULL)
return 0;
@@ -591,8 +575,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_lib.c
-+++ elfutils-0.120/libelf/gelf_update_lib.c
+--- elfutils-0.122/libelf/gelf_update_lib.c
++++ elfutils-0.122/libelf/gelf_update_lib.c
@@ -68,12 +68,6 @@ gelf_update_lib (data, ndx, src)
if (data == NULL)
return 0;
@@ -616,8 +600,8 @@ src/
__libelf_seterrno (ELF_E_INVALID_INDEX);
else
{
---- elfutils-0.120/libelf/gelf_update_move.c
-+++ elfutils-0.120/libelf/gelf_update_move.c
+--- elfutils-0.122/libelf/gelf_update_move.c
++++ elfutils-0.122/libelf/gelf_update_move.c
@@ -75,7 +75,7 @@ gelf_update_move (data, ndx, src)
assert (sizeof (GElf_Move) == sizeof (Elf64_Move));
@@ -627,8 +611,8 @@ src/
|| unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
---- elfutils-0.120/libelf/gelf_update_rela.c
-+++ elfutils-0.120/libelf/gelf_update_rela.c
+--- elfutils-0.122/libelf/gelf_update_rela.c
++++ elfutils-0.122/libelf/gelf_update_rela.c
@@ -68,12 +68,6 @@ gelf_update_rela (Elf_Data *dst, int ndx
if (dst == NULL)
return 0;
@@ -662,8 +646,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_rel.c
-+++ elfutils-0.120/libelf/gelf_update_rel.c
+--- elfutils-0.122/libelf/gelf_update_rel.c
++++ elfutils-0.122/libelf/gelf_update_rel.c
@@ -68,12 +68,6 @@ gelf_update_rel (Elf_Data *dst, int ndx,
if (dst == NULL)
return 0;
@@ -697,8 +681,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_sym.c
-+++ elfutils-0.120/libelf/gelf_update_sym.c
+--- elfutils-0.122/libelf/gelf_update_sym.c
++++ elfutils-0.122/libelf/gelf_update_sym.c
@@ -72,12 +72,6 @@ gelf_update_sym (data, ndx, src)
if (data == NULL)
return 0;
@@ -732,8 +716,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_syminfo.c
-+++ elfutils-0.120/libelf/gelf_update_syminfo.c
+--- elfutils-0.122/libelf/gelf_update_syminfo.c
++++ elfutils-0.122/libelf/gelf_update_syminfo.c
@@ -72,12 +72,6 @@ gelf_update_syminfo (data, ndx, src)
if (data == NULL)
return 0;
@@ -757,8 +741,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_symshndx.c
-+++ elfutils-0.120/libelf/gelf_update_symshndx.c
+--- elfutils-0.122/libelf/gelf_update_symshndx.c
++++ elfutils-0.122/libelf/gelf_update_symshndx.c
@@ -77,12 +77,6 @@ gelf_update_symshndx (symdata, shndxdata
if (symdata == NULL)
return 0;
@@ -792,8 +776,8 @@ src/
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
---- elfutils-0.120/libelf/gelf_update_versym.c
-+++ elfutils-0.120/libelf/gelf_update_versym.c
+--- elfutils-0.122/libelf/gelf_update_versym.c
++++ elfutils-0.122/libelf/gelf_update_versym.c
@@ -75,7 +75,7 @@ gelf_update_versym (data, ndx, src)
assert (sizeof (GElf_Versym) == sizeof (Elf64_Versym));
@@ -803,11 +787,11 @@ src/
|| unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
---- elfutils-0.120/libelf/libelfP.h
-+++ elfutils-0.120/libelf/libelfP.h
-@@ -569,4 +569,13 @@ extern uint32_t __libelf_crc32 (uint32_t
+--- elfutils-0.122/libelf/libelfP.h
++++ elfutils-0.122/libelf/libelfP.h
+@@ -558,4 +558,13 @@ extern uint32_t __libelf_crc32 (uint32_t
+ } \
} while (0)
- #endif
+/* Convenience macro. Assumes int NDX and TYPE with size at least
+ 2 bytes. */
@@ -819,8 +803,8 @@ src/
+#endif
+
#endif /* libelfP.h */
---- elfutils-0.120/src/elflint.c
-+++ elfutils-0.120/src/elflint.c
+--- elfutils-0.122/src/elflint.c
++++ elfutils-0.122/src/elflint.c
@@ -123,6 +123,9 @@ static uint32_t shstrndx;
/* Array to count references in section groups. */
static int *scnref;
@@ -892,16 +876,21 @@ src/
}
if (sym->st_shndx == SHN_XINDEX)
-@@ -970,7 +980,7 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
+@@ -968,9 +978,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
+ {
+ GElf_Shdr rcshdr_mem;
const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem);
- assert (rcshdr != NULL);
+- assert (rcshdr != NULL);
- if (rcshdr->sh_type == SHT_DYNAMIC)
++ if (rcshdr == NULL)
++ break;
++
+ if (rcshdr->sh_type == SHT_DYNAMIC && rcshdr->sh_entsize)
{
/* Found the dynamic section. Look through it. */
Elf_Data *d = elf_getdata (scn, NULL);
-@@ -980,14 +990,17 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
+@@ -980,7 +992,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem);
@@ -912,16 +901,18 @@ src/
if (dyn->d_tag == DT_RELCOUNT)
{
- /* Found it. One last check: does the number
- specified number of relative relocations exceed
- the total number of relocations? */
-- if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
-+ if (shdr->sh_entsize
-+ && dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
- ERROR (gettext ("\
+@@ -994,7 +1008,9 @@ section [%2d] '%s': DT_RELCOUNT used for
+ /* Does the number specified number of relative
+ relocations exceed the total number of
+ relocations? */
+- if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
++ if (shdr->sh_entsize != 0
++ && dyn->d_un.d_val > (shdr->sh_size
++ / shdr->sh_entsize))
+ ERROR (gettext ("\
section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
- idx, section_name (ebl, idx),
-@@ -1062,7 +1075,8 @@ section [%2d] '%s': no relocations for m
+ idx, section_name (ebl, idx),
+@@ -1154,7 +1170,8 @@ section [%2d] '%s': no relocations for m
}
}
@@ -931,7 +922,7 @@ src/
ERROR (gettext (reltype == ELF_T_RELA ? "\
section [%2d] '%s': section entry size does not match ElfXX_Rela\n" : "\
section [%2d] '%s': section entry size does not match ElfXX_Rel\n"),
-@@ -1280,7 +1294,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
+@@ -1376,7 +1393,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@@ -941,7 +932,7 @@ src/
{
GElf_Rela rela_mem;
GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem);
-@@ -1330,7 +1345,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
+@@ -1426,7 +1444,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@@ -951,7 +942,7 @@ src/
{
GElf_Rel rel_mem;
GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem);
-@@ -1432,7 +1448,8 @@ section [%2d] '%s': referenced as string
+@@ -1528,7 +1547,8 @@ section [%2d] '%s': referenced as string
shdr->sh_link, section_name (ebl, shdr->sh_link),
idx, section_name (ebl, idx));
@@ -961,7 +952,7 @@ src/
ERROR (gettext ("\
section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"),
idx, section_name (ebl, idx));
-@@ -1442,7 +1459,7 @@ section [%2d] '%s': section entry size d
+@@ -1538,7 +1558,7 @@ section [%2d] '%s': section entry size d
idx, section_name (ebl, idx));
bool non_null_warned = false;
@@ -970,7 +961,7 @@ src/
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem);
-@@ -1633,6 +1650,8 @@ section [%2d] '%s': entry size does not
+@@ -1756,6 +1776,8 @@ section [%2d] '%s': entry size does not
idx, section_name (ebl, idx));
if (symshdr != NULL
@@ -979,7 +970,7 @@ src/
&& (shdr->sh_size / shdr->sh_entsize
< symshdr->sh_size / symshdr->sh_entsize))
ERROR (gettext ("\
-@@ -1659,6 +1678,12 @@ section [%2d] '%s': extended section ind
+@@ -1782,6 +1804,12 @@ section [%2d] '%s': extended section ind
}
Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL);
@@ -992,41 +983,95 @@ src/
if (*((Elf32_Word *) data->d_buf) != 0)
ERROR (gettext ("symbol 0 should have zero extended section index\n"));
-@@ -1739,23 +1764,30 @@ section [%2d] '%s': hash table section i
- idx, section_name (ebl, idx), (long int) shdr->sh_size,
- (long int) ((2 + nbucket + nchain) * shdr->sh_entsize));
+@@ -1824,7 +1852,7 @@ section [%2d] '%s': hash table section i
+
+ size_t maxidx = nchain;
- if (symshdr != NULL)
-+ if (symshdr != NULL && symshdr->sh_entsize)
++ if (symshdr != NULL && symshdr->sh_entsize != 0)
{
size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
- size_t cnt;
-+ Elf32_Word *buf, *end;
-
- if (nchain < symshdr->sh_size / symshdr->sh_entsize)
- ERROR (gettext ("section [%2d] '%s': chain array not large enough\n"),
- idx, section_name (ebl, idx));
-
-+ buf = ((Elf32_Word *) data->d_buf) + 2;
-+ end = (Elf32_Word *) ((char *) data->d_buf + shdr->sh_size);
- for (cnt = 2; cnt < 2 + nbucket; ++cnt)
-- if (((Elf32_Word *) data->d_buf)[cnt] >= symsize)
-+ if (buf >= end)
-+ return;
-+ else if (*buf++ >= symsize)
- ERROR (gettext ("\
+
+@@ -1835,18 +1863,28 @@ section [%2d] '%s': hash table section i
+ maxidx = symsize;
+ }
+
++ Elf32_Word *buf = (Elf32_Word *) data->d_buf;
++ Elf32_Word *end = (Elf32_Word *) ((char *) data->d_buf + shdr->sh_size);
+ size_t cnt;
+ for (cnt = 2; cnt < 2 + nbucket; ++cnt)
+- if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
+- ERROR (gettext ("\
++ {
++ if (buf + cnt >= end)
++ break;
++ else if (buf[cnt] >= maxidx)
++ ERROR (gettext ("\
section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
- idx, section_name (ebl, idx), cnt - 2);
-
- for (; cnt < 2 + nbucket + nchain; ++cnt)
-- if (((Elf32_Word *) data->d_buf)[cnt] >= symsize)
-+ if (buf >= end)
-+ return;
-+ else if (*buf++ >= symsize)
- ERROR (gettext ("\
+- idx, section_name (ebl, idx), cnt - 2);
++ idx, section_name (ebl, idx), cnt - 2);
++ }
+
+ for (; cnt < 2 + nbucket + nchain; ++cnt)
+- if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
+- ERROR (gettext ("\
++ {
++ if (buf + cnt >= end)
++ break;
++ else if (buf[cnt] >= maxidx)
++ ERROR (gettext ("\
section [%2d] '%s': hash chain reference %zu out of bounds\n"),
- idx, section_name (ebl, idx), cnt - 2 - nbucket);
-@@ -2097,8 +2129,9 @@ section [%2d] '%s' refers in sh_link to
+- idx, section_name (ebl, idx), cnt - 2 - nbucket);
++ idx, section_name (ebl, idx), cnt - 2 - nbucket);
++ }
+ }
+
+
+@@ -1876,18 +1914,28 @@ section [%2d] '%s': hash table section i
+ maxidx = symsize;
+ }
+
++ Elf64_Xword *buf = (Elf64_Xword *) data->d_buf;
++ Elf64_Xword *end = (Elf64_Xword *) ((char *) data->d_buf + shdr->sh_size);
+ size_t cnt;
+ for (cnt = 2; cnt < 2 + nbucket; ++cnt)
+- if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
+- ERROR (gettext ("\
++ {
++ if (buf + cnt >= end)
++ break;
++ else if (buf[cnt] >= maxidx)
++ ERROR (gettext ("\
+ section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
+- idx, section_name (ebl, idx), cnt - 2);
++ idx, section_name (ebl, idx), cnt - 2);
++ }
+
+ for (; cnt < 2 + nbucket + nchain; ++cnt)
+- if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
+- ERROR (gettext ("\
++ {
++ if (buf + cnt >= end)
++ break;
++ else if (buf[cnt] >= maxidx)
++ ERROR (gettext ("\
+ section [%2d] '%s': hash chain reference %" PRIu64 " out of bounds\n"),
+- idx, section_name (ebl, idx), (uint64_t) (cnt - 2 - nbucket));
++ idx, section_name (ebl, idx), (uint64_t) cnt - 2 - nbucket);
++ }
+ }
+
+
+@@ -1912,7 +1960,7 @@ section [%2d] '%s': bitmask size not pow
+ if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))
+ {
+ ERROR (gettext ("\
+-section [%2d] '%s': hash table section is too small (is %ld, expected at least%ld)\n"),
++section [%2d] '%s': hash table section is too small (is %ld, expected at least %ld)\n"),
+ idx, section_name (ebl, idx), (long int) shdr->sh_size,
+ (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
+ return;
+@@ -2430,8 +2478,9 @@ section [%2d] '%s' refers in sh_link to
/* The number of elements in the version symbol table must be the
same as the number of symbols. */
@@ -1038,7 +1083,7 @@ src/
ERROR (gettext ("\
section [%2d] '%s' has different number of entries than symbol table [%2d] '%s'\n"),
idx, section_name (ebl, idx),
-@@ -3002,6 +3035,8 @@ phdr[%d]: no note entries defined for th
+@@ -3336,6 +3385,8 @@ phdr[%d]: no note entries defined for th
return;
char *notemem = gelf_rawchunk (ebl->elf, phdr->p_offset, phdr->p_filesz);
@@ -1047,8 +1092,8 @@ src/
/* ELF64 files often use note section entries in the 32-bit format.
The p_align field is set to 8 in case the 64-bit format is used.
---- elfutils-0.120/src/readelf.c
-+++ elfutils-0.120/src/readelf.c
+--- elfutils-0.122/src/readelf.c
++++ elfutils-0.122/src/readelf.c
@@ -958,6 +958,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
Elf32_Word *grpref = (Elf32_Word *) data->d_buf;
@@ -1213,38 +1258,37 @@ src/
/* Now we can finally look at the actual contents of this section. */
for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
-@@ -2353,7 +2375,17 @@ handle_hash (Ebl *ebl)
- Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[2];
- Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[2 + nbucket];
-
-- GElf_Shdr glink;
-+ GElf_Shdr glink_mem;
-+ GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf,
-+ shdr->sh_link),
-+ &glink_mem);
-+ if (glink == NULL)
-+ {
-+ error (0, 0, gettext ("invalid sh_link value in section %Zu"),
-+ elf_ndxscn (scn));
-+ continue;
-+ }
+@@ -2330,7 +2352,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
+ for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
+ ++counts[lengths[cnt]];
+
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf,
++ shdr->sh_link),
++ &glink_mem);
++ if (glink == NULL)
++ {
++ error (0, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++ return;
++ }
+
- printf (ngettext ("\
+ printf (ngettext ("\
\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
- "\
-@@ -2366,10 +2398,7 @@ handle_hash (Ebl *ebl)
- shdr->sh_addr,
- shdr->sh_offset,
- (unsigned int) shdr->sh_link,
-- elf_strptr (ebl->elf, shstrndx,
-- gelf_getshdr (elf_getscn (ebl->elf,
-- shdr->sh_link),
-- &glink)->sh_name));
-+ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
-
- uint32_t *lengths = (uint32_t *) xcalloc (nbucket,
- sizeof (uint32_t));
-@@ -3510,6 +3539,16 @@ print_debug_aranges_section (Ebl *ebl __
+ "\
+@@ -2343,9 +2375,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
+ shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ if (extrastr != NULL)
+ fputs (extrastr, stdout);
+@@ -3654,6 +3684,16 @@ print_debug_aranges_section (Ebl *ebl __
return;
}
@@ -1261,8 +1305,8 @@ src/
printf (ngettext ("\
\nDWARF section '%s' at offset %#" PRIx64 " contains %zu entry:\n",
"\
---- elfutils-0.120/src/strip.c
-+++ elfutils-0.120/src/strip.c
+--- elfutils-0.122/src/strip.c
++++ elfutils-0.122/src/strip.c
@@ -412,6 +412,7 @@ handle_elf (int fd, Elf *elf, const char
Elf_Data debuglink_crc_data;
bool any_symtab_changes = false;
@@ -1322,10 +1366,9 @@ src/
for (inner = 1;
inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word);
++inner)
-- shdr_info[grpref[inner]].group_idx = cnt;
+ {
+ if (grpref[inner] < shnum)
-+ shdr_info[grpref[inner]].group_idx = cnt;
+ shdr_info[grpref[inner]].group_idx = cnt;
+ else
+ goto illformed;
+ }
@@ -1350,25 +1393,24 @@ src/
if (shdr_info[shdr_info[cnt].group_idx].idx == 0)
{
-@@ -708,10 +722,14 @@ handle_elf (int fd, Elf *elf, const char
+@@ -708,11 +722,15 @@ handle_elf (int fd, Elf *elf, const char
{
/* If a relocation section is marked as being removed make
sure the section it is relocating is removed, too. */
- if ((shdr_info[cnt].shdr.sh_type == SHT_REL
-- || shdr_info[cnt].shdr.sh_type == SHT_RELA)
-- && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
-- shdr_info[cnt].idx = 1;
+ if (shdr_info[cnt].shdr.sh_type == SHT_REL
-+ || shdr_info[cnt].shdr.sh_type == SHT_RELA)
+ || shdr_info[cnt].shdr.sh_type == SHT_RELA)
+- && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
+ {
+ if (shdr_info[cnt].shdr.sh_info >= shnum)
+ goto illformed;
+ else if (shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
-+ shdr_info[cnt].idx = 1;
-+ }
+ shdr_info[cnt].idx = 1;
}
++ }
if (shdr_info[cnt].idx == 1)
+ {
@@ -737,7 +755,7 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[cnt].symtab_idx != 0
&& shdr_info[shdr_info[cnt].symtab_idx].data == NULL)
@@ -1388,26 +1430,25 @@ src/
if (shdr_info[scnidx].idx == 0)
{
/* Mark this section as used. */
-@@ -808,11 +829,15 @@ handle_elf (int fd, Elf *elf, const char
+@@ -808,12 +829,16 @@ handle_elf (int fd, Elf *elf, const char
}
/* Handle references through sh_info. */
- if (SH_INFO_LINK_P (&shdr_info[cnt].shdr)
- && shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
+ if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
- {
-- shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
-- changes |= shdr_info[cnt].shdr.sh_info < cnt;
++ {
+ if (shdr_info[cnt].shdr.sh_info >= shnum)
+ goto illformed;
+ else if ( shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
-+ {
-+ shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
-+ changes |= shdr_info[cnt].shdr.sh_info < cnt;
-+ }
+ {
+ shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
+ changes |= shdr_info[cnt].shdr.sh_info < cnt;
}
++ }
/* Mark the section as investigated. */
+ shdr_info[cnt].idx = 2;
@@ -912,7 +937,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"),
elf_errmsg (-1));
@@ -1444,14 +1485,13 @@ src/
/* Finalize the string table and fill in the correct indices in the
section headers. */
-@@ -1095,21 +1120,21 @@ handle_elf (int fd, Elf *elf, const char
+@@ -1095,20 +1120,20 @@ handle_elf (int fd, Elf *elf, const char
shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
NULL);
- assert ((versiondata->d_size / sizeof (Elf32_Word))
-- >= shdr_info[cnt].data->d_size / elsize);
+ elf_assert ((versiondata->d_size / sizeof (Elf32_Word))
-+ >= shdr_info[cnt].data->d_size / elsize);
+ >= shdr_info[cnt].data->d_size / elsize);
}
if (shdr_info[cnt].version_idx != 0)
@@ -1465,12 +1505,10 @@ src/
NULL);
- assert ((versiondata->d_size / sizeof (GElf_Versym))
-- >= shdr_info[cnt].data->d_size / elsize);
+ elf_assert ((versiondata->d_size / sizeof (GElf_Versym))
-+ >= shdr_info[cnt].data->d_size / elsize);
+ >= shdr_info[cnt].data->d_size / elsize);
}
- shdr_info[cnt].newsymidx
@@ -1163,7 +1188,7 @@ handle_elf (int fd, Elf *elf, const char
sec = shdr_info[sym->st_shndx].idx;
else
@@ -1512,17 +1550,15 @@ src/
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
-@@ -1394,8 +1419,8 @@ handle_elf (int fd, Elf *elf, const char
+@@ -1394,7 +1419,7 @@ handle_elf (int fd, Elf *elf, const char
else
{
/* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */
- assert (shdr_info[cnt].shdr.sh_entsize
-- == sizeof (Elf64_Xword));
+ elf_assert (shdr_info[cnt].shdr.sh_entsize
-+ == sizeof (Elf64_Xword));
+ == sizeof (Elf64_Xword));
Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf;
-
@@ -1428,11 +1453,11 @@ handle_elf (int fd, Elf *elf, const char
{
GElf_Sym sym_mem;
diff --git a/elfutils.spec b/elfutils.spec
index 107f8bfe..c4f5efe3 100644
--- a/elfutils.spec
+++ b/elfutils.spec
@@ -1,5 +1,5 @@
Name: elfutils
-Version: 0.120
+Version: 0.123
Release: alt1
Summary: A collection of utilities and DSOs to handle compiled objects
@@ -9,7 +9,7 @@ Packager: Dmitry V. Levin <ldv@altlinux.org>
Source: %name-%version.tar
Patch1: %name-0.115-rh-portability.patch
-Patch2: %name-0.120-rh-robustify.patch
+Patch2: %name-0.122-rh-robustify.patch
Requires: libelf = %version-%release
@@ -149,6 +149,9 @@ mkdir -p %buildroot%prefix
%endif
%changelog
+* Sat Sep 16 2006 Dmitry V. Levin <ldv@altlinux.org> 0.123-alt1
+- Updated to 0.123.
+
* Wed Jun 07 2006 Dmitry V. Levin <ldv@altlinux.org> 0.120-alt1
- Updated to 0.120.
diff --git a/elfutils/ChangeLog b/elfutils/ChangeLog
index 1932f30f..aa95ce23 100644
--- a/elfutils/ChangeLog
+++ b/elfutils/ChangeLog
@@ -1,3 +1,12 @@
+2006-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.ac (internal_function): Don't use internal visibility.
+
+2006-07-05 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.ac: Add dummy automake conditional to get dependencies
+ for non-generic linker right. See src/Makefile.am.
+
2005-11-18 Roland McGrath <roland@redhat.com>
* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
diff --git a/elfutils/Makefile.in b/elfutils/Makefile.in
index 1614d2c8..45ad72ba 100644
--- a/elfutils/Makefile.in
+++ b/elfutils/Makefile.in
@@ -123,6 +123,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/NEWS b/elfutils/NEWS
index ce056f43..5d22c737 100644
--- a/elfutils/NEWS
+++ b/elfutils/NEWS
@@ -1,3 +1,42 @@
+Version 0.123:
+
+libebl: Backend build fixes, thanks to Stepan Kasal.
+
+libebl: ia64 backend support for register names, return value location
+
+libdwfl: Handle truncated linux kernel module section names.
+
+libdwfl: Look for linux kernel "vmlinux" files with ".debug" suffix.
+
+elflint: Fix checks to permit --hash-style=gnu format.
+
+Version 0.122:
+
+libebl: add function to test for relative relocation
+
+elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks
+
+elflint, readelf: add support for DT_GNU_HASH
+libelf: add elf_gnu_hash
+
+elflint, readelf: add support for 64-bit SysV-style hash tables
+
+libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym.
+
+Version 0.121:
+
+libelf: bug fixes for rewriting existing files when using mmap.
+
+make all installed headers usable in C++ code.
+
+readelf: better output format.
+
+elflint: fix tests of dynamic section content.
+
+ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patches.
+
+libdw, libdwfl: handle files without aranges info.
+
Version 0.120:
Bug fixes.
diff --git a/elfutils/TODO b/elfutils/TODO
index 9eb7b6ca..b3b4441b 100644
--- a/elfutils/TODO
+++ b/elfutils/TODO
@@ -1,7 +1,7 @@
ToDo list for elfutils -*-outline-*-
----------------------
-Time-stamp: <2005-08-29 08:58:24 drepper>
+Time-stamp: <2006-06-11 11:07:01 drepper>
* mkinstalldirs
@@ -79,12 +79,16 @@ Time-stamp: <2005-08-29 08:58:24 drepper>
The old mapping should be reused in that case. The problem is worse
for files which are not mapped read-only (archives again).
-
** size for STT_SECTION entries
The STT_SECTION entries have zero for the size but can easily get
the size of the section.
+** .eh_frame_hdr
+
+ Not implemented at all in the moment except for recognition of the option
+ itself.
+
* elflint
** additional checks
diff --git a/elfutils/backends/ChangeLog b/elfutils/backends/ChangeLog
index 33d52a2f..34ec4cfd 100644
--- a/elfutils/backends/ChangeLog
+++ b/elfutils/backends/ChangeLog
@@ -1,3 +1,52 @@
+2006-08-08 Roland McGrath <roland@redhat.com>
+
+ * Makefile.am (%.os): Don't depend on %.o, since we don't actually
+ need static object for anything here. This rule is the only source of
+ .deps/ files.
+
+2006-06-23 Stepan Kasal <skasal@redhat.com>
+
+ * Makefile.am (PACKAGE_VERSION): Remove superfluous definition.
+
+2006-08-03 Roland McGrath <roland@redhat.com>
+
+ * sparc_regs.c (sparc_register_name): List 32 FPU regs only for
+ EM_SPARC. EM_SPARC32PLUS also has 64.
+
+2006-07-21 Roland McGrath <roland@redhat.com>
+
+ * i386_regs.c (i386_register_name): Fix return value when using stpcpy.
+ * ppc_regs.c (ppc_register_name): Likewise.
+ * s390_regs.c (s390_register_name): Likewise.
+
+ * ia64_retval.c: New file.
+ * Makefile.am (ia64_SRCS): Add it.
+ * ia64_init.c (ia64_init): Install return_value_location hook.
+
+ * ia64_regs.c: New file.
+ * Makefile.am (ia64_SRCS): Add it.
+ * ia64_init.c (ia64_init): Install register_name hook.
+
+2006-07-05 Ulrich Drepper <drepper@redhat.com>
+
+ * alpha_init.c: Initialize sysvhash_entrysize.
+ * s390_init.c: Likewise.
+
+2006-07-04 Ulrich Drepper <drepper@redhat.com>
+
+ * common-reloc.c (relative_reloc_p): New function.
+ (init_reloc): Hook it up.
+ * ia64_reloc.def: Define NO_RELATIVE_RELOC.
+
+2006-06-13 Roland McGrath <roland@redhat.com>
+
+ * ppc64_retval.c: Remove SVR4_STRUCT_RETURN braino.
+
+2006-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * common-reloc.c (none_reloc_p): New function.
+ (init_reloc): Hook it up.
+
2006-02-22 Roland McGrath <roland@redhat.com>
* ppc64_retval.c (SVR4_STRUCT_RETURN): New macro.
diff --git a/elfutils/backends/Makefile.am b/elfutils/backends/Makefile.am
index 13a809de..a81c90e9 100644
--- a/elfutils/backends/Makefile.am
+++ b/elfutils/backends/Makefile.am
@@ -35,7 +35,6 @@ AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \
INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl \
-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \
-I$(top_srcdir)/lib -I..
-PACKAGE_VERSION = @PACKAGE_VERSION@
modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390
@@ -84,7 +83,7 @@ x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \
libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
-ia64_SRCS = ia64_init.c ia64_symbol.c
+ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
@@ -113,11 +112,10 @@ libebl_s390_pic_a_SOURCES = $(s390_SRCS)
am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
-%.os: %.c %.o
+%.os: %.c
if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
- then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
- rm -f "$(DEPDIR)/$*.Tpo"; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
fi
diff --git a/elfutils/backends/Makefile.in b/elfutils/backends/Makefile.in
index 2e4b65e4..924e1fc6 100644
--- a/elfutils/backends/Makefile.in
+++ b/elfutils/backends/Makefile.in
@@ -69,7 +69,8 @@ am__objects_3 = i386_init.$(OBJEXT) i386_symbol.$(OBJEXT) \
libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS)
libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS)
libebl_ia64_pic_a_LIBADD =
-am__objects_4 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT)
+am__objects_4 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT) \
+ ia64_regs.$(OBJEXT) ia64_retval.$(OBJEXT)
libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS)
libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS)
libebl_ppc64_pic_a_LIBADD =
@@ -175,6 +176,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -270,7 +273,7 @@ x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \
libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
-ia64_SRCS = ia64_init.c ia64_symbol.c
+ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
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
@@ -391,6 +394,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_retval.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_symbol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_regs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_retval.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_symbol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_retval.Po@am__quote@
@@ -601,11 +606,10 @@ libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw)
libebl_%.map: Makefile
echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@
-%.os: %.c %.o
+%.os: %.c
if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
- then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
- rm -f "$(DEPDIR)/$*.Tpo"; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
fi
diff --git a/elfutils/backends/alpha_init.c b/elfutils/backends/alpha_init.c
index 98400280..1590fc88 100644
--- a/elfutils/backends/alpha_init.c
+++ b/elfutils/backends/alpha_init.c
@@ -1,5 +1,5 @@
/* Initialization of Alpha specific backend library.
- Copyright (C) 2002, 2005 Red Hat, Inc.
+ Copyright (C) 2002, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -54,6 +54,7 @@ alpha_init (elf, machine, eh, ehlen)
HOOK (eh, dynamic_tag_check);
HOOK (eh, reloc_simple_type);
HOOK (eh, return_value_location);
+ eh->sysvhash_entrysize = sizeof (Elf64_Xword);
return MODVERSION;
}
diff --git a/elfutils/backends/common-reloc.c b/elfutils/backends/common-reloc.c
index b3b75530..191b22a2 100644
--- a/elfutils/backends/common-reloc.c
+++ b/elfutils/backends/common-reloc.c
@@ -1,5 +1,5 @@
/* Common code for ebl reloc functions.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -115,6 +115,20 @@ EBLHOOK(copy_reloc_p) (int reloc)
return reloc == R_TYPE (COPY);
}
+bool
+EBLHOOK(none_reloc_p) (int reloc)
+{
+ return reloc == R_TYPE (NONE);
+}
+
+#ifndef NO_RELATIVE_RELOC
+bool
+EBLHOOK(relative_reloc_p) (int reloc)
+{
+ return reloc == R_TYPE (RELATIVE);
+}
+#endif
+
static void
EBLHOOK(init_reloc) (Ebl *ebl)
{
@@ -122,4 +136,8 @@ EBLHOOK(init_reloc) (Ebl *ebl)
ebl->reloc_type_check = EBLHOOK(reloc_type_check);
ebl->reloc_valid_use = EBLHOOK(reloc_valid_use);
ebl->copy_reloc_p = EBLHOOK(copy_reloc_p);
+ ebl->none_reloc_p = EBLHOOK(none_reloc_p);
+#ifndef NO_RELATIVE_RELOC
+ ebl->relative_reloc_p = EBLHOOK(relative_reloc_p);
+#endif
}
diff --git a/elfutils/backends/i386_regs.c b/elfutils/backends/i386_regs.c
index c2c21423..248700b6 100644
--- a/elfutils/backends/i386_regs.c
+++ b/elfutils/backends/i386_regs.c
@@ -1,5 +1,5 @@
/* Register names and numbers for i386 DWARF.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -72,9 +72,9 @@ i386_register_name (Ebl *ebl __attribute__ ((unused)),
break;
case 9:
- return stpcpy (name, "eflags") - name;
+ return stpcpy (name, "eflags") + 1 - name;
case 10:
- return stpcpy (name, "trapno") - name;
+ return stpcpy (name, "trapno") + 1 - name;
case 11 ... 18:
name[0] = 's';
@@ -99,11 +99,11 @@ i386_register_name (Ebl *ebl __attribute__ ((unused)),
break;
case 37:
- return stpcpy (name, "fctrl") - name;
+ return stpcpy (name, "fctrl") + 1 - name;
case 38:
- return stpcpy (name, "fstat") - name;
+ return stpcpy (name, "fstat") + 1 - name;
case 39:
- return stpcpy (name, "mxcsr") - name;
+ return stpcpy (name, "mxcsr") + 1 - name;
case 40 ... 45:
name[0] = "ecsdfg"[regno - 40];
diff --git a/elfutils/backends/ia64_init.c b/elfutils/backends/ia64_init.c
index 42f0634b..490c774a 100644
--- a/elfutils/backends/ia64_init.c
+++ b/elfutils/backends/ia64_init.c
@@ -1,5 +1,5 @@
/* Initialization of IA-64 specific backend library.
- Copyright (C) 2002, 2003, 2005 Red Hat, Inc.
+ Copyright (C) 2002, 2003, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -55,6 +55,8 @@ ia64_init (elf, machine, eh, ehlen)
HOOK (eh, dynamic_tag_name);
HOOK (eh, dynamic_tag_check);
HOOK (eh, machine_flag_check);
+ HOOK (eh, register_name);
+ HOOK (eh, return_value_location);
return MODVERSION;
}
diff --git a/elfutils/backends/ia64_regs.c b/elfutils/backends/ia64_regs.c
new file mode 100644
index 00000000..076609db
--- /dev/null
+++ b/elfutils/backends/ia64_regs.c
@@ -0,0 +1,246 @@
+/* Register names and numbers for IA64 DWARF.
+ Copyright (C) 2006 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>
+
+#define BACKEND i386_
+#include "libebl_CPU.h"
+
+ssize_t
+ia64_register_name (Ebl *ebl __attribute__ ((unused)),
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname)
+{
+ if (name == NULL)
+ return 687 + 64;
+
+ if (regno < 0 || regno > 687 + 63 || namelen < 12)
+ return -1;
+
+ *prefix = "ar.";
+ *setname = "application";
+ switch (regno)
+ {
+ case 0 ... 9:
+ name[0] = 'r';
+ name[1] = (regno - 0) + '0';
+ namelen = 2;
+ *setname = "integer";
+ *prefix = "";
+ break;
+
+ case 10 ... 99:
+ name[0] = 'r';
+ name[1] = (regno - 0) / 10 + '0';
+ name[2] = (regno - 0) % 10 + '0';
+ namelen = 3;
+ *setname = "integer";
+ *prefix = "";
+ break;
+
+ case 100 ... 127:
+ name[0] = 'r';
+ name[1] = '1';
+ name[2] = (regno - 100) / 10 + '0';
+ name[3] = (regno - 0) % 10 + '0';
+ namelen = 4;
+ *setname = "integer";
+ *prefix = "";
+ break;
+
+ case 128 + 0 ... 128 + 9:
+ name[0] = 'f';
+ name[1] = (regno - 128) + '0';
+ namelen = 2;
+ *setname = "FPU";
+ *prefix = "";
+ break;
+
+ case 128 + 10 ... 128 + 99:
+ name[0] = 'f';
+ name[1] = (regno - 128) / 10 + '0';
+ name[2] = (regno - 128) % 10 + '0';
+ namelen = 3;
+ *setname = "FPU";
+ *prefix = "";
+ break;
+
+ case 128 + 100 ... 128 + 127:
+ name[0] = 'f';
+ name[1] = '1';
+ name[2] = (regno - 128 - 100) / 10 + '0';
+ name[3] = (regno - 128) % 10 + '0';
+ namelen = 4;
+ *setname = "FPU";
+ *prefix = "";
+ break;
+
+ case 320 + 0 ... 320 + 7:
+ name[0] = 'b';
+ name[1] = (regno - 320) + '0';
+ namelen = 2;
+ *setname = "branch";
+ *prefix = "";
+ break;
+
+ case 328 ... 333:
+ {
+ static const char named_special[][5] =
+ {
+ "vfp", "vrap", "pr", "ip", "psr", "cfm"
+ };
+ *setname = "special";
+ *prefix = "";
+ return stpcpy (name, named_special[regno - 328]) + 1 - name;
+ }
+
+ case 590:
+ *setname = "special";
+ *prefix = "";
+ return stpcpy (name, "bof") + 1 - name;
+
+ case 334 + 0 ... 334 + 7:
+ name[0] = 'k';
+ name[1] = 'r';
+ name[2] = (regno - 334) + '0';
+ namelen = 3;
+ *prefix = "";
+ break;
+
+ case 334 + 8 ... 334 + 127:
+ {
+ static const char named_ar[][9] =
+ {
+ [16 - 8] = "rsc",
+ [17 - 8] = "bsp",
+ [18 - 8] = "bspstore",
+ [19 - 8] = "rnat",
+ [21 - 8] = "fcr",
+ [24 - 8] = "eflag",
+ [25 - 8] = "csd",
+ [26 - 8] = "ssd",
+ [27 - 8] = "cflg",
+ [28 - 8] = "fsr",
+ [29 - 8] = "fir",
+ [30 - 8] = "fdr",
+ [32 - 8] = "ccv",
+ [36 - 8] = "unat",
+ [40 - 8] = "fpsr",
+ [44 - 8] = "itc",
+ [64 - 8] = "pfs",
+ [65 - 8] = "lc",
+ [66 - 8] = "ec",
+ };
+ const size_t idx = regno - (334 + 8);
+ if (idx < sizeof named_ar / sizeof named_ar[0]
+ && named_ar[idx][0] != '\0')
+ return stpcpy (name, named_ar[idx]) + 1 - name;
+
+ name[0] = 'a';
+ name[1] = 'r';
+ switch (regno - 334)
+ {
+ case 0 ... 9:
+ name[2] = (regno - 334) + '0';
+ namelen = 3;
+ break;
+ case 10 ... 99:
+ name[2] = (regno - 334) / 10 + '0';
+ name[3] = (regno - 334) % 10 + '0';
+ namelen = 4;
+ break;
+ case 100 ... 127:
+ name[2] = '1';
+ name[3] = (regno - 334 - 100) / 10 + '0';
+ name[4] = (regno - 334) % 10 + '0';
+ namelen = 5;
+ break;
+ }
+ *prefix = "";
+ break;
+ }
+
+ case 462 + 0 ... 462 + 9:
+ name[0] = 'n';
+ name[1] = 'a';
+ name[2] = 't';
+ name[3] = (regno - 462) + '0';
+ namelen = 4;
+ *setname = "NAT";
+ *prefix = "";
+ break;
+
+ case 462 + 10 ... 462 + 99:
+ name[0] = 'n';
+ name[1] = 'a';
+ name[2] = 't';
+ name[3] = (regno - 462) / 10 + '0';
+ name[4] = (regno - 462) % 10 + '0';
+ namelen = 5;
+ *setname = "NAT";
+ *prefix = "";
+ break;
+
+ case 462 + 100 ... 462 + 127:
+ name[0] = 'n';
+ name[1] = 'a';
+ name[2] = 't';
+ name[3] = '1';
+ name[4] = (regno - 462 - 100) / 10 + '0';
+ name[5] = (regno - 462) % 10 + '0';
+ namelen = 6;
+ *setname = "NAT";
+ *prefix = "";
+ break;
+
+ case 687 + 0 ... 687 + 9:
+ name[0] = 'p';
+ name[1] = (regno - 687) + '0';
+ namelen = 2;
+ *setname = "predicate";
+ *prefix = "";
+ break;
+
+ case 687 + 10 ... 687 + 63:
+ name[0] = 'p';
+ name[1] = (regno - 687) / 10 + '0';
+ name[2] = (regno - 687) % 10 + '0';
+ namelen = 3;
+ *setname = "predicate";
+ *prefix = "";
+ break;
+
+ default:
+ *setname = NULL;
+ return 0;
+ }
+
+ name[namelen++] = '\0';
+ return namelen;
+}
diff --git a/elfutils/backends/ia64_reloc.def b/elfutils/backends/ia64_reloc.def
index 0dc001da..a4234656 100644
--- a/elfutils/backends/ia64_reloc.def
+++ b/elfutils/backends/ia64_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for ia64. -*- C -*-
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -106,3 +106,5 @@ RELOC_TYPE (DTPREL32LSB, REL|EXEC|DYN)
RELOC_TYPE (DTPREL64MSB, REL|EXEC|DYN)
RELOC_TYPE (DTPREL64LSB, REL|EXEC|DYN)
RELOC_TYPE (LTOFF_DTPREL22, REL)
+
+#define NO_RELATIVE_RELOC 1
diff --git a/elfutils/backends/ia64_retval.c b/elfutils/backends/ia64_retval.c
new file mode 100644
index 00000000..4100328c
--- /dev/null
+++ b/elfutils/backends/ia64_retval.c
@@ -0,0 +1,368 @@
+/* Function return value location for IA64 ABI.
+ Copyright (C) 2006 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 <assert.h>
+#include <dwarf.h>
+
+#define BACKEND ia64_
+#include "libebl_CPU.h"
+
+
+/* r8, or pair r8, r9, or aggregate up to r8-r11. */
+static const Dwarf_Op loc_intreg[] =
+ {
+ { .atom = DW_OP_reg8 }, { .atom = DW_OP_piece, .number = 8 },
+ { .atom = DW_OP_reg9 }, { .atom = DW_OP_piece, .number = 8 },
+ { .atom = DW_OP_reg10 }, { .atom = DW_OP_piece, .number = 8 },
+ { .atom = DW_OP_reg11 }, { .atom = DW_OP_piece, .number = 8 },
+ };
+#define nloc_intreg 1
+#define nloc_intregs(n) (2 * (n))
+
+/* f8, or aggregate up to f8-f15. */
+#define DEFINE_FPREG(size) \
+ static const Dwarf_Op loc_fpreg_##size[] = \
+ { \
+ { .atom = DW_OP_regx, .number = 128 + 8 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 9 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 10 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 11 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 12 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 13 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 14 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ { .atom = DW_OP_regx, .number = 128 + 15 }, \
+ { .atom = DW_OP_piece, .number = size }, \
+ }
+#define nloc_fpreg 1
+#define nloc_fpregs(n) (2 * (n))
+
+DEFINE_FPREG (4);
+DEFINE_FPREG (8);
+DEFINE_FPREG (10);
+
+#undef DEFINE_FPREG
+
+
+/* The return value is a structure and is actually stored in stack space
+ passed in a hidden argument by the caller. But, the compiler
+ helpfully returns the address of that space in r8. */
+static const Dwarf_Op loc_aggregate[] =
+ {
+ { .atom = DW_OP_breg8, .number = 0 }
+ };
+#define nloc_aggregate 1
+
+
+/* If this type is an HFA small enough to be returned in FP registers,
+ return the number of registers to use. Otherwise 9, or -1 for errors. */
+static int
+hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used)
+{
+ /* Descend the type structure, counting elements and finding their types.
+ If we find a datum that's not an FP type (and not quad FP), punt.
+ If we find a datum that's not the same FP type as the first datum, punt.
+ If we count more than eight total homogeneous FP data, punt. */
+
+ inline int hfa (const Dwarf_Op *loc, int nregs)
+ {
+ if (fpregs_used == 0)
+ *locp = loc;
+ else if (*locp != loc)
+ return 9;
+ return fpregs_used + nregs;
+ }
+
+ int tag = dwarf_tag (typedie);
+ switch (tag)
+ {
+ Dwarf_Attribute attr_mem;
+
+ case -1:
+ return -1;
+
+ case DW_TAG_base_type:;
+ int size = dwarf_bytesize (typedie);
+ if (size < 0)
+ return -1;
+
+ Dwarf_Word encoding;
+ if (dwarf_formudata (dwarf_attr (typedie, DW_AT_encoding,
+ &attr_mem), &encoding) != 0)
+ return -1;
+
+ switch (encoding)
+ {
+ case DW_ATE_float:
+ switch (size)
+ {
+ case 4: /* float */
+ return hfa (loc_fpreg_4, 1);
+ case 8: /* double */
+ return hfa (loc_fpreg_8, 1);
+ case 10: /* x86-style long double, not really used */
+ return hfa (loc_fpreg_10, 1);
+ }
+ break;
+
+ case DW_ATE_complex_float:
+ switch (size)
+ {
+ case 4 * 2: /* complex float */
+ return hfa (loc_fpreg_4, 2);
+ case 8 * 2: /* complex double */
+ return hfa (loc_fpreg_8, 2);
+ case 10 * 2: /* complex long double (x86-style) */
+ return hfa (loc_fpreg_10, 2);
+ }
+ break;
+ }
+ break;
+
+ case DW_TAG_structure_type:
+ case DW_TAG_class_type:
+ case DW_TAG_union_type:;
+ Dwarf_Die child_mem;
+ switch (dwarf_child (typedie, &child_mem))
+ {
+ default:
+ return -1;
+
+ case 1: /* No children: empty struct. */
+ break;
+
+ case 0:; /* Look at each element. */
+ int max_used = fpregs_used;
+ do
+ switch (dwarf_tag (&child_mem))
+ {
+ case -1:
+ return -1;
+
+ case DW_TAG_member:;
+ Dwarf_Die child_type_mem;
+ Dwarf_Die *child_typedie
+ = dwarf_formref_die (dwarf_attr (&child_mem, DW_AT_type,
+ &attr_mem),
+ &child_type_mem);
+ if (tag == DW_TAG_union_type)
+ {
+ int used = hfa_type (child_typedie, locp, fpregs_used);
+ if (used < 0 || used > 8)
+ return used;
+ if (used > max_used)
+ max_used = used;
+ }
+ else
+ {
+ fpregs_used = hfa_type (child_typedie, locp, fpregs_used);
+ if (fpregs_used < 0 || fpregs_used > 8)
+ return fpregs_used;
+ }
+ }
+ while (dwarf_siblingof (&child_mem, &child_mem) == 0);
+ if (tag == DW_TAG_union_type)
+ fpregs_used = max_used;
+ break;
+ }
+ break;
+
+ case DW_TAG_array_type:;
+ size = dwarf_bytesize (typedie);
+ if (size < 0)
+ return 9;
+ if (size == 0)
+ break;
+
+ Dwarf_Die base_type_mem;
+ Dwarf_Die *base_typedie = dwarf_formref_die (dwarf_attr (typedie,
+ DW_AT_type,
+ &attr_mem),
+ &base_type_mem);
+
+ int used = hfa_type (base_typedie, locp, 0);
+ if (used < 0 || used > 8)
+ return used;
+ if (size % (*locp)[1].number != 0)
+ return 0;
+ size /= (*locp)[1].number;
+ fpregs_used += used * size;
+ break;
+
+ default:
+ return 9;
+ }
+
+ return fpregs_used;
+}
+
+int
+ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+{
+ /* Start with the function's type, and get the DW_AT_type attribute,
+ which is the type of the return value. */
+
+ Dwarf_Attribute attr_mem;
+ Dwarf_Attribute *attr = dwarf_attr (functypedie, DW_AT_type, &attr_mem);
+ if (attr == NULL)
+ /* The function has no return value, like a `void' function in C. */
+ return 0;
+
+ Dwarf_Die die_mem;
+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
+ int tag = dwarf_tag (typedie);
+
+ /* Follow typedefs and qualifiers to get to the actual type. */
+ while (tag == DW_TAG_typedef
+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
+ || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type)
+ {
+ attr = dwarf_attr (typedie, DW_AT_type, &attr_mem);
+ typedie = dwarf_formref_die (attr, &die_mem);
+ tag = dwarf_tag (typedie);
+ }
+
+ Dwarf_Word size;
+ switch (tag)
+ {
+ case -1:
+ return -1;
+
+ case DW_TAG_subrange_type:
+ if (! dwarf_hasattr (typedie, DW_AT_byte_size))
+ {
+ attr = dwarf_attr (typedie, DW_AT_type, &attr_mem);
+ typedie = dwarf_formref_die (attr, &die_mem);
+ tag = dwarf_tag (typedie);
+ }
+ /* Fall through. */
+
+ case DW_TAG_base_type:
+ case DW_TAG_enumeration_type:
+ case DW_TAG_pointer_type:
+ case DW_TAG_ptr_to_member_type:
+ if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size,
+ &attr_mem), &size) != 0)
+ {
+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
+ size = 8;
+ else
+ return -1;
+ }
+ if (tag == DW_TAG_base_type)
+ {
+ Dwarf_Word encoding;
+ if (dwarf_formudata (dwarf_attr (typedie, DW_AT_encoding,
+ &attr_mem), &encoding) != 0)
+ return -1;
+
+ switch (encoding)
+ {
+ case DW_ATE_float:
+ switch (size)
+ {
+ case 4: /* float */
+ *locp = loc_fpreg_4;
+ return nloc_fpreg;
+ case 8: /* double */
+ *locp = loc_fpreg_8;
+ return nloc_fpreg;
+ case 10: /* x86-style long double, not really used */
+ *locp = loc_fpreg_10;
+ return nloc_fpreg;
+ case 16: /* long double, IEEE quad format */
+ *locp = loc_intreg;
+ return nloc_intregs (2);
+ }
+ return -2;
+
+ case DW_ATE_complex_float:
+ switch (size)
+ {
+ case 4 * 2: /* complex float */
+ *locp = loc_fpreg_4;
+ return nloc_fpregs (2);
+ case 8 * 2: /* complex double */
+ *locp = loc_fpreg_8;
+ return nloc_fpregs (2);
+ case 10 * 2: /* complex long double (x86-style) */
+ *locp = loc_fpreg_10;
+ return nloc_fpregs (2);
+ case 16 * 2: /* complex long double (IEEE quad) */
+ *locp = loc_intreg;
+ return nloc_intregs (4);
+ }
+ return -2;
+ }
+ }
+
+ intreg:
+ *locp = loc_intreg;
+ if (size <= 8)
+ return nloc_intreg;
+ if (size <= 32)
+ return nloc_intregs ((size + 7) / 8);
+
+ large:
+ *locp = loc_aggregate;
+ return nloc_aggregate;
+
+ case DW_TAG_structure_type:
+ case DW_TAG_class_type:
+ case DW_TAG_union_type:
+ case DW_TAG_array_type:
+ if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size,
+ &attr_mem), &size) != 0)
+ return -1;
+
+ /* If this qualifies as an homogeneous floating-point aggregate
+ (HFA), then it should be returned in FP regs. */
+ int nfpreg = hfa_type (typedie, locp, 0);
+ if (nfpreg < 0)
+ return nfpreg;
+ else if (nfpreg > 0 && nfpreg <= 8)
+ return nfpreg == 1 ? nloc_fpreg : nloc_fpregs (nfpreg);
+
+ if (size > 32)
+ goto large;
+
+ goto intreg;
+ }
+
+ /* XXX We don't have a good way to return specific errors from ebl calls.
+ This value means we do not understand the type, but it is well-formed
+ DWARF and might be valid. */
+ return -2;
+}
diff --git a/elfutils/backends/ppc64_retval.c b/elfutils/backends/ppc64_retval.c
index 70a0de76..7f5e6f83 100644
--- a/elfutils/backends/ppc64_retval.c
+++ b/elfutils/backends/ppc64_retval.c
@@ -34,10 +34,6 @@
#include "libebl_CPU.h"
-/* This is the SVR4 ELF ABI convention, but AIX and Linux do not use it. */
-#define SVR4_STRUCT_RETURN 0
-
-
/* r3. */
static const Dwarf_Op loc_intreg[] =
{
@@ -137,7 +133,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
return nloc_fp4regs;
}
}
- if (size <= 8 && SVR4_STRUCT_RETURN)
+ if (size <= 8)
{
intreg:
*locp = loc_intreg;
diff --git a/elfutils/backends/ppc_regs.c b/elfutils/backends/ppc_regs.c
index 3d3d904d..bea8d357 100644
--- a/elfutils/backends/ppc_regs.c
+++ b/elfutils/backends/ppc_regs.c
@@ -1,5 +1,5 @@
/* Register names and numbers for PowerPC DWARF.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -83,11 +83,11 @@ ppc_register_name (Ebl *ebl __attribute__ ((unused)),
break;
case 64:
- return stpcpy (name, "cr") - name;
+ return stpcpy (name, "cr") + 1 - name;
case 65:
- return stpcpy (name, "fpscr") - name;
+ return stpcpy (name, "fpscr") + 1 - name;
case 66:
- return stpcpy (name, "msr") - name;
+ return stpcpy (name, "msr") + 1 - name;
case 70 + 0 ... 70 + 9:
name[0] = 's';
diff --git a/elfutils/backends/s390_init.c b/elfutils/backends/s390_init.c
index 64e5639b..80cbb832 100644
--- a/elfutils/backends/s390_init.c
+++ b/elfutils/backends/s390_init.c
@@ -53,5 +53,9 @@ s390_init (elf, machine, eh, ehlen)
HOOK (eh, register_name);
HOOK (eh, return_value_location);
+ /* Only the 64-bit format uses the incorrect hash table entry size. */
+ if (eh->class == ELFCLASS64)
+ eh->sysvhash_entrysize = sizeof (Elf64_Xword);
+
return MODVERSION;
}
diff --git a/elfutils/backends/s390_regs.c b/elfutils/backends/s390_regs.c
index 61c60744..28b79898 100644
--- a/elfutils/backends/s390_regs.c
+++ b/elfutils/backends/s390_regs.c
@@ -114,9 +114,9 @@ s390_register_name (Ebl *ebl __attribute__ ((unused)),
break;
case 64:
- return stpcpy (name, "pswm") - name;
+ return stpcpy (name, "pswm") + 1 - name;
case 65:
- return stpcpy (name, "pswa") - name;
+ return stpcpy (name, "pswa") + 1 - name;
default:
*setname = NULL;
diff --git a/elfutils/backends/sparc_regs.c b/elfutils/backends/sparc_regs.c
index 8ee2a0cb..820878e1 100644
--- a/elfutils/backends/sparc_regs.c
+++ b/elfutils/backends/sparc_regs.c
@@ -1,5 +1,5 @@
/* Register names and numbers for SPARC DWARF.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@ sparc_register_name (Ebl *ebl,
int regno, char *name, size_t namelen,
const char **prefix, const char **setname)
{
- const int nfp = ebl->machine == EM_SPARCV9 ? 64 : 32;
+ const int nfp = ebl->machine == EM_SPARC ? 32 : 64;
if (name == NULL)
return 32 + nfp;
diff --git a/elfutils/config.h.in b/elfutils/config.h.in
index 12637228..4c36f3f3 100644
--- a/elfutils/config.h.in
+++ b/elfutils/config.h.in
@@ -77,15 +77,13 @@
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
#ifdef __i386__
-# define internal_function_def __attribute__ ((regparm (3), stdcall))
+# define internal_function __attribute__ ((regparm (3), stdcall))
#else
-# define internal_function_def /* nothing */
+# define internal_function /* nothing */
#endif
-# define internal_function \
- internal_function_def __attribute__ ((visibility ("internal")))
-# define internal_strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
+#define internal_strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
#define attribute_hidden \
__attribute__ ((visibility ("hidden")))
diff --git a/elfutils/config/Makefile.in b/elfutils/config/Makefile.in
index d1c67c55..538669c6 100644
--- a/elfutils/config/Makefile.in
+++ b/elfutils/config/Makefile.in
@@ -101,6 +101,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/config/elfutils.spec.in b/elfutils/config/elfutils.spec.in
index 8a232a0a..05a2f5e3 100644
--- a/elfutils/config/elfutils.spec.in
+++ b/elfutils/config/elfutils.spec.in
@@ -154,6 +154,29 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.so
%changelog
+* Mon Aug 14 2006 Roland McGrath <roland@redhat.com> 0.123-1
+- libebl: Backend build fixes, thanks to Stepan Kasal.
+- libebl: ia64 backend support for register names, return value location
+- libdwfl: Handle truncated linux kernel module section names.
+- libdwfl: Look for linux kernel vmlinux files with .debug suffix.
+- elflint: Fix checks to permit --hash-style=gnu format.
+
+* Wed Jul 12 2006 Ulrich Drepper <drepper@redhat.com> 0.122-1
+- libebl: add function to test for relative relocation
+- elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks
+- elflint, readelf: add support for DT_GNU_HASHlibelf: add elf_gnu_hash
+- elflint, readelf: add support for 64-bit SysV-style hash tables
+- libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym.
+
+* Wed Jun 14 2006 <drepper@redhat.com> 0.121-1
+- libelf: bug fixes for rewriting existing files when using mmap.
+- make all installed headers usable in C++ code.
+- readelf: better output format.
+- elflint: fix tests of dynamic section content.
+- ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patc
+hes.
+- libdw, libdwfl: handle files without aranges info.
+
* Tue Apr 4 2006 Ulrich Drepper <drepper@redhat.com> 0.120-1
- Bug fixes.
- dwarf.h updated for DWARF 3.0 final specification.
@@ -161,11 +184,6 @@ rm -rf ${RPM_BUILD_ROOT}
- The license is now GPL for most files. The libelf, libebl, libdw,and
libdwfl libraries have additional exceptions. Add reference toOIN.
-* Thu Mar 30 2006 Roland McGrath <roland@redhat.com> 0.120-1
-- Bug fixes.
-- dwarf.h updated for DWARF 3.0 final specification.
-- libdwfl: New function dwfl_version.
-
* Thu Jan 12 2006 Roland McGrath <roland@redhat.com> 0.119-1
- elflint: more tests.
- libdwfl: New function dwfl_module_register_names.
diff --git a/elfutils/configure b/elfutils/configure
index 8f602309..4ce18f59 100755
--- a/elfutils/configure
+++ b/elfutils/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for Red Hat elfutils 0.120.
+# Generated by GNU Autoconf 2.59 for Red Hat elfutils 0.123.
#
# Report bugs to <http://bugzilla.redhat.com/bugzilla/>.
#
@@ -271,12 +271,12 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='Red Hat elfutils'
PACKAGE_TARNAME='elfutils'
-PACKAGE_VERSION='0.120'
-PACKAGE_STRING='Red Hat elfutils 0.120'
+PACKAGE_VERSION='0.123'
+PACKAGE_STRING='Red Hat elfutils 0.123'
PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/'
ac_unique_file="libelf/libelf.h"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MODVERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu MUDFLAP_TRUE MUDFLAP_FALSE GPROF_TRUE GPROF_FALSE GCOV_TRUE GCOV_FALSE BUILD_STATIC_TRUE BUILD_STATIC_FALSE TESTS_RPATH_TRUE TESTS_RPATH_FALSE LIBEBL_SUBDIR HAVE_LIBASM_TRUE HAVE_LIBASM_FALSE STANDALONE_TRUE STANDALONE_FALSE USE_NLS MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MODVERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu NEVER_TRUE NEVER_FALSE MUDFLAP_TRUE MUDFLAP_FALSE GPROF_TRUE GPROF_FALSE GCOV_TRUE GCOV_FALSE BUILD_STATIC_TRUE BUILD_STATIC_FALSE TESTS_RPATH_TRUE TESTS_RPATH_FALSE LIBEBL_SUBDIR HAVE_LIBASM_TRUE HAVE_LIBASM_FALSE STANDALONE_TRUE STANDALONE_FALSE USE_NLS MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -741,7 +741,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Red Hat elfutils 0.120 to adapt to many kinds of systems.
+\`configure' configures Red Hat elfutils 0.123 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -807,7 +807,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Red Hat elfutils 0.120:";;
+ short | recursive ) echo "Configuration of Red Hat elfutils 0.123:";;
esac
cat <<\_ACEOF
@@ -933,7 +933,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-Red Hat elfutils configure 0.120
+Red Hat elfutils configure 0.123
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -949,7 +949,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Red Hat elfutils $as_me 0.120, which was
+It was created by Red Hat elfutils $as_me 0.123, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1598,7 +1598,7 @@ fi
# Define the identity of the package.
PACKAGE='elfutils'
- VERSION='0.120'
+ VERSION='0.123'
cat >>confdefs.h <<_ACEOF
@@ -3802,6 +3802,16 @@ fi
+
+if false; then
+ NEVER_TRUE=
+ NEVER_FALSE='#'
+else
+ NEVER_TRUE='#'
+ NEVER_FALSE=
+fi
+
+
use_mudflap=no
# Check whether --enable-mudflap or --disable-mudflap was given.
if test "${enable_mudflap+set}" = set; then
@@ -4330,6 +4340,13 @@ echo "$as_me: error: conditional \"NATIVE_LD\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${NEVER_TRUE}" && test -z "${NEVER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${MUDFLAP_TRUE}" && test -z "${MUDFLAP_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"MUDFLAP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -4650,7 +4667,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by Red Hat elfutils $as_me 0.120, which was
+This file was extended by Red Hat elfutils $as_me 0.123, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4713,7 +4730,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-Red Hat elfutils config.status 0.120
+Red Hat elfutils config.status 0.123
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -4992,6 +5009,8 @@ s,@DATADIRNAME@,$DATADIRNAME,;t t
s,@NATIVE_LD_TRUE@,$NATIVE_LD_TRUE,;t t
s,@NATIVE_LD_FALSE@,$NATIVE_LD_FALSE,;t t
s,@base_cpu@,$base_cpu,;t t
+s,@NEVER_TRUE@,$NEVER_TRUE,;t t
+s,@NEVER_FALSE@,$NEVER_FALSE,;t t
s,@MUDFLAP_TRUE@,$MUDFLAP_TRUE,;t t
s,@MUDFLAP_FALSE@,$MUDFLAP_FALSE,;t t
s,@GPROF_TRUE@,$GPROF_TRUE,;t t
diff --git a/elfutils/configure.ac b/elfutils/configure.ac
index 9d4c6ae3..06d44283 100644
--- a/elfutils/configure.ac
+++ b/elfutils/configure.ac
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
dnl Configure input file for elfutils. -*-autoconf-*-
dnl
-dnl Copyright (C) 1996-2002, 2003, 2004, 2005 Red Hat, Inc.
+dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
dnl
-AC_INIT([Red Hat elfutils],[0.120],[http://bugzilla.redhat.com/bugzilla/],
+AC_INIT([Red Hat elfutils],[0.123],[http://bugzilla.redhat.com/bugzilla/],
[elfutils])
AC_CONFIG_AUX_DIR([config])
@@ -108,6 +108,9 @@ dnl of files if at any time there is no such file, even if the filename
dnl would not be used.
AS_IF([test -z "$base_cpu"], [base_cpu=none])
AC_SUBST(base_cpu)
+dnl Support to work around automake's inflexible dependency generation.
+dnl See src/Makefile.am for more information.
+AM_CONDITIONAL(NEVER, false)
dnl Enable debugging via mudflap. This option will cause most libraries
dnl to be built as archives which are statically linked into the applications.
@@ -243,15 +246,13 @@ AH_BOTTOM([
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
#ifdef __i386__
-# define internal_function_def __attribute__ ((regparm (3), stdcall))
+# define internal_function __attribute__ ((regparm (3), stdcall))
#else
-# define internal_function_def /* nothing */
+# define internal_function /* nothing */
#endif
-# define internal_function \
- internal_function_def __attribute__ ((visibility ("internal")))
-# define internal_strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
+#define internal_strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
#define attribute_hidden \
__attribute__ ((visibility ("hidden")))
diff --git a/elfutils/elfutils.spec b/elfutils/elfutils.spec
index cf88d563..691eeea4 100644
--- a/elfutils/elfutils.spec
+++ b/elfutils/elfutils.spec
@@ -1,7 +1,7 @@
# -*- rpm-spec-*-
Summary: A collection of utilities and DSOs to handle compiled objects.
Name: elfutils
-Version: 0.120
+Version: 0.123
Release: 1
License: GPL
Group: Development/Tools
@@ -154,6 +154,29 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.so
%changelog
+* Mon Aug 14 2006 Roland McGrath <roland@redhat.com> 0.123-1
+- libebl: Backend build fixes, thanks to Stepan Kasal.
+- libebl: ia64 backend support for register names, return value location
+- libdwfl: Handle truncated linux kernel module section names.
+- libdwfl: Look for linux kernel vmlinux files with .debug suffix.
+- elflint: Fix checks to permit --hash-style=gnu format.
+
+* Wed Jul 12 2006 Ulrich Drepper <drepper@redhat.com> 0.122-1
+- libebl: add function to test for relative relocation
+- elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks
+- elflint, readelf: add support for DT_GNU_HASHlibelf: add elf_gnu_hash
+- elflint, readelf: add support for 64-bit SysV-style hash tables
+- libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym.
+
+* Wed Jun 14 2006 <drepper@redhat.com> 0.121-1
+- libelf: bug fixes for rewriting existing files when using mmap.
+- make all installed headers usable in C++ code.
+- readelf: better output format.
+- elflint: fix tests of dynamic section content.
+- ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patc
+hes.
+- libdw, libdwfl: handle files without aranges info.
+
* Tue Apr 4 2006 Ulrich Drepper <drepper@redhat.com> 0.120-1
- Bug fixes.
- dwarf.h updated for DWARF 3.0 final specification.
@@ -161,11 +184,6 @@ rm -rf ${RPM_BUILD_ROOT}
- The license is now GPL for most files. The libelf, libebl, libdw,and
libdwfl libraries have additional exceptions. Add reference toOIN.
-* Thu Mar 30 2006 Roland McGrath <roland@redhat.com> 0.120-1
-- Bug fixes.
-- dwarf.h updated for DWARF 3.0 final specification.
-- libdwfl: New function dwfl_version.
-
* Thu Jan 12 2006 Roland McGrath <roland@redhat.com> 0.119-1
- elflint: more tests.
- libdwfl: New function dwfl_module_register_names.
diff --git a/elfutils/lib/Makefile.in b/elfutils/lib/Makefile.in
index 0fb173eb..9bd19fb1 100644
--- a/elfutils/lib/Makefile.in
+++ b/elfutils/lib/Makefile.in
@@ -120,6 +120,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/libasm/Makefile.in b/elfutils/libasm/Makefile.in
index 1369b9f5..6db5babe 100644
--- a/elfutils/libasm/Makefile.in
+++ b/elfutils/libasm/Makefile.in
@@ -153,6 +153,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/libcpu/Makefile.in b/elfutils/libcpu/Makefile.in
index 4e788e19..2ef2937e 100644
--- a/elfutils/libcpu/Makefile.in
+++ b/elfutils/libcpu/Makefile.in
@@ -116,6 +116,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/libdw/ChangeLog b/elfutils/libdw/ChangeLog
index ac421ce0..69c160a2 100644
--- a/elfutils/libdw/ChangeLog
+++ b/elfutils/libdw/ChangeLog
@@ -1,3 +1,32 @@
+2006-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * dwarf_child.c: Adjust for internal_function_def removal.
+ * dwarf_getabbrev.c: Likewise.
+ * dwarf_tag.c: Likewise.
+ * libdw_form.c: Likewise.
+ * memory-access.c: Likewise.
+
+2006-06-28 Roland McGrath <roland@redhat.com>
+
+ * libdw.map: Export dwfl_linecu, dwfl_line_comp_dir.
+
+ * libdw.map: Bump to 0.122; export dwfl_module_getsymtab and
+ dwfl_module_getsym.
+
+2006-05-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libdw.h: Add extern "C".
+
+2006-05-22 Ulrich Drepper <drepper@redhat.com>
+
+ * dwarf_getaranges.c (dwarf_getaranges): Handle files without
+ aranges information.
+
+2006-05-21 Ulrich Drepper <drepper@redhat.com>
+
+ * libdw.h: Add nonnull attributes to dwarf_tag, dwarf_getattrs,
+ dwarf_haschildren.
+
2006-02-28 Roland McGrath <roland@redhat.com>
* dwarf.h: Add missing DW_ATE_*, DW_TAG_*, DW_LANG_*, DW_CFA_*,
diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in
index 1078473a..a117455e 100644
--- a/elfutils/libdw/Makefile.in
+++ b/elfutils/libdw/Makefile.in
@@ -193,6 +193,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/libdw/dwarf_child.c b/elfutils/libdw/dwarf_child.c
index 30151e81..42b38137 100644
--- a/elfutils/libdw/dwarf_child.c
+++ b/elfutils/libdw/dwarf_child.c
@@ -1,5 +1,5 @@
/* Return vhild of current DIE.
- Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -60,7 +60,7 @@
unsigned char *
-internal_function_def
+internal_function
__libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
unsigned int *codep, unsigned int *formp)
{
diff --git a/elfutils/libdw/dwarf_getabbrev.c b/elfutils/libdw/dwarf_getabbrev.c
index 7fdbf81c..07bf6dfc 100644
--- a/elfutils/libdw/dwarf_getabbrev.c
+++ b/elfutils/libdw/dwarf_getabbrev.c
@@ -1,5 +1,5 @@
/* Get abbreviation at given offset.
- Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -58,7 +58,7 @@
Dwarf_Abbrev *
-internal_function_def
+internal_function
__libdw_getabbrev (dbg, cu, offset, lengthp, result)
Dwarf *dbg;
struct Dwarf_CU *cu;
diff --git a/elfutils/libdw/dwarf_getaranges.c b/elfutils/libdw/dwarf_getaranges.c
index 61eb4f74..d2294ea3 100644
--- a/elfutils/libdw/dwarf_getaranges.c
+++ b/elfutils/libdw/dwarf_getaranges.c
@@ -1,5 +1,5 @@
/* Return list address ranges.
- Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -89,6 +89,15 @@ dwarf_getaranges (dbg, aranges, naranges)
return 0;
}
+ if (dbg->sectiondata[IDX_debug_aranges] == NULL)
+ {
+ /* No such section. */
+ *aranges = NULL;
+ if (naranges != NULL)
+ *naranges = 0;
+ return 0;
+ }
+
if (dbg->sectiondata[IDX_debug_aranges]->d_buf == NULL)
return -1;
diff --git a/elfutils/libdw/dwarf_tag.c b/elfutils/libdw/dwarf_tag.c
index 80d19510..05222821 100644
--- a/elfutils/libdw/dwarf_tag.c
+++ b/elfutils/libdw/dwarf_tag.c
@@ -1,5 +1,5 @@
/* Return tag of given DIE.
- Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -56,7 +56,7 @@
Dwarf_Abbrev *
-internal_function_def
+internal_function
__libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code)
{
Dwarf_Abbrev *abb;
diff --git a/elfutils/libdw/libdw.h b/elfutils/libdw/libdw.h
index f3ab3ae5..0758a38d 100644
--- a/elfutils/libdw/libdw.h
+++ b/elfutils/libdw/libdw.h
@@ -1,7 +1,6 @@
/* Interfaces for libdw.
- Copyright (C) 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
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
@@ -194,6 +193,10 @@ typedef void (*__attribute__ ((noreturn)) Dwarf_OOM) (void);
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Create a handle for a new debug session. */
extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd);
@@ -237,22 +240,23 @@ extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
/* Return child of current DIE. */
extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
- __nonnull_attribute__ (2);
+ __nonnull_attribute__ (1, 2);
/* Return sibling of given DIE. */
extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
__nonnull_attribute__ (2);
/* Check whether the DIE has children. */
-extern int dwarf_haschildren (Dwarf_Die *die);
+extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1);
/* Get attributes of the DIE. */
extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die,
int (*callback) (Dwarf_Attribute *, void *),
- void *arg, ptrdiff_t offset);
+ void *arg, ptrdiff_t offset)
+ __nonnull_attribute__ (2);
/* Return tag of given DIE. */
-extern int dwarf_tag (Dwarf_Die *die);
+extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1);
/* Return specific attribute of DIE. */
@@ -625,4 +629,8 @@ dwarf_whatform (Dwarf_Attribute *attr)
}
#endif /* Optimize. */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* libdw.h */
diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map
index 08b01982..6ee42ece 100644
--- a/elfutils/libdw/libdw.map
+++ b/elfutils/libdw/libdw.map
@@ -1,5 +1,5 @@
ELFUTILS_0 { };
-ELFUTILS_0.120 {
+ELFUTILS_0.122 {
global:
dwarf_abbrevhaschildren;
dwarf_addrdie;
@@ -104,6 +104,8 @@ ELFUTILS_0.120 {
dwfl_getmodules;
dwfl_getsrc;
dwfl_getsrclines;
+ dwfl_line_comp_dir;
+ dwfl_linecu;
dwfl_lineinfo;
dwfl_linemodule;
dwfl_linux_kernel_find_elf;
@@ -112,14 +114,16 @@ ELFUTILS_0.120 {
dwfl_linux_kernel_report_modules;
dwfl_linux_kernel_report_offline;
dwfl_linux_proc_find_elf;
- dwfl_linux_proc_report;
dwfl_linux_proc_maps_report;
+ dwfl_linux_proc_report;
dwfl_module_addrdie;
dwfl_module_addrname;
dwfl_module_getdwarf;
dwfl_module_getelf;
dwfl_module_getsrc;
dwfl_module_getsrc_file;
+ dwfl_module_getsym;
+ dwfl_module_getsymtab;
dwfl_module_info;
dwfl_module_nextcu;
dwfl_module_register_names;
diff --git a/elfutils/libdw/libdw_form.c b/elfutils/libdw/libdw_form.c
index bf76fcda..779b6c0e 100644
--- a/elfutils/libdw/libdw_form.c
+++ b/elfutils/libdw/libdw_form.c
@@ -1,5 +1,5 @@
/* Helper functions for form handling.
- Copyright (C) 2003, 2004 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -59,7 +59,7 @@
size_t
-internal_function_def
+internal_function
__libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form,
const unsigned char *valp)
{
diff --git a/elfutils/libdw/memory-access.c b/elfutils/libdw/memory-access.c
index 0b361a03..c9a0ca76 100644
--- a/elfutils/libdw/memory-access.c
+++ b/elfutils/libdw/memory-access.c
@@ -1,5 +1,5 @@
/* Out of line functions for memory-access.h macros.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@
#include "memory-access.h"
uint64_t
-internal_function_def
+internal_function
__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
{
unsigned char __b;
@@ -62,7 +62,7 @@ __libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
}
int64_t
-internal_function_def
+internal_function
__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
{
unsigned char __b;
diff --git a/elfutils/libdwfl/ChangeLog b/elfutils/libdwfl/ChangeLog
index 1f75d6bf..0e3ac136 100644
--- a/elfutils/libdwfl/ChangeLog
+++ b/elfutils/libdwfl/ChangeLog
@@ -1,3 +1,88 @@
+2006-08-14 Roland McGrath <roland@redhat.com>
+
+ * linux-kernel-modules.c (try_kernel_name): If the call to
+ dwfl_standard_find_debuginfo produces no results, try it again
+ with NULL as DEBUGLINK_FILE to try *FNAME with .debug suffix.
+
+ * find-debuginfo.c (DEFAULT_DEBUGINFO_PATH): Macro moved ...
+ * libdwflP.h: ... to here.
+ * linux-kernel-modules.c (try_kernel_name): Skip manual open if it
+ repeats the first thing dwfl_standard_find_debuginfo will try.
+
+ * linux-kernel-modules.c (MODULE_SECT_NAME_LEN): New macro.
+ (dwfl_linux_kernel_module_section_address): If a /sys file is missing
+ and the section name is >= MODULE_SECT_NAME_LEN, try truncating the
+ section name.
+
+2006-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * cu.c: Adjust for internal_function_def removal.
+ * dwfl_error.c: Likewise.
+ * dwfl_module.c: Likewise.
+ * dwfl_module_getdwarf.c: Likewise.
+ * lines.c: Likewise.
+ * relocate.c: Likewise.
+
+2006-07-11 Ulrich Drepper <drepper@redhat.com>
+
+ * dwfl_module.c (compare_modules): Don't return GElf_Sxword value,
+ it can overflow the return value type.
+ Patch by Tim Moore <timoore@redhat.com>.
+
+2006-06-28 Roland McGrath <roland@redhat.com>
+
+ * libdwfl.h: Cosmetic changes.
+
+ * dwfl_line_comp_dir.c: New file.
+ * Makefile.am (libdwfl_a_SOURCES): Add it.
+ * libdwfl.h: Declare dwfl_line_comp_dir.
+
+ * dwfl_lineinfo.c (dwfl_lineinfo): Remove stray extern in defn.
+
+ * dwfl_linecu.c: New file.
+ * Makefile.am (libdwfl_a_SOURCES): Add it.
+ * libdwfl.h: Declare dwfl_linecu.
+
+ * libdwflP.h (dwfl_linecu_inline): Function renamed from dwfl_linecu.
+ (dwfl_linecu): Define as macro.
+
+ * relocate.c (__libdwfl_relocate): Use dwfl_module_getsym.
+
+ * dwfl_module_getdwarf.c (dwfl_module_getsymtab): New function.
+ (dwfl_module_addrname): Function moved ...
+ * dwfl_module_addrname.c: ... here, new file.
+ * dwfl_module_getsym.c: New file.
+ * Makefile.am (libdwfl_a_SOURCES): Add them.
+ * libdwfl.h: Declare dwfl_module_getsymtab, dwfl_module_getsym.
+ * libdwflP.h: Add INTDECLs.
+
+2006-06-27 Roland McGrath <roland@redhat.com>
+
+ * dwfl_module.c (dwfl_report_end): Whitespace fix.
+
+2006-06-13 Roland McGrath <roland@redhat.com>
+
+ * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo.
+ Use __libdwfl_seterrno for elf_memory failure.
+
+2006-05-22 Roland McGrath <roland@redhat.com>
+
+ * dwfl_module_return_value_location.c
+ (dwfl_module_return_value_location): Use __libdwfl_module_getebl.
+
+2006-05-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libdwfl.h: Add extern "C".
+
+2006-05-22 Ulrich Drepper <drepper@redhat.com>
+
+ * cu.c (addrarange): Handle files without aranges information.
+
+2006-05-16 Ulrich Drepper <drepper@redhat.com>
+
+ * dwfl_addrmodule.c (dwfl_addrmodule): Also return NULL of
+ ->modules is NULL.
+
2006-02-26 Roland McGrath <roland@redhat.com>
* dwfl_version.c: New file.
diff --git a/elfutils/libdwfl/Makefile.am b/elfutils/libdwfl/Makefile.am
index 4583ed63..ee9efec9 100644
--- a/elfutils/libdwfl/Makefile.am
+++ b/elfutils/libdwfl/Makefile.am
@@ -59,12 +59,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
dwfl_addrmodule.c dwfl_addrdwarf.c \
cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
dwfl_module_addrdie.c dwfl_addrdie.c \
- lines.c dwfl_lineinfo.c dwfl_linemodule.c \
+ lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \
+ dwfl_linemodule.c dwfl_linecu.c \
dwfl_getsrclines.c dwfl_onesrcline.c \
dwfl_module_getsrc.c dwfl_getsrc.c \
dwfl_module_getsrc_file.c \
libdwfl_crc32.c libdwfl_crc32_file.c \
elf-from-memory.c \
+ dwfl_module_getsym.c dwfl_module_addrname.c \
dwfl_module_return_value_location.c \
dwfl_module_register_names.c
diff --git a/elfutils/libdwfl/Makefile.in b/elfutils/libdwfl/Makefile.in
index 960c90e7..2861c199 100644
--- a/elfutils/libdwfl/Makefile.in
+++ b/elfutils/libdwfl/Makefile.in
@@ -68,11 +68,13 @@ am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJEXT) dwfl_end.$(OBJEXT) \
dwfl_module_nextcu.$(OBJEXT) dwfl_nextcu.$(OBJEXT) \
dwfl_cumodule.$(OBJEXT) dwfl_module_addrdie.$(OBJEXT) \
dwfl_addrdie.$(OBJEXT) lines.$(OBJEXT) dwfl_lineinfo.$(OBJEXT) \
- dwfl_linemodule.$(OBJEXT) dwfl_getsrclines.$(OBJEXT) \
+ dwfl_line_comp_dir.$(OBJEXT) dwfl_linemodule.$(OBJEXT) \
+ dwfl_linecu.$(OBJEXT) dwfl_getsrclines.$(OBJEXT) \
dwfl_onesrcline.$(OBJEXT) dwfl_module_getsrc.$(OBJEXT) \
dwfl_getsrc.$(OBJEXT) dwfl_module_getsrc_file.$(OBJEXT) \
libdwfl_crc32.$(OBJEXT) libdwfl_crc32_file.$(OBJEXT) \
- elf-from-memory.$(OBJEXT) \
+ elf-from-memory.$(OBJEXT) dwfl_module_getsym.$(OBJEXT) \
+ dwfl_module_addrname.$(OBJEXT) \
dwfl_module_return_value_location.$(OBJEXT) \
dwfl_module_register_names.$(OBJEXT)
libdwfl_a_OBJECTS = $(am_libdwfl_a_OBJECTS)
@@ -151,6 +153,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -234,12 +238,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
dwfl_addrmodule.c dwfl_addrdwarf.c \
cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
dwfl_module_addrdie.c dwfl_addrdie.c \
- lines.c dwfl_lineinfo.c dwfl_linemodule.c \
+ lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \
+ dwfl_linemodule.c dwfl_linecu.c \
dwfl_getsrclines.c dwfl_onesrcline.c \
dwfl_module_getsrc.c dwfl_getsrc.c \
dwfl_module_getsrc_file.c \
libdwfl_crc32.c libdwfl_crc32_file.c \
elf-from-memory.c \
+ dwfl_module_getsym.c dwfl_module_addrname.c \
dwfl_module_return_value_location.c \
dwfl_module_register_names.c
@@ -321,13 +327,17 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getmodules.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getsrc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getsrclines.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_line_comp_dir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_linecu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_lineinfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_linemodule.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrdie.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getdwarf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsym.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_nextcu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_register_names.Po@am__quote@
diff --git a/elfutils/libdwfl/cu.c b/elfutils/libdwfl/cu.c
index e8dbf329..8f01ea6b 100644
--- a/elfutils/libdwfl/cu.c
+++ b/elfutils/libdwfl/cu.c
@@ -1,5 +1,5 @@
/* Keeping track of DWARF compilation units in libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -65,32 +65,38 @@ addrarange (Dwfl_Module *mod, Dwarf_Addr addr, struct dwfl_arange **arange)
{
if (mod->aranges == NULL)
{
- Dwarf_Aranges *dwaranges;
- if (INTUSE(dwarf_getaranges) (mod->dw, &dwaranges, NULL) != 0)
+ struct dwfl_arange *aranges = NULL;
+ Dwarf_Aranges *dwaranges = NULL;
+ size_t naranges;
+ if (INTUSE(dwarf_getaranges) (mod->dw, &dwaranges, &naranges) != 0)
return DWFL_E_LIBDW;
- struct dwfl_arange *aranges = malloc (dwaranges->naranges
- * sizeof *aranges);
- if (unlikely (aranges == NULL))
- return DWFL_E_NOMEM;
-
- /* libdw has sorted its list by address, which is how we want it.
- But the sorted list is full of not-quite-contiguous runs pointing
- to the same CU. We don't care about the little gaps inside the
- module, we'll consider them part of the surrounding CU anyway.
- Collect our own array with just one record for each run of ranges
- pointing to one CU. */
-
- size_t naranges = 0;
- Dwarf_Off lastcu = 0;
- for (size_t i = 0; i < dwaranges->naranges; ++i)
- if (i == 0 || dwaranges->info[i].offset != lastcu)
- {
- aranges[naranges].arange = i;
- aranges[naranges].cu = NULL;
- ++naranges;
- lastcu = dwaranges->info[i].offset;
- }
+ /* If the module has no aranges (when no code is included) we
+ allocate nothing. */
+ if (naranges != 0)
+ {
+ aranges = malloc (naranges * sizeof *aranges);
+ if (unlikely (aranges == NULL))
+ return DWFL_E_NOMEM;
+
+ /* libdw has sorted its list by address, which is how we want it.
+ But the sorted list is full of not-quite-contiguous runs pointing
+ to the same CU. We don't care about the little gaps inside the
+ module, we'll consider them part of the surrounding CU anyway.
+ Collect our own array with just one record for each run of ranges
+ pointing to one CU. */
+
+ naranges = 0;
+ Dwarf_Off lastcu = 0;
+ for (size_t i = 0; i < dwaranges->naranges; ++i)
+ if (i == 0 || dwaranges->info[i].offset != lastcu)
+ {
+ aranges[naranges].arange = i;
+ aranges[naranges].cu = NULL;
+ ++naranges;
+ lastcu = dwaranges->info[i].offset;
+ }
+ }
/* Store the final array, which is probably much smaller than before. */
mod->naranges = naranges;
@@ -242,7 +248,7 @@ intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
/* Traverse all the CUs in the module. */
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
struct dwfl_cu **cu)
{
@@ -309,7 +315,7 @@ arangecu (Dwfl_Module *mod, struct dwfl_arange *arange, struct dwfl_cu **cu)
}
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_addrcu (Dwfl_Module *mod, Dwarf_Addr addr, struct dwfl_cu **cu)
{
struct dwfl_arange *arange;
diff --git a/elfutils/libdwfl/dwfl_addrmodule.c b/elfutils/libdwfl/dwfl_addrmodule.c
index bd95a87f..98c4b39f 100644
--- a/elfutils/libdwfl/dwfl_addrmodule.c
+++ b/elfutils/libdwfl/dwfl_addrmodule.c
@@ -1,5 +1,5 @@
/* Find module containing address.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -52,7 +52,7 @@
Dwfl_Module *
dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address)
{
- if (dwfl == NULL)
+ if (dwfl == NULL || dwfl->modules == NULL)
return NULL;
/* Do binary search on the array indexed by module load address. */
diff --git a/elfutils/libdwfl/dwfl_error.c b/elfutils/libdwfl/dwfl_error.c
index 891fbf71..414fbaf4 100644
--- a/elfutils/libdwfl/dwfl_error.c
+++ b/elfutils/libdwfl/dwfl_error.c
@@ -1,5 +1,5 @@
/* Error handling in libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -162,14 +162,14 @@ canonicalize (Dwfl_Error error)
}
int
-internal_function_def
+internal_function
__libdwfl_canon_error (Dwfl_Error error)
{
return canonicalize (error);
}
void
-internal_function_def
+internal_function
__libdwfl_seterrno (Dwfl_Error error)
{
int value = canonicalize (error);
diff --git a/elfutils/libdwfl/dwfl_line_comp_dir.c b/elfutils/libdwfl/dwfl_line_comp_dir.c
new file mode 100644
index 00000000..a755524d
--- /dev/null
+++ b/elfutils/libdwfl/dwfl_line_comp_dir.c
@@ -0,0 +1,64 @@
+/* Get information from a source line record returned by libdwfl.
+ Copyright (C) 2005, 2006 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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>. */
+
+#include "libdwflP.h"
+#include <dwarf.h>
+
+const char *
+dwfl_line_comp_dir (Dwfl_Line *line)
+{
+ if (line == NULL)
+ return NULL;
+
+ struct dwfl_cu *cu = dwfl_linecu (line);
+ Dwarf_Attribute attr_mem;
+ return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr) (&cu->die,
+ DW_AT_comp_dir,
+ &attr_mem));
+}
diff --git a/elfutils/libdwfl/dwfl_linecu.c b/elfutils/libdwfl/dwfl_linecu.c
new file mode 100644
index 00000000..34f5bb10
--- /dev/null
+++ b/elfutils/libdwfl/dwfl_linecu.c
@@ -0,0 +1,62 @@
+/* Fetch the module containing a source line record returned by libdwfl.
+ Copyright (C) 2006 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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>. */
+
+#include "libdwflP.h"
+
+#undef dwfl_linecu
+
+Dwarf_Die *
+dwfl_linecu (Dwfl_Line *line)
+{
+ if (line == NULL)
+ return NULL;
+
+ struct dwfl_cu *cu = dwfl_linecu_inline (line);
+ return &cu->die;
+}
diff --git a/elfutils/libdwfl/dwfl_lineinfo.c b/elfutils/libdwfl/dwfl_lineinfo.c
index 9fd343b6..0d8a6887 100644
--- a/elfutils/libdwfl/dwfl_lineinfo.c
+++ b/elfutils/libdwfl/dwfl_lineinfo.c
@@ -1,5 +1,5 @@
/* Get information from a source line record returned by libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -50,7 +50,7 @@
#include "libdwflP.h"
#include "../libdw/libdwP.h"
-extern const char *
+const char *
dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp,
Dwarf_Word *mtime, Dwarf_Word *length)
{
diff --git a/elfutils/libdwfl/dwfl_module.c b/elfutils/libdwfl/dwfl_module.c
index 022bfea1..3ccf8b16 100644
--- a/elfutils/libdwfl/dwfl_module.c
+++ b/elfutils/libdwfl/dwfl_module.c
@@ -1,5 +1,5 @@
/* Maintenance of module list in libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -64,7 +64,7 @@ nofree (void *arg __attribute__ ((unused)))
}
void
-internal_function_def
+internal_function
__libdwfl_module_free (Dwfl_Module *mod)
{
if (mod->lazy_cu_root != NULL)
@@ -161,6 +161,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name,
}
INTDEF (dwfl_report_module)
+
static int
compare_modules (const void *a, const void *b)
{
@@ -170,7 +171,13 @@ compare_modules (const void *a, const void *b)
return -1;
if (m2 == NULL)
return 1;
- return (GElf_Sxword) (m1->low_addr - m2->low_addr);
+
+ GElf_Sxword diff = m1->low_addr - m2->low_addr;
+ if (diff < 0)
+ return -1;
+ if (diff > 0)
+ return 1;
+ return 0;
}
@@ -179,11 +186,12 @@ compare_modules (const void *a, const void *b)
existed before but was not included in the current report.
Returns a nonzero return value from the callback.
DWFL cannot be used until this function has returned zero. */
-int dwfl_report_end (Dwfl *dwfl,
- int (*removed) (Dwfl_Module *, void *,
- const char *, Dwarf_Addr,
- void *arg),
- void *arg)
+int
+dwfl_report_end (Dwfl *dwfl,
+ int (*removed) (Dwfl_Module *, void *,
+ const char *, Dwarf_Addr,
+ void *arg),
+ void *arg)
{
assert (dwfl->modules == NULL);
diff --git a/elfutils/libdwfl/dwfl_module_addrname.c b/elfutils/libdwfl/dwfl_module_addrname.c
new file mode 100644
index 00000000..19b4c2d3
--- /dev/null
+++ b/elfutils/libdwfl/dwfl_module_addrname.c
@@ -0,0 +1,70 @@
+/* Find debugging and symbol information for a module in libdwfl.
+ Copyright (C) 2005, 2006 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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>. */
+
+#include "libdwflP.h"
+
+const char *
+dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr addr)
+{
+ int syments = INTUSE(dwfl_module_getsymtab) (mod);
+ if (syments < 0)
+ return NULL;
+
+ /* Look through the symbol table for a matching symbol. */
+ for (int i = 1; i < syments; ++i)
+ {
+ GElf_Sym sym;
+ const char *name = INTUSE(dwfl_module_getsym) (mod, i, &sym, NULL);
+ if (name != NULL
+ && sym.st_value <= addr && addr < sym.st_value + sym.st_size)
+ return name;
+ }
+
+ return NULL;
+}
diff --git a/elfutils/libdwfl/dwfl_module_getdwarf.c b/elfutils/libdwfl/dwfl_module_getdwarf.c
index 56a40fa6..07248bf7 100644
--- a/elfutils/libdwfl/dwfl_module_getdwarf.c
+++ b/elfutils/libdwfl/dwfl_module_getdwarf.c
@@ -1,5 +1,5 @@
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -319,7 +319,7 @@ find_symtab (Dwfl_Module *mod)
/* Try to open a libebl backend for MOD. */
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_module_getebl (Dwfl_Module *mod)
{
if (mod->ebl == NULL)
@@ -471,77 +471,17 @@ dwfl_module_getdwarf (Dwfl_Module *mod, Dwarf_Addr *bias)
}
INTDEF (dwfl_module_getdwarf)
-
-const char *
-dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr addr)
+int
+dwfl_module_getsymtab (Dwfl_Module *mod)
{
if (mod == NULL)
- return NULL;
+ return -1;
find_symtab (mod);
- if (mod->symerr != DWFL_E_NOERROR)
- {
- __libdwfl_seterrno (mod->symerr);
- return NULL;
- }
-
- addr -= mod->symfile->bias;
+ if (mod->symerr == DWFL_E_NOERROR)
+ return mod->syments;
- /* Look through the symbol table for a matching symbol. */
- size_t symshstrndx = SHN_UNDEF;
- for (size_t i = 1; i < mod->syments; ++i)
- {
- GElf_Sym sym_mem;
- GElf_Word shndx;
- GElf_Sym *sym = gelf_getsymshndx (mod->symdata, mod->symxndxdata,
- i, &sym_mem, &shndx);
- if (sym != NULL)
- {
- GElf_Addr symaddr = sym->st_value;
-
- if (sym->st_shndx != SHN_XINDEX)
- shndx = sym->st_shndx;
-
- if (mod->e_type == ET_REL)
- /* In an ET_REL file, the symbol table values are relative
- to the section, not to the module's load base. */
- switch (shndx)
- {
- case SHN_UNDEF: /* Undefined symbol can't match an address. */
- case SHN_COMMON: /* Nor can a common defn. */
- continue;
-
- case SHN_ABS: /* Symbol value is already absolute. */
- break;
-
- default:
- {
- Dwfl_Error result = DWFL_E_LIBELF;
- if (likely (symshstrndx != SHN_UNDEF)
- || elf_getshstrndx (mod->symfile->elf,
- &symshstrndx) == 0)
- result = __libdwfl_relocate_value (mod, symshstrndx,
- shndx, &symaddr);
- if (unlikely (result != DWFL_E_NOERROR))
- {
- __libdwfl_seterrno (result);
- return NULL;
- }
- break;
- }
- }
-
- if (symaddr <= addr && addr < symaddr + sym->st_size)
- {
- if (unlikely (sym->st_name >= mod->symstrdata->d_size))
- {
- __libdwfl_seterrno (DWFL_E_BADSTROFF);
- return NULL;
- }
- return (const char *) mod->symstrdata->d_buf + sym->st_name;
- }
- }
- }
-
- return NULL;
+ __libdwfl_seterrno (mod->symerr);
+ return -1;
}
+INTDEF (dwfl_module_getsymtab)
diff --git a/elfutils/libdwfl/dwfl_module_getsym.c b/elfutils/libdwfl/dwfl_module_getsym.c
new file mode 100644
index 00000000..0c076e87
--- /dev/null
+++ b/elfutils/libdwfl/dwfl_module_getsym.c
@@ -0,0 +1,116 @@
+/* Find debugging and symbol information for a module in libdwfl.
+ Copyright (C) 2006 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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>. */
+
+#include "libdwflP.h"
+
+const char *
+dwfl_module_getsym (Dwfl_Module *mod, int ndx,
+ GElf_Sym *sym, GElf_Word *shndxp)
+{
+ if (unlikely (mod == NULL))
+ return NULL;
+
+ if (unlikely (mod->symdata == NULL))
+ {
+ int result = INTUSE(dwfl_module_getsymtab) (mod);
+ if (result < 0)
+ return NULL;
+ }
+
+ GElf_Word shndx;
+ sym = gelf_getsymshndx (mod->symdata, mod->symxndxdata, ndx, sym, &shndx);
+ if (unlikely (sym == NULL))
+ {
+ __libdwfl_seterrno (DWFL_E_LIBELF);
+ return NULL;
+ }
+
+ if (sym->st_shndx != SHN_XINDEX)
+ shndx = sym->st_shndx;
+
+ if (shndxp != NULL)
+ *shndxp = shndx;
+
+ switch (shndx)
+ {
+ case SHN_ABS:
+ case SHN_UNDEF:
+ case SHN_COMMON:
+ break;
+
+ default:
+ if (mod->e_type != ET_REL)
+ /* Apply the bias to the symbol value. */
+ sym->st_value += mod->symfile->bias;
+ else
+ {
+ /* In an ET_REL file, the symbol table values are relative
+ to the section, not to the module's load base. */
+ size_t symshstrndx;
+ Dwfl_Error result = DWFL_E_LIBELF;
+ if (elf_getshstrndx (mod->symfile->elf, &symshstrndx) == 0)
+ result = __libdwfl_relocate_value (mod, symshstrndx,
+ shndx, &sym->st_value);
+ if (unlikely (result != DWFL_E_NOERROR))
+ {
+ __libdwfl_seterrno (result);
+ return NULL;
+ }
+ }
+ break;
+ }
+
+ if (unlikely (sym->st_name >= mod->symstrdata->d_size))
+ {
+ __libdwfl_seterrno (DWFL_E_BADSTROFF);
+ return NULL;
+ }
+ return (const char *) mod->symstrdata->d_buf + sym->st_name;
+}
+INTDEF (dwfl_module_getsym)
diff --git a/elfutils/libdwfl/dwfl_module_return_value_location.c b/elfutils/libdwfl/dwfl_module_return_value_location.c
index 91493351..3d5154e2 100644
--- a/elfutils/libdwfl/dwfl_module_return_value_location.c
+++ b/elfutils/libdwfl/dwfl_module_return_value_location.c
@@ -1,5 +1,5 @@
/* Return location expression to find return value given a function type DIE.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -61,10 +61,10 @@ dwfl_module_return_value_location (mod, functypedie, locops)
if (mod->ebl == NULL)
{
- mod->ebl = ebl_openbackend (mod->main.elf);
- if (mod->ebl == NULL)
+ Dwfl_Error error = __libdwfl_module_getebl (mod);
+ if (error != DWFL_E_NOERROR)
{
- __libdwfl_seterrno (DWFL_E_LIBEBL);
+ __libdwfl_seterrno (error);
return -1;
}
}
diff --git a/elfutils/libdwfl/elf-from-memory.c b/elfutils/libdwfl/elf-from-memory.c
index 90a0c4d8..2a174759 100644
--- a/elfutils/libdwfl/elf-from-memory.c
+++ b/elfutils/libdwfl/elf-from-memory.c
@@ -1,5 +1,5 @@
/* Reconstruct an ELF file by reading the segments out of remote memory.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -338,7 +338,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
xlatefrom.d_size = xlateto.d_size = sizeof ehdr.e64;
xlatefrom.d_buf = &ehdr.e64;
xlateto.d_buf = buffer;
- if (elf32_xlatetof (&xlateto, &xlatefrom,
+ if (elf64_xlatetof (&xlateto, &xlatefrom,
ehdr.e64.e_ident[EI_DATA]) == NULL)
goto libelf_error;
break;
@@ -354,7 +354,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
if (elf == NULL)
{
free (buffer);
- return NULL;
+ goto libelf_error;
}
elf->flags |= ELF_F_MALLOCED;
diff --git a/elfutils/libdwfl/find-debuginfo.c b/elfutils/libdwfl/find-debuginfo.c
index 4baf5fa8..a99fd144 100644
--- a/elfutils/libdwfl/find-debuginfo.c
+++ b/elfutils/libdwfl/find-debuginfo.c
@@ -1,5 +1,5 @@
/* Standard find_debuginfo callback for libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -54,9 +54,6 @@
#include "system.h"
-#define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug"
-
-
/* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1.
On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file. */
static int
diff --git a/elfutils/libdwfl/libdwfl.h b/elfutils/libdwfl/libdwfl.h
index 07cf9b09..ce85a6bb 100644
--- a/elfutils/libdwfl/libdwfl.h
+++ b/elfutils/libdwfl/libdwfl.h
@@ -82,13 +82,17 @@ typedef struct
int (*section_address) (Dwfl_Module *mod, void **userdata,
const char *modname, Dwarf_Addr base,
const char *secname,
- Elf32_Word shndx, const GElf_Shdr *shdr,
+ GElf_Word shndx, const GElf_Shdr *shdr,
Dwarf_Addr *addr);
char **debuginfo_path; /* See dwfl_standard_find_debuginfo. */
} Dwfl_Callbacks;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Start a new session with the library. */
extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks);
@@ -175,6 +179,9 @@ extern ptrdiff_t dwfl_getmodules (Dwfl *dwfl,
void *arg,
ptrdiff_t offset);
+/* Find the module containing the given address. */
+extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address);
+
/*** Standard callbacks ***/
@@ -207,7 +214,7 @@ extern int dwfl_standard_find_debuginfo (Dwfl_Module *, void **,
if ET_REL is to be supported. */
extern int dwfl_offline_section_address (Dwfl_Module *, void **,
const char *, Dwarf_Addr,
- const char *, Elf32_Word,
+ const char *, GElf_Word,
const GElf_Shdr *,
Dwarf_Addr *addr);
@@ -218,7 +225,7 @@ extern int dwfl_linux_kernel_find_elf (Dwfl_Module *, void **,
char **, Elf **);
extern int dwfl_linux_kernel_module_section_address (Dwfl_Module *, void **,
const char *, Dwarf_Addr,
- const char *, Elf32_Word,
+ const char *, GElf_Word,
const GElf_Shdr *,
Dwarf_Addr *addr);
@@ -288,7 +295,7 @@ extern int dwfl_module_relocate_address (Dwfl_Module *mod,
Returns null for errors. */
extern const char *dwfl_module_relocation_info (Dwfl_Module *mod,
unsigned int idx,
- Elf32_Word *shndxp);
+ GElf_Word *shndxp);
/* Validate that ADDRESS and ADDRESS+OFFSET lie in a known module
and both within the same contiguous region for relocation purposes.
@@ -297,10 +304,7 @@ extern int dwfl_validate_address (Dwfl *dwfl,
Dwarf_Addr address, Dwarf_Sword offset);
-/*** Dwarf access functions ***/
-
-/* Find the module containing the given address. */
-extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address);
+/*** ELF access functions ***/
/* Fetch the module main ELF file (where the allocated sections
are found) for use with libelf. If successful, fills in *BIAS
@@ -308,6 +312,26 @@ extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address);
and those in symbol tables or Dwarf information referring to it. */
extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias);
+/* Return the number of symbols in the module's symbol table,
+ or -1 for errors. */
+extern int dwfl_module_getsymtab (Dwfl_Module *mod);
+
+/* Fetch one entry from the module's symbol table. On errors, returns
+ NULL. If successful, fills in *SYM and returns the string for st_name.
+ This works like gelf_getsym except that st_value is always adjusted
+ to an absolute value based on the module's location. If SHNDXP is
+ non-null, it's set with the section index (whether from st_shndx or
+ extended index table). */
+extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx,
+ GElf_Sym *sym, GElf_Word *shndxp)
+ __nonnull_attribute__ (3);
+
+/* Find the symbol that ADDRESS lies inside, and return its name. */
+extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address);
+
+
+/*** Dwarf access functions ***/
+
/* Fetch the module's debug information for use with libdw.
If successful, fills in *BIAS with the difference between
addresses within the loaded module and those to use with libdw. */
@@ -364,17 +388,20 @@ extern int dwfl_module_getsrc_file (Dwfl_Module *mod,
/* Return the module containing this line record. */
extern Dwfl_Module *dwfl_linemodule (Dwfl_Line *line);
+/* Return the CU containing this line record. */
+extern Dwarf_Die *dwfl_linecu (Dwfl_Line *line);
+
/* Return the source file name and fill in other information.
Arguments may be null for unneeded fields. */
extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr,
int *linep, int *colp,
Dwarf_Word *mtime, Dwarf_Word *length);
-
-/* Find the symbol that ADDRESS lies inside, and return its name. */
-extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address);
+/* Return the compilation directory (AT_comp_dir) from this line's CU. */
+extern const char *dwfl_line_comp_dir (Dwfl_Line *line);
+/*** Machine backend access functions ***/
/* Return location expression to find return value given a
DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing
@@ -403,4 +430,8 @@ extern int dwfl_module_register_names (Dwfl_Module *mod,
void *arg);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* libdwfl.h */
diff --git a/elfutils/libdwfl/libdwflP.h b/elfutils/libdwfl/libdwflP.h
index bc798fa1..31da938d 100644
--- a/elfutils/libdwfl/libdwflP.h
+++ b/elfutils/libdwfl/libdwflP.h
@@ -1,5 +1,5 @@
/* Internal definitions for libdwfl.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -144,7 +144,7 @@ struct Dwfl_Module
struct dwfl_file *symfile; /* Either main or debug. */
Elf_Data *symdata; /* Data in the ELF symbol table section. */
size_t syments; /* sh_size / sh_entsize of that section. */
- const Elf_Data *symstrdata; /* Data for its string table. */
+ Elf_Data *symstrdata; /* Data for its string table. */
Elf_Data *symxndxdata; /* Data in the extended section index table. */
Dwfl_Error symerr; /* Previous failure to load symbols. */
@@ -198,13 +198,14 @@ struct Dwfl_Lines
};
static inline struct dwfl_cu *
-dwfl_linecu (const Dwfl_Line *line)
+dwfl_linecu_inline (const Dwfl_Line *line)
{
const struct Dwfl_Lines *lines = ((const void *) line
- offsetof (struct Dwfl_Lines,
idx[line->idx]));
return lines->cu;
}
+#define dwfl_linecu dwfl_linecu_inline
/* This describes a contiguous address range that lies in a single CU.
We condense runs of Dwarf_Arange entries for the same CU into this. */
@@ -270,6 +271,8 @@ INTDECL (dwfl_addrdie)
INTDECL (dwfl_module_addrdie)
INTDECL (dwfl_module_getdwarf)
INTDECL (dwfl_module_getelf)
+INTDECL (dwfl_module_getsym)
+INTDECL (dwfl_module_getsymtab)
INTDECL (dwfl_module_getsrc)
INTDECL (dwfl_report_elf)
INTDECL (dwfl_report_begin)
@@ -293,4 +296,8 @@ INTDECL (dwfl_module_relocate_address)
#define CBFAIL (errno ? DWFL_E (ERRNO, errno) : DWFL_E_CB);
+/* The default used by dwfl_standard_find_debuginfo. */
+#define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug"
+
+
#endif /* libdwflP.h */
diff --git a/elfutils/libdwfl/lines.c b/elfutils/libdwfl/lines.c
index 49005a0d..ed4267fc 100644
--- a/elfutils/libdwfl/lines.c
+++ b/elfutils/libdwfl/lines.c
@@ -1,5 +1,5 @@
/* Fetch source line info for CU.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -51,7 +51,7 @@
#include "../libdw/libdwP.h"
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_cu_getsrclines (struct dwfl_cu *cu)
{
if (cu->lines == NULL)
diff --git a/elfutils/libdwfl/linux-kernel-modules.c b/elfutils/libdwfl/linux-kernel-modules.c
index a91d732c..4d4194a5 100644
--- a/elfutils/libdwfl/linux-kernel-modules.c
+++ b/elfutils/libdwfl/linux-kernel-modules.c
@@ -1,5 +1,5 @@
/* Standard libdwfl callbacks for debugging the running Linux kernel.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -66,7 +66,8 @@
#define MODULEDIRFMT "/lib/modules/%s"
#define MODULELIST "/proc/modules"
-#define SECADDRFMT "/sys/module/%s/sections/%s"
+#define SECADDRDIRFMT "/sys/module/%s/sections/"
+#define MODULE_SECT_NAME_LEN 32 /* Minimum any linux/module.h has had. */
/* Try to open the given file as it is or under the debuginfo directory. */
@@ -76,14 +77,27 @@ try_kernel_name (Dwfl *dwfl, char **fname)
if (*fname == NULL)
return -1;
- int fd = TEMP_FAILURE_RETRY (open64 (*fname, O_RDONLY));
+ /* Don't bother trying *FNAME itself here if the path will cause it to be
+ tried because we give its own basename as DEBUGLINK_FILE. */
+ int fd = ((((dwfl->callbacks->debuginfo_path
+ ? *dwfl->callbacks->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH)[0] == ':') ? -1
+ : TEMP_FAILURE_RETRY (open64 (*fname, O_RDONLY)));
if (fd < 0)
{
char *debugfname = NULL;
Dwfl_Module fakemod = { .dwfl = dwfl };
+ /* First try the file's unadorned basename as DEBUGLINK_FILE,
+ to look for "vmlinux" files. */
fd = INTUSE(dwfl_standard_find_debuginfo) (&fakemod, NULL, NULL, 0,
*fname, basename (*fname), 0,
&debugfname);
+ if (fd < 0)
+ /* Next, let the call use the default of basename + ".debug",
+ to look for "vmlinux.debug" files. */
+ fd = INTUSE(dwfl_standard_find_debuginfo) (&fakemod, NULL, NULL, 0,
+ *fname, NULL, 0,
+ &debugfname);
free (*fname);
*fname = debugfname;
}
@@ -404,7 +418,7 @@ dwfl_linux_kernel_module_section_address
Dwarf_Addr *addr)
{
char *sysfile = NULL;
- asprintf (&sysfile, SECADDRFMT, modname, secname);
+ asprintf (&sysfile, SECADDRDIRFMT "%s", modname, secname);
if (sysfile == NULL)
return ENOMEM;
@@ -436,10 +450,11 @@ dwfl_linux_kernel_module_section_address
behavior, and this cruft leaks out into the /sys information.
The file name for ".init*" may actually look like "_init*". */
- if (!strncmp (secname, ".init", 5))
+ const bool is_init = !strncmp (secname, ".init", 5);
+ if (is_init)
{
sysfile = NULL;
- asprintf (&sysfile, SECADDRFMT "%s", modname, "_", &secname[1]);
+ asprintf (&sysfile, SECADDRDIRFMT "_%s", modname, &secname[1]);
if (sysfile == NULL)
return ENOMEM;
f = fopen (sysfile, "r");
@@ -447,6 +462,37 @@ dwfl_linux_kernel_module_section_address
if (f != NULL)
goto ok;
}
+
+ /* The kernel truncates section names to MODULE_SECT_NAME_LEN - 1.
+ In case that size increases in the future, look for longer
+ truncated names first. */
+ size_t namelen = strlen (secname);
+ if (namelen >= MODULE_SECT_NAME_LEN)
+ {
+ sysfile = NULL;
+ int len = asprintf (&sysfile, SECADDRDIRFMT "%s",
+ modname, secname);
+ if (sysfile == NULL)
+ return ENOMEM;
+ char *end = sysfile + len;
+ do
+ {
+ *--end = '\0';
+ f = fopen (sysfile, "r");
+ if (is_init && f == NULL && errno == ENOENT)
+ {
+ sysfile[len - namelen] = '_';
+ f = fopen (sysfile, "r");
+ sysfile[len - namelen] = '.';
+ }
+ }
+ while (f == NULL && errno == ENOENT
+ && end - &sysfile[len - namelen] >= MODULE_SECT_NAME_LEN);
+ free (sysfile);
+
+ if (f != NULL)
+ goto ok;
+ }
}
return DWARF_CB_ABORT;
diff --git a/elfutils/libdwfl/relocate.c b/elfutils/libdwfl/relocate.c
index 3431743b..96cedcc3 100644
--- a/elfutils/libdwfl/relocate.c
+++ b/elfutils/libdwfl/relocate.c
@@ -1,5 +1,5 @@
/* Relocate debug information.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -55,7 +55,7 @@ typedef uint8_t GElf_Byte;
We update the section header in place to cache the result. */
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_relocate_value (Dwfl_Module *mod, size_t symshstrndx,
Elf32_Word shndx, GElf_Addr *value)
{
@@ -97,7 +97,7 @@ __libdwfl_relocate_value (Dwfl_Module *mod, size_t symshstrndx,
}
Dwfl_Error
-internal_function_def
+internal_function
__libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
{
assert (mod->e_type == ET_REL);
@@ -156,11 +156,6 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
{
/* First, resolve the symbol to an absolute value. */
GElf_Addr value;
- inline Dwfl_Error adjust (GElf_Word shndx)
- {
- return __libdwfl_relocate_value (mod, symshstrndx,
- shndx, &value);
- }
if (symndx == STN_UNDEF)
/* When strip removes a section symbol referring to a
@@ -172,35 +167,17 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
value = 0;
else
{
- GElf_Sym sym_mem;
+ GElf_Sym sym;
GElf_Word shndx;
- GElf_Sym *sym = gelf_getsymshndx (mod->symdata,
- mod->symxndxdata,
- symndx, &sym_mem,
- &shndx);
- if (sym == NULL)
- return DWFL_E_LIBELF;
- value = sym->st_value;
- if (sym->st_shndx != SHN_XINDEX)
- shndx = sym->st_shndx;
- switch (shndx)
- {
- case SHN_ABS:
- break;
+ if (INTUSE(dwfl_module_getsym) (mod, symndx,
+ &sym, &shndx) == NULL)
+ return dwfl_errno ();
- case SHN_UNDEF:
- case SHN_COMMON:
- return DWFL_E_RELUNDEF;
+ if (shndx == SHN_UNDEF || shndx == SHN_COMMON)
+ return DWFL_E_RELUNDEF;
- default:
- {
- Dwfl_Error error = adjust (shndx);
- if (error != DWFL_E_NOERROR)
- return error;
- break;
- }
- }
+ value = sym.st_value;
}
/* These are the types we can relocate. */
diff --git a/elfutils/libebl/ChangeLog b/elfutils/libebl/ChangeLog
index 532c4eca..c4f5c65a 100644
--- a/elfutils/libebl/ChangeLog
+++ b/elfutils/libebl/ChangeLog
@@ -1,3 +1,40 @@
+2006-07-06 Ulrich Drepper <drepper@redhat.com>
+
+ * ebldynamictagname.c: Add support for DT_GNU_HASH.
+ * ebldynamictagcheck.c: Likewise.
+ * eblsectiontypename.c: Add support for SHT_GNU_HASH.
+
+2006-07-05 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblsysvhashentrysize.c.
+ * libeblP.h (struct ebl): Add sysvhash_entrysize element.
+ * eblopenbackend.c (fill_defaults): Initialize sysvhash_entrysize.
+
+ * eblopenbackend.c (openbackend): If possible, fill machine, class,
+ and data values in from the ELF file.
+
+2006-07-04 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblrelativerelocp.c.
+ * eblrelativerelocp.c: New file.
+ * ebl-hooks.c: Add relative_reloc_p.
+ * eblopenbackend.c (default_relative_reloc_p): New function.
+ (fill_defaults): Hook it up.
+ * libebl.h: Declare ebl_relative_reloc_p.
+
+2006-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblnonerelocp.c.
+ * eblnonerelocp.c: New file.
+ * ebl-hooks.c: Add none_reloc_p.
+ * eblopenbackend.c (default_none_reloc_p): New function.
+ (fill_defaults): Hook it up.
+ * libebl.h: Declare ebl_none_reloc_p.
+
+2006-05-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libebl.h: Add extern "C".
+
2005-11-25 Roland McGrath <roland@redhat.com>
* eblregname.c: New file.
diff --git a/elfutils/libebl/Makefile.am b/elfutils/libebl/Makefile.am
index 483fd13a..278d93e0 100644
--- a/elfutils/libebl/Makefile.am
+++ b/elfutils/libebl/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in
##
-## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
## This file is part of Red Hat elfutils.
##
## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -55,7 +55,9 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
eblcorenote.c eblobjnote.c ebldebugscnp.c \
eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \
eblelfclass.c eblelfdata.c eblelfmachine.c \
- ebl_check_special_symbol.c eblbsspltp.c eblretval.c eblregname.c
+ ebl_check_special_symbol.c eblbsspltp.c eblretval.c \
+ eblregname.c eblnonerelocp.c eblrelativerelocp.c \
+ eblsysvhashentrysize.c
libebl_a_SOURCES = $(gen_SOURCES)
diff --git a/elfutils/libebl/Makefile.in b/elfutils/libebl/Makefile.in
index a88b1685..12e4abd3 100644
--- a/elfutils/libebl/Makefile.in
+++ b/elfutils/libebl/Makefile.in
@@ -78,7 +78,9 @@ am__objects_1 = eblopenbackend.$(OBJEXT) eblclosebackend.$(OBJEXT) \
eblcopyrelocp.$(OBJEXT) eblsectionstripp.$(OBJEXT) \
eblelfclass.$(OBJEXT) eblelfdata.$(OBJEXT) \
eblelfmachine.$(OBJEXT) ebl_check_special_symbol.$(OBJEXT) \
- eblbsspltp.$(OBJEXT) eblretval.$(OBJEXT) eblregname.$(OBJEXT)
+ eblbsspltp.$(OBJEXT) eblretval.$(OBJEXT) eblregname.$(OBJEXT) \
+ eblnonerelocp.$(OBJEXT) eblrelativerelocp.$(OBJEXT) \
+ eblsysvhashentrysize.$(OBJEXT)
am_libebl_a_OBJECTS = $(am__objects_1)
libebl_a_OBJECTS = $(am_libebl_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -146,6 +148,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -226,7 +230,9 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
eblcorenote.c eblobjnote.c ebldebugscnp.c \
eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \
eblelfclass.c eblelfdata.c eblelfmachine.c \
- ebl_check_special_symbol.c eblbsspltp.c eblretval.c eblregname.c
+ ebl_check_special_symbol.c eblbsspltp.c eblretval.c \
+ eblregname.c eblnonerelocp.c eblrelativerelocp.c \
+ eblsysvhashentrysize.c
libebl_a_SOURCES = $(gen_SOURCES)
noinst_HEADERS = libeblP.h ebl-hooks.h
@@ -321,12 +327,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblgstrtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagcheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblnonerelocp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjecttypename.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnote.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnotetypename.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblopenbackend.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblosabiname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblregname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelativerelocp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelocsimpletype.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypecheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypename.Po@am__quote@
@@ -340,6 +348,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblstrtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymbolbindingname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymboltypename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsysvhashentrysize.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblwstrtab.Po@am__quote@
.c.o:
diff --git a/elfutils/libebl/ebl-hooks.h b/elfutils/libebl/ebl-hooks.h
index 22d38733..e4923b2e 100644
--- a/elfutils/libebl/ebl-hooks.h
+++ b/elfutils/libebl/ebl-hooks.h
@@ -1,5 +1,5 @@
/* Backend hook signatures internal interface for libebl.
- Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -116,6 +116,12 @@ bool EBLHOOK(debugscn_p) (const char *);
/* Check whether given relocation is a copy relocation. */
bool EBLHOOK(copy_reloc_p) (int);
+/* Check whether given relocation is a no-op relocation. */
+bool EBLHOOK(none_reloc_p) (int);
+
+/* Check whether given relocation is a relative relocation. */
+bool EBLHOOK(relative_reloc_p) (int);
+
/* Check whether given symbol's value is ok despite normal checks. */
bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *,
const char *, const GElf_Shdr *);
diff --git a/elfutils/libebl/ebldynamictagcheck.c b/elfutils/libebl/ebldynamictagcheck.c
index b082e83d..1953a9c0 100644
--- a/elfutils/libebl/ebldynamictagcheck.c
+++ b/elfutils/libebl/ebldynamictagcheck.c
@@ -1,5 +1,5 @@
/* Check dynamic tag.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -66,7 +66,7 @@ ebl_dynamic_tag_check (ebl, tag)
if (!res
&& ((tag >= 0 && tag < DT_NUM)
|| (tag >= DT_GNU_PRELINKED && tag <= DT_SYMINENT)
- || (tag >= DT_GNU_CONFLICT && tag <= DT_SYMINFO)
+ || (tag >= DT_GNU_HASH && tag <= DT_SYMINFO)
|| tag == DT_VERSYM
|| (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM)
|| tag == DT_AUXILIARY
diff --git a/elfutils/libebl/ebldynamictagname.c b/elfutils/libebl/ebldynamictagname.c
index 12677585..d9aa7df0 100644
--- a/elfutils/libebl/ebldynamictagname.c
+++ b/elfutils/libebl/ebldynamictagname.c
@@ -1,5 +1,5 @@
/* Return dynamic tag name.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -96,15 +96,16 @@ ebl_dynamic_tag_name (ebl, tag, buf, len)
res = valrntags[tag - DT_GNU_PRELINKED];
}
- else if (tag >= DT_GNU_CONFLICT && tag <= DT_SYMINFO)
+ else if (tag >= DT_GNU_HASH && tag <= DT_SYMINFO)
{
static const char *addrrntags[] =
{
+ "GNU_HASH", "TLSDESC_PLT", "TLSDESC_DOT",
"GNU_CONFLICT", "GNU_LIBLIST", "CONFIG", "DEPAUDIT", "AUDIT",
"PLTPAD", "MOVETAB", "SYMINFO"
};
- res = addrrntags[tag - DT_GNU_CONFLICT];
+ res = addrrntags[tag - DT_GNU_HASH];
}
else if (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM)
{
diff --git a/elfutils/libebl/eblnonerelocp.c b/elfutils/libebl/eblnonerelocp.c
new file mode 100644
index 00000000..3bca98b1
--- /dev/null
+++ b/elfutils/libebl/eblnonerelocp.c
@@ -0,0 +1,64 @@
+/* Check whether given relocation is a no-op relocation.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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 <libeblP.h>
+
+
+bool
+ebl_none_reloc_p (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl->none_reloc_p (reloc);
+}
diff --git a/elfutils/libebl/eblopenbackend.c b/elfutils/libebl/eblopenbackend.c
index 03fa99e6..5916e0de 100644
--- a/elfutils/libebl/eblopenbackend.c
+++ b/elfutils/libebl/eblopenbackend.c
@@ -1,5 +1,5 @@
/* Generate ELF backend handle.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@
#include <assert.h>
#include <dlfcn.h>
#include <error.h>
-#include <gelf.h>
+#include <libelfP.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -89,6 +89,7 @@ static const struct
{ "sparc", "elf_sparcv9", "sparc", 5, EM_SPARCV9, 0, 0 },
{ "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
{ "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
+ { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
{ "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
{ "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 },
@@ -99,7 +100,6 @@ static const struct
{ "vpp500", "elf_vpp500", "vpp500", 5, EM_VPP500, 0, 0 },
{ "sparc", "elf_v8plus", "v8plus", 6, EM_SPARC32PLUS, 0, 0 },
{ "i960", "elf_i960", "i960", 4, EM_960, 0, 0 },
- { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
{ "v800", "ebl_v800", "v800", 4, EM_V800, 0, 0 },
{ "fr20", "ebl_fr20", "fr20", 4, EM_FR20, 0, 0 },
{ "rh32", "ebl_rh32", "rh32", 4, EM_RH32, 0, 0 },
@@ -190,6 +190,8 @@ static bool default_object_note (const char *name, uint32_t type,
uint32_t descsz, const char *desc);
static bool default_debugscn_p (const char *name);
static bool default_copy_reloc_p (int reloc);
+static bool default_none_reloc_p (int reloc);
+static bool default_relative_reloc_p (int reloc);
static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr,
const GElf_Sym *sym,
const char *name,
@@ -229,11 +231,14 @@ fill_defaults (Ebl *result)
result->object_note = default_object_note;
result->debugscn_p = default_debugscn_p;
result->copy_reloc_p = default_copy_reloc_p;
+ result->none_reloc_p = default_none_reloc_p;
+ result->relative_reloc_p = default_relative_reloc_p;
result->check_special_symbol = default_check_special_symbol;
result->bss_plt_p = default_bss_plt_p;
result->return_value_location = default_return_value_location;
result->register_name = default_register_name;
result->destr = default_destr;
+ result->sysvhash_entrysize = sizeof (Elf32_Word);
}
@@ -278,9 +283,28 @@ openbackend (elf, emulation, machine)
/* Well, we know the emulation name now. */
result->emulation = machines[cnt].emulation;
- result->machine = machines[cnt].em;
- result->class = machines[cnt].class;
- result->data = machines[cnt].data;
+ /* We access some data structures directly. Make sure the 32 and
+ 64 bit variants are laid out the same. */
+ assert (offsetof (Elf32_Ehdr, e_machine)
+ == offsetof (Elf64_Ehdr, e_machine));
+ assert (sizeof (((Elf32_Ehdr *) 0)->e_machine)
+ == sizeof (((Elf64_Ehdr *) 0)->e_machine));
+ assert (offsetof (Elf, state.elf32.ehdr)
+ == offsetof (Elf, state.elf64.ehdr));
+
+ /* Prefer taking the information from the ELF file. */
+ if (elf == NULL)
+ {
+ result->machine = machines[cnt].em;
+ result->class = machines[cnt].class;
+ result->data = machines[cnt].data;
+ }
+ else
+ {
+ result->machine = elf->state.elf32.ehdr->e_machine;
+ result->class = elf->state.elf32.ehdr->e_ident[EI_CLASS];
+ result->data = elf->state.elf32.ehdr->e_ident[EI_DATA];
+ }
#ifndef LIBEBL_SUBDIR
# define LIBEBL_SUBDIR PACKAGE
@@ -605,6 +629,8 @@ default_copy_reloc_p (int reloc __attribute__ ((unused)))
{
return false;
}
+strong_alias (default_copy_reloc_p, default_none_reloc_p)
+strong_alias (default_copy_reloc_p, default_relative_reloc_p)
static bool
default_check_special_symbol (Elf *elf __attribute__ ((unused)),
diff --git a/elfutils/libebl/eblrelativerelocp.c b/elfutils/libebl/eblrelativerelocp.c
new file mode 100644
index 00000000..8ea97b88
--- /dev/null
+++ b/elfutils/libebl/eblrelativerelocp.c
@@ -0,0 +1,64 @@
+/* Check whether given relocation is a relocation relocation.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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 <libeblP.h>
+
+
+bool
+ebl_relative_reloc_p (ebl, reloc)
+ Ebl *ebl;
+ int reloc;
+{
+ return ebl->relative_reloc_p (reloc);
+}
diff --git a/elfutils/libebl/eblsectiontypename.c b/elfutils/libebl/eblsectiontypename.c
index 18cbd767..b62c37b3 100644
--- a/elfutils/libebl/eblsectiontypename.c
+++ b/elfutils/libebl/eblsectiontypename.c
@@ -1,5 +1,5 @@
/* Return section type name.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -116,6 +116,8 @@ ebl_section_type_name (ebl, section, buf, len)
res = "CHECKSUM";
else if (section == SHT_GNU_LIBLIST)
res = "GNU_LIBLIST";
+ else if (section == SHT_GNU_HASH)
+ res = "GNU_HASH";
/* Handle OS-specific section names. */
else
{
diff --git a/elfutils/libebl/eblsysvhashentrysize.c b/elfutils/libebl/eblsysvhashentrysize.c
new file mode 100644
index 00000000..341979c1
--- /dev/null
+++ b/elfutils/libebl/eblsysvhashentrysize.c
@@ -0,0 +1,63 @@
+/* Return OS ABI name
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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 <libeblP.h>
+
+
+int
+ebl_sysvhash_entrysize (ebl)
+ Ebl *ebl;
+{
+ return ebl->sysvhash_entrysize;
+}
diff --git a/elfutils/libebl/libebl.h b/elfutils/libebl/libebl.h
index c27e734b..6969c550 100644
--- a/elfutils/libebl/libebl.h
+++ b/elfutils/libebl/libebl.h
@@ -1,5 +1,5 @@
/* Interface for libebl.
- Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -63,6 +63,10 @@
typedef struct ebl Ebl;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Get backend handle for object associated with ELF handle. */
extern Ebl *ebl_openbackend (Elf *elf);
/* Similar but without underlying ELF file. */
@@ -185,6 +189,12 @@ extern bool ebl_debugscn_p (Ebl *ebl, const char *name);
/* Check whether given relocation is a copy relocation. */
extern bool ebl_copy_reloc_p (Ebl *ebl, int reloc);
+/* Check whether given relocation is a no-op relocation. */
+extern bool ebl_none_reloc_p (Ebl *ebl, int reloc);
+
+/* Check whether given relocation is a relative relocation. */
+extern bool ebl_relative_reloc_p (Ebl *ebl, int reloc);
+
/* Check whether section should be stripped. */
extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr,
const GElf_Shdr *shdr, const char *name,
@@ -193,6 +203,9 @@ extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr,
/* Check if backend uses a bss PLT in this file. */
extern bool ebl_bss_plt_p (Ebl *ebl, GElf_Ehdr *ehdr);
+/* Return size of entry in SysV-style hash table. */
+extern int ebl_sysvhash_entrysize (Ebl *ebl);
+
/* Return location expression to find return value given a
DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing
function itself (whose DW_AT_type attribute describes its return type).
@@ -289,4 +302,8 @@ extern void ebl_gstrtabfinalize (struct Ebl_GStrtab *st, Elf_Data *data);
/* Get offset in wide char string table for string associated with SE. */
extern size_t ebl_gstrtaboffset (struct Ebl_GStrent *se);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* libebl.h */
diff --git a/elfutils/libebl/libeblP.h b/elfutils/libebl/libeblP.h
index ff70b679..7bb4c376 100644
--- a/elfutils/libebl/libeblP.h
+++ b/elfutils/libebl/libeblP.h
@@ -1,5 +1,5 @@
/* Internal definitions for interface for libebl.
- Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -77,6 +77,9 @@ struct ebl
# include "ebl-hooks.h"
# undef EBLHOOK
+ /* Size of entry in Sysv-style hash table. */
+ int sysvhash_entrysize;
+
/* Internal data. */
void *dlhandle;
};
@@ -87,6 +90,7 @@ typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t);
/* gettext helper macros. */
+#undef _
#define _(Str) dgettext ("elfutils", Str)
#endif /* libeblP.h */
diff --git a/elfutils/libelf-po/libelf.pot b/elfutils/libelf-po/libelf.pot
index 7f057589..99a97ce6 100644
--- a/elfutils/libelf-po/libelf.pot
+++ b/elfutils/libelf-po/libelf.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-04-04 20:24-0700\n"
+"POT-Creation-Date: 2006-08-14 22:47-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/elfutils/libelf/ChangeLog b/elfutils/libelf/ChangeLog
index 46083253..029923c0 100644
--- a/elfutils/libelf/ChangeLog
+++ b/elfutils/libelf/ChangeLog
@@ -1,3 +1,43 @@
+2006-08-08 Ulrich Drepper <drepper@redhat.com>
+
+ * elf.h (DT_VALNUM): Update.
+ (DT_ADDRNUM): Likewise.
+
+2006-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * elf32_updatefile.c: Adjust for internal_function_def removal.
+ * elf32_updatenull.c: Likewise.
+ * elf_begin.c: Likewise.
+ * elf_getdata.c: Likewise.
+
+2006-07-11 Ulrich Drepper <drepper@redhat.com>
+
+ * libelf.h: Define ELF_T_GNUHASH.
+ * elf_getdata.c (TYPEIDX): Handle SHT_GNU_HASH.
+ (shtype_map): Add SHT_GNU_HASH entries.
+ * gelf_xlate.c (__elf_xfctstom): Add ELF_T_GNUHASH entries.
+ * gnuhash_xlate.h: New file.
+ * Makefile.am (noinst_HEADERS): Add gnuhash_xlate.h.
+
+2006-07-06 Ulrich Drepper <drepper@redhat.com>
+
+ * elf_gnu_hash.c: New file.
+ * libelf.h: Declare elf_gnu_hash.
+ * Makefile.am (libelf_a_SOURCES): Add elf_gnu_hash.
+ * libelf.map: Add elf_gnu_map for version ELFUTILS_1.2.
+
+2006-06-15 Roland McGrath <roland@redhat.com>
+
+ * libelf.h (elf_getarsym): Fix comment typo.
+ Rename second parameter to be more explanatory.
+ (elf_getident, elf_rawhide): Likewise.
+
+2006-05-28 Ulrich Drepper <drepper@redhat.com>
+
+ * elf32_updatefile.c (updatemmap): Preserve section content if
+ copying would overwrite them.
+ Fix msync paramters.
+
2006-04-04 Roland McGrath <roland@redhat.com>
* elf32_updatefile.c (updatemmap): Handle other-endian case.
diff --git a/elfutils/libelf/Makefile.am b/elfutils/libelf/Makefile.am
index 51965cee..1c2e69a2 100644
--- a/elfutils/libelf/Makefile.am
+++ b/elfutils/libelf/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in
##
-## Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+## Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
## This file is part of Red Hat elfutils.
##
## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -96,7 +96,8 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
elf_clone.c \
gelf_getlib.c gelf_update_lib.c \
elf32_offscn.c elf64_offscn.c gelf_offscn.c \
- elf_getaroff.c
+ elf_getaroff.c \
+ elf_gnu_hash.c
if !MUDFLAP
libelf_pic_a_SOURCES =
@@ -131,7 +132,7 @@ uninstall: uninstall-am
endif
noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
- version_xlate.h dl-hash.h
+ version_xlate.h gnuhash_xlate.h dl-hash.h
EXTRA_DIST = libelf.map
CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda
diff --git a/elfutils/libelf/Makefile.in b/elfutils/libelf/Makefile.in
index 42dcfae2..c573becd 100644
--- a/elfutils/libelf/Makefile.in
+++ b/elfutils/libelf/Makefile.in
@@ -118,7 +118,7 @@ am_libelf_a_OBJECTS = elf_version.$(OBJEXT) elf_hash.$(OBJEXT) \
elf_clone.$(OBJEXT) gelf_getlib.$(OBJEXT) \
gelf_update_lib.$(OBJEXT) elf32_offscn.$(OBJEXT) \
elf64_offscn.$(OBJEXT) gelf_offscn.$(OBJEXT) \
- elf_getaroff.$(OBJEXT)
+ elf_getaroff.$(OBJEXT) elf_gnu_hash.$(OBJEXT)
libelf_a_OBJECTS = $(am_libelf_a_OBJECTS)
libelf_pic_a_AR = $(AR) $(ARFLAGS)
libelf_pic_a_LIBADD =
@@ -196,6 +196,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -314,13 +316,14 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
elf_clone.c \
gelf_getlib.c gelf_update_lib.c \
elf32_offscn.c elf64_offscn.c gelf_offscn.c \
- elf_getaroff.c
+ elf_getaroff.c \
+ elf_gnu_hash.c
@MUDFLAP_FALSE@libelf_pic_a_SOURCES =
@MUDFLAP_FALSE@am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
@MUDFLAP_FALSE@libelf_so_SOURCES =
noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
- version_xlate.h dl-hash.h
+ version_xlate.h gnuhash_xlate.h dl-hash.h
EXTRA_DIST = libelf.map
CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda
@@ -455,6 +458,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getscn.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshnum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshstrndx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_gnu_hash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_hash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_kind.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_memory.Po@am__quote@
diff --git a/elfutils/libelf/elf.h b/elfutils/libelf/elf.h
index c98bb523..dcadd60f 100644
--- a/elfutils/libelf/elf.h
+++ b/elfutils/libelf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -330,6 +330,7 @@ typedef struct
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
#define SHT_NUM 19 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific */
+#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table. */
#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
@@ -691,7 +692,7 @@ typedef struct
#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
#define DT_VALRNGHI 0x6ffffdff
#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
-#define DT_VALNUM 12
+#define DT_VALNUM 11
/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
@@ -699,6 +700,9 @@ typedef struct
If any adjustment is made to the ELF object after it has been
built these entries will need to be adjusted. */
#define DT_ADDRRNGLO 0x6ffffe00
+#define DT_GNU_HASH 0x6ffffef5 /* Address of GNU symbol hash table */
+#define DT_TLSDESC_PLT 0x6ffffef6
+#define DT_TLSDESC_GOT 0x6ffffef7
#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
#define DT_CONFIG 0x6ffffefa /* Configuration information. */
@@ -709,7 +713,7 @@ typedef struct
#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
#define DT_ADDRRNGHI 0x6ffffeff
#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
-#define DT_ADDRNUM 10
+#define DT_ADDRNUM 11
/* The versioning entry types. The next are defined as part of the
GNU extension. */
diff --git a/elfutils/libelf/elf32_updatefile.c b/elfutils/libelf/elf32_updatefile.c
index 7561a685..68253651 100644
--- a/elfutils/libelf/elf32_updatefile.c
+++ b/elfutils/libelf/elf32_updatefile.c
@@ -112,7 +112,7 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list)
int
-internal_function_def
+internal_function
__elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
{
ElfW2(LIBELFBITS,Ehdr) *ehdr;
@@ -239,6 +239,32 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
= memcpy (p, scn->shdr.ELFW(e,LIBELFBITS),
sizeof (ElfW2(LIBELFBITS,Shdr)));
}
+
+ /* If the file is mmaped and the original position of the
+ section in the file is lower than the new position we
+ need to save the section content since otherwise it is
+ overwritten before it can be copied. If there are
+ multiple data segments in the list only the first can be
+ from the file. */
+ if (((char *) elf->map_address + elf->start_offset
+ <= (char *) scn->data_list.data.d.d_buf)
+ && ((char *) scn->data_list.data.d.d_buf
+ < ((char *) elf->map_address + elf->start_offset
+ + elf->maximum_size))
+ && (((char *) elf->map_address + elf->start_offset
+ + scn->shdr.ELFW(e,LIBELFBITS)->sh_offset)
+ > (char *) scn->data_list.data.d.d_buf))
+ {
+ void *p = malloc (scn->data_list.data.d.d_size);
+ if (p == NULL)
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return -1;
+ }
+ scn->data_list.data.d.d_buf = scn->data_base
+ = memcpy (p, scn->data_list.data.d.d_buf,
+ scn->data_list.data.d.d_size);
+ }
}
/* Iterate over all the section in the order in which they
@@ -364,10 +390,10 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
/* Make sure the content hits the disk. */
char *msync_start = ((char *) elf->map_address
- + elf->start_offset / sysconf (_SC_PAGESIZE));
+ + (elf->start_offset & ~(sysconf (_SC_PAGESIZE) - 1)));
char *msync_end = ((char *) elf->map_address
+ elf->start_offset + ehdr->e_shoff
- * ehdr->e_shentsize * shnum);
+ + ehdr->e_shentsize * shnum);
(void) msync (msync_start, msync_end - msync_start, MS_SYNC);
return 0;
@@ -418,7 +444,7 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp)
int
-internal_function_def
+internal_function
__elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
{
char fillbuf[FILLBUFSIZE];
diff --git a/elfutils/libelf/elf32_updatenull.c b/elfutils/libelf/elf32_updatenull.c
index 3516c091..3b926c1f 100644
--- a/elfutils/libelf/elf32_updatenull.c
+++ b/elfutils/libelf/elf32_updatenull.c
@@ -132,7 +132,7 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr,
off_t
-internal_function_def
+internal_function
__elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
{
ElfW2(LIBELFBITS,Ehdr) *ehdr = INTUSE(elfw2(LIBELFBITS,getehdr)) (elf);
diff --git a/elfutils/libelf/elf_begin.c b/elfutils/libelf/elf_begin.c
index c6ef7947..be52f464 100644
--- a/elfutils/libelf/elf_begin.c
+++ b/elfutils/libelf/elf_begin.c
@@ -1,5 +1,5 @@
/* Create descriptor for processing file.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 1998-2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -434,7 +434,7 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
Elf *
-internal_function_def
+internal_function
__libelf_read_mmaped_file (int fildes, void *map_address, off_t offset,
size_t maxsize, Elf_Cmd cmd, Elf *parent)
{
@@ -702,7 +702,7 @@ read_long_names (Elf *elf)
/* Read the next archive header. */
int
-internal_function_def
+internal_function
__libelf_next_arhdr (elf)
Elf *elf;
{
diff --git a/elfutils/libelf/elf_getdata.c b/elfutils/libelf/elf_getdata.c
index 676f0a07..1fa4a17f 100644
--- a/elfutils/libelf/elf_getdata.c
+++ b/elfutils/libelf/elf_getdata.c
@@ -1,5 +1,5 @@
/* Return the next data element from the section after possibly converting it.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 1998-2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -73,8 +73,8 @@
#define TYPEIDX(Sh_Type) \
(Sh_Type >= SHT_NULL && Sh_Type < SHT_NUM \
? Sh_Type \
- : (Sh_Type >= SHT_GNU_LIBLIST && Sh_Type <= SHT_HISUNW \
- ? SHT_NUM + Sh_Type - SHT_GNU_LIBLIST \
+ : (Sh_Type >= SHT_GNU_HASH && Sh_Type <= SHT_HISUNW \
+ ? SHT_NUM + Sh_Type - SHT_GNU_HASH \
: 0))
static const struct
@@ -131,12 +131,16 @@ static const struct
[TYPEIDX (SHT_SUNW_move)] = { ELF_T_MOVE, sizeof (ElfW2(Bits,Move)) \
AL (__alignof__ (ElfW2(Bits,Move))) }, \
[TYPEIDX (SHT_GNU_LIBLIST)] = { ELF_T_LIB, sizeof (ElfW2(Bits,Lib)) \
- AL (__alignof__ (ElfW2(Bits,Lib))) }
- DEFINE (32)
+ AL (__alignof__ (ElfW2(Bits,Lib))) }
+ DEFINE (32),
+ [TYPEIDX (SHT_GNU_HASH)] = { ELF_T_WORD, sizeof (Elf32_Word)
+ AL (__alignof__ (Elf32_Word)) }
},
[ELFCLASS64 - 1] =
{
- DEFINE (64)
+ DEFINE (64),
+ [TYPEIDX (SHT_GNU_HASH)] = { ELF_T_GNUHASH, 1
+ AL (__alignof__ (Elf64_Xword)) }
}
}
};
@@ -211,7 +215,7 @@ convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,
/* Store the information for the raw data in the `rawdata' element. */
int
-internal_function_def
+internal_function
__libelf_set_rawdata (Elf_Scn *scn)
{
size_t offset;
@@ -335,8 +339,8 @@ __libelf_set_rawdata (Elf_Scn *scn)
GElf_Ehdr ehdr_mem;
scn->rawdata.d.d_type
- = (SH_ENTSIZE_HASH (INTUSE(gelf_getehdr) (elf, &ehdr_mem))
- == 4 ? ELF_T_WORD : ELF_T_XWORD);
+ = (SH_ENTSIZE_HASH (INTUSE(gelf_getehdr) (elf, &ehdr_mem)) == 4
+ ? ELF_T_WORD : ELF_T_XWORD);
}
else
{
diff --git a/elfutils/libelf/elf_gnu_hash.c b/elfutils/libelf/elf_gnu_hash.c
new file mode 100644
index 00000000..efaee435
--- /dev/null
+++ b/elfutils/libelf/elf_gnu_hash.c
@@ -0,0 +1,68 @@
+/* GNU-style Hash function used in ELF implementations.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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 <libelfP.h>
+
+/* Get the implementation. */
+#include <dl-hash.h>
+
+unsigned long int
+elf_gnu_hash (string)
+ const char *string;
+{
+ uint_fast32_t h = 5381;
+ for (unsigned char c = *string; c != '\0'; c = *++string)
+ h = h * 33 + c;
+ return h & 0xffffffff;
+}
diff --git a/elfutils/libelf/gelf_xlate.c b/elfutils/libelf/gelf_xlate.c
index 34e74d00..f1bbdf3a 100644
--- a/elfutils/libelf/gelf_xlate.c
+++ b/elfutils/libelf/gelf_xlate.c
@@ -1,5 +1,5 @@
/* Transformation functions for ELF data types.
- Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -184,6 +184,7 @@ union unaligned
/* We have a few functions which we must create by hand since the sections
do not contain records of only one type. */
#include "version_xlate.h"
+#include "gnuhash_xlate.h"
/* Now the externally visible table with the function pointers. */
@@ -216,10 +217,12 @@ const xfct_t __elf_xfctstom[EV_NUM - 1][EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
[ELF_T_SYMINFO] = ElfW2(Bits, cvt_Syminfo), \
[ELF_T_MOVE] = ElfW2(Bits, cvt_Move), \
[ELF_T_LIB] = ElfW2(Bits, cvt_Lib)
- define_xfcts (32)
+ define_xfcts (32),
+ [ELF_T_GNUHASH] = Elf32_cvt_Word
},
[ELFCLASS64 - 1] = {
- define_xfcts (64)
+ define_xfcts (64),
+ [ELF_T_GNUHASH] = elf_cvt_gnuhash
}
}
}
diff --git a/elfutils/libelf/gnuhash_xlate.h b/elfutils/libelf/gnuhash_xlate.h
new file mode 100644
index 00000000..9012ffa1
--- /dev/null
+++ b/elfutils/libelf/gnuhash_xlate.h
@@ -0,0 +1,95 @@
+/* Conversion functions for versioning information.
+ Copyright (C) 2006 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ 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>. */
+
+#include <assert.h>
+#include <gelf.h>
+
+#include "libelfP.h"
+
+
+static void
+elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
+{
+ /* The GNU hash table format on 64 bit machines mixes 32 bit and 64 bit
+ words. We must detangle them here. */
+ Elf32_Word *dest32 = dest;
+ const Elf32_Word *src32 = src;
+
+ /* First four control words, 32 bits. */
+ for (unsigned int cnt = 0; cnt < 4; ++cnt)
+ {
+ if (len < 4)
+ return;
+ dest32[cnt] = bswap_32 (src32[cnt]);
+ len -= 4;
+ }
+
+ Elf32_Word bitmask_words = encode ? src32[2] : dest32[2];
+
+ /* Now the 64 bit words. */
+ Elf64_Xword *dest64 = (Elf64_Xword *) &dest32[4];
+ const Elf64_Xword *src64 = (const Elf64_Xword *) &src32[4];
+ for (unsigned int cnt = 0; cnt < bitmask_words; ++cnt)
+ {
+ if (len < 8)
+ return;
+ dest64[cnt] = bswap_64 (src64[cnt]);
+ len -= 8;
+ }
+
+ /* The rest are 32 bit words again. */
+ src32 = (const Elf32_Word *) &src64[bitmask_words];
+ dest32 = (Elf32_Word *) &dest64[bitmask_words];
+ while (len > 4)
+ {
+ *dest32++ = bswap_32 (*src32++);
+ len -= 4;
+ }
+}
diff --git a/elfutils/libelf/libelf.h b/elfutils/libelf/libelf.h
index 7d7d39e8..2f58e4c4 100644
--- a/elfutils/libelf/libelf.h
+++ b/elfutils/libelf/libelf.h
@@ -1,5 +1,5 @@
/* Interface for libelf.
- Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -82,6 +82,7 @@ typedef enum
ELF_T_SYMINFO, /* Elf32_Syminfo, Elf64_Syminfo, ... */
ELF_T_MOVE, /* Elf32_Move, Elf64_Move, ... */
ELF_T_LIB, /* Elf32_Lib, Elf64_Lib, ... */
+ ELF_T_GNUHASH, /* GNU-style hash section. */
/* Keep this the last entry. */
ELF_T_NUM
} Elf_Type;
@@ -206,7 +207,7 @@ extern off_t elf_getbase (Elf *__elf);
/* Retrieve file identification data. */
-extern char *elf_getident (Elf *__elf, size_t *__ptr);
+extern char *elf_getident (Elf *__elf, size_t *__nbytes);
/* Retrieve class-dependent object file header. */
extern Elf32_Ehdr *elf32_getehdr (Elf *__elf);
@@ -310,15 +311,15 @@ extern off_t elf_getaroff (Elf *__elf);
/* Select archive element at OFFSET. */
extern size_t elf_rand (Elf *__elf, size_t __offset);
-/* Get symbol table of archhive. */
-extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__ptr);
+/* Get symbol table of archive. */
+extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__narsyms);
/* Control ELF descriptor. */
extern int elf_cntl (Elf *__elf, Elf_Cmd __cmd);
/* Retrieve uninterpreted file contents. */
-extern char *elf_rawfile (Elf *__elf, size_t *__ptr);
+extern char *elf_rawfile (Elf *__elf, size_t *__nbytes);
/* Return size of array of COUNT elements of the type denoted by TYPE
@@ -371,6 +372,10 @@ extern void elf_fill (int __fill);
extern unsigned long int elf_hash (const char *__string)
__attribute__ ((__pure__));
+/* Compute hash value using the GNU-specific hash function. */
+extern unsigned long int elf_gnu_hash (const char *__string)
+ __attribute__ ((__pure__));
+
/* Compute simple checksum from permanent parts of the ELF file. */
extern long int elf32_checksum (Elf *__elf);
diff --git a/elfutils/libelf/libelf.map b/elfutils/libelf/libelf.map
index b2a65e84..9549c317 100644
--- a/elfutils/libelf/libelf.map
+++ b/elfutils/libelf/libelf.map
@@ -112,3 +112,8 @@ ELFUTILS_1.1.1 {
gelf_offscn;
elf_getaroff;
} ELFUTILS_1.1;
+
+ELFUTILS_1.2 {
+ global:
+ elf_gnu_hash;
+} ELFUTILS_1.1.1;
diff --git a/elfutils/libelf/libelfP.h b/elfutils/libelf/libelfP.h
index ed6b5f7f..54158aeb 100644
--- a/elfutils/libelf/libelfP.h
+++ b/elfutils/libelf/libelfP.h
@@ -1,5 +1,5 @@
/* Internal interfaces for libelf.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -546,9 +546,8 @@ extern uint32_t __libelf_crc32 (uint32_t crc, unsigned char *buf, size_t len)
/* We often have to update a flag iff a value changed. Make this
- convenient. None of the parameters must have a side effect. */
-#ifdef __GNUC__
-# define update_if_changed(var, exp, flag) \
+ convenient. */
+#define update_if_changed(var, exp, flag) \
do { \
__typeof__ (var) *_var = &(var); \
__typeof__ (exp) _exp = (exp); \
@@ -558,15 +557,5 @@ extern uint32_t __libelf_crc32 (uint32_t crc, unsigned char *buf, size_t len)
(flag) |= ELF_F_DIRTY; \
} \
} while (0)
-#else
-# define update_if_changed(var, exp, flag) \
- do { \
- if ((var) != (exp)) \
- { \
- (var) = (exp); \
- (flag) |= ELF_F_DIRTY; \
- } \
- } while (0)
-#endif
#endif /* libelfP.h */
diff --git a/elfutils/m4/Makefile.in b/elfutils/m4/Makefile.in
index cf9ea4f4..b6b26086 100644
--- a/elfutils/m4/Makefile.in
+++ b/elfutils/m4/Makefile.in
@@ -99,6 +99,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/elfutils/po/elfutils.pot b/elfutils/po/elfutils.pot
index e8bc8e19..c0afd9dc 100644
--- a/elfutils/po/elfutils.pot
+++ b/elfutils/po/elfutils.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-04-04 20:24-0700\n"
+"POT-Creation-Date: 2006-08-14 22:47-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79
+#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79 src/readelf.c:2541
#, c-format
msgid "memory exhausted"
msgstr ""
@@ -30,7 +30,7 @@ msgstr ""
msgid "out of memory"
msgstr ""
-#: libasm/asm_error.c:122 src/ldgeneric.c:2486
+#: libasm/asm_error.c:122 src/ldgeneric.c:2564
#, c-format
msgid "cannot create output file"
msgstr ""
@@ -43,7 +43,7 @@ msgstr ""
msgid "cannot change mode of output file"
msgstr ""
-#: libasm/asm_error.c:125 src/ldgeneric.c:6258
+#: libasm/asm_error.c:125 src/ldgeneric.c:6395
#, c-format
msgid "cannot rename output file"
msgstr ""
@@ -270,7 +270,7 @@ msgstr ""
msgid "Reverse the sense of the sort"
msgstr ""
-#: src/nm.c:103 src/addr2line.c:68 src/findtextrel.c:73 src/elfcmp.c:71
+#: src/nm.c:103 src/addr2line.c:70 src/findtextrel.c:73 src/elfcmp.c:71
#: src/strings.c:83
msgid "Miscellaneous:"
msgstr ""
@@ -290,7 +290,7 @@ msgid "%s: INTERNAL ERROR %d (%s-%s): %s"
msgstr ""
#: src/nm.c:253 src/readelf.c:368 src/size.c:219 src/strip.c:203 src/ld.c:869
-#: src/elflint.c:232 src/addr2line.c:180 src/findtextrel.c:168
+#: src/elflint.c:232 src/addr2line.c:185 src/findtextrel.c:168
#: src/elfcmp.c:506 src/ranlib.c:146 src/strings.c:227
#, c-format
msgid ""
@@ -300,14 +300,14 @@ msgid ""
msgstr ""
#: src/nm.c:258 src/readelf.c:373 src/size.c:224 src/strip.c:208 src/ld.c:874
-#: src/elflint.c:237 src/addr2line.c:185 src/findtextrel.c:173
+#: src/elflint.c:237 src/addr2line.c:190 src/findtextrel.c:173
#: src/elfcmp.c:511 src/ranlib.c:151 src/strings.c:232
#, c-format
msgid "Written by %s.\n"
msgstr ""
#: src/nm.c:363 src/size.c:301 src/strip.c:430 src/strip.c:465
-#: src/ldgeneric.c:1605 src/findtextrel.c:227 src/elfcmp.c:554
+#: src/ldgeneric.c:1676 src/findtextrel.c:227 src/elfcmp.c:554
#: src/ranlib.c:300 src/strings.c:183
#, c-format
msgid "cannot open '%s'"
@@ -357,7 +357,7 @@ msgstr ""
#: src/nm.c:728 src/nm.c:973 src/readelf.c:676 src/readelf.c:815
#: src/readelf.c:956 src/readelf.c:1138 src/readelf.c:1346 src/readelf.c:1500
#: src/readelf.c:1667 src/readelf.c:1921 src/readelf.c:1987 src/readelf.c:2065
-#: src/readelf.c:2332 src/readelf.c:2451 src/readelf.c:4802 src/size.c:418
+#: src/readelf.c:2560 src/readelf.c:2596 src/readelf.c:4947 src/size.c:418
#: src/size.c:492 src/strip.c:480
#, c-format
msgid "cannot get section header string table index"
@@ -528,7 +528,7 @@ msgstr ""
msgid "cannot create EBL handle"
msgstr ""
-#: src/readelf.c:481 src/strip.c:540 src/ldgeneric.c:604 src/ldgeneric.c:1038
+#: src/readelf.c:481 src/strip.c:540 src/ldgeneric.c:615 src/ldgeneric.c:1082
#, c-format
msgid "cannot determine number of sections: %s"
msgstr ""
@@ -583,7 +583,7 @@ msgstr ""
#: src/readelf.c:559
#, c-format
-msgid " Version: %hhd %s\n"
+msgid " Ident Version: %hhd %s\n"
msgstr ""
#: src/readelf.c:561 src/readelf.c:578
@@ -1016,12 +1016,7 @@ msgstr ""
msgid " 1 *global* "
msgstr ""
-#: src/readelf.c:2346
-#, c-format
-msgid "cannot get data for section %d: %s"
-msgstr ""
-
-#: src/readelf.c:2357
+#: src/readelf.c:2334
#, c-format
msgid ""
"\n"
@@ -1036,29 +1031,41 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
-#: src/readelf.c:2403
+#: src/readelf.c:2357
#, c-format
msgid " Length Number % of total Coverage\n"
msgstr ""
-#: src/readelf.c:2405
+#: src/readelf.c:2359
#, c-format
msgid " 0 %6<PRIu32> %5.1f%%\n"
msgstr ""
-#: src/readelf.c:2412
+#: src/readelf.c:2366
#, c-format
msgid "%7d %6<PRIu32> %5.1f%% %5.1f%%\n"
msgstr ""
-#: src/readelf.c:2426
+#: src/readelf.c:2379
#, c-format
msgid ""
" Average number of tests: successful lookup: %f\n"
" unsuccessful lookup: %f\n"
msgstr ""
-#: src/readelf.c:2461
+#: src/readelf.c:2397 src/readelf.c:2439 src/readelf.c:2480
+#, c-format
+msgid "cannot get data for section %d: %s"
+msgstr ""
+
+#: src/readelf.c:2534
+#, c-format
+msgid ""
+" Symbol Bias: %u\n"
+" Bitmask Size: %zu bytes %<PRIuFAST32>%% bits set 2nd hash shift: %u\n"
+msgstr ""
+
+#: src/readelf.c:2606
#, c-format
msgid ""
"\n"
@@ -1069,38 +1076,38 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
-#: src/readelf.c:2475
+#: src/readelf.c:2620
msgid ""
" Library Time Stamp Checksum Version "
"Flags"
msgstr ""
-#: src/readelf.c:2597
+#: src/readelf.c:2742
#, c-format
msgid "unknown tag %hx"
msgstr ""
-#: src/readelf.c:2599
+#: src/readelf.c:2744
#, c-format
msgid "unknown user tag %hx"
msgstr ""
-#: src/readelf.c:2809
+#: src/readelf.c:2954
#, c-format
msgid "unknown attribute %hx"
msgstr ""
-#: src/readelf.c:2812
+#: src/readelf.c:2957
#, c-format
msgid "unknown user attribute %hx"
msgstr ""
-#: src/readelf.c:2858
+#: src/readelf.c:3003
#, c-format
msgid "unknown form %<PRIx64>"
msgstr ""
-#: src/readelf.c:3433
+#: src/readelf.c:3578
#, c-format
msgid ""
"\n"
@@ -1108,37 +1115,37 @@ msgid ""
" [ Code]\n"
msgstr ""
-#: src/readelf.c:3440
+#: src/readelf.c:3585
#, c-format
msgid ""
"\n"
"Abbreviation section at offset %<PRIu64>:\n"
msgstr ""
-#: src/readelf.c:3453
+#: src/readelf.c:3598
#, c-format
msgid " *** error while reading abbreviation: %s\n"
msgstr ""
-#: src/readelf.c:3469
+#: src/readelf.c:3614
#, c-format
msgid " [%5u] offset: %<PRId64>, children: %s, tag: %s\n"
msgstr ""
-#: src/readelf.c:3472
+#: src/readelf.c:3617
msgid "yes"
msgstr ""
-#: src/readelf.c:3472
+#: src/readelf.c:3617
msgid "no"
msgstr ""
-#: src/readelf.c:3508
+#: src/readelf.c:3653
#, c-format
msgid "cannot get .debug_aranges content: %s"
msgstr ""
-#: src/readelf.c:3513
+#: src/readelf.c:3658
#, c-format
msgid ""
"\n"
@@ -1149,46 +1156,46 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
-#: src/readelf.c:3543
+#: src/readelf.c:3688
#, c-format
msgid " [%*zu] ???\n"
msgstr ""
-#: src/readelf.c:3545
+#: src/readelf.c:3690
#, c-format
msgid ""
" [%*zu] start: %0#*<PRIx64>, length: %5<PRIu64>, CU DIE offset: %6<PRId64>\n"
msgstr ""
-#: src/readelf.c:3563
+#: src/readelf.c:3708
#, c-format
msgid "cannot get .debug_ranges content: %s"
msgstr ""
-#: src/readelf.c:3568 src/readelf.c:4045 src/readelf.c:4470 src/readelf.c:4560
-#: src/readelf.c:4732
+#: src/readelf.c:3713 src/readelf.c:4190 src/readelf.c:4615 src/readelf.c:4705
+#: src/readelf.c:4877
#, c-format
msgid ""
"\n"
"DWARF section '%s' at offset %#<PRIx64>:\n"
msgstr ""
-#: src/readelf.c:3652
+#: src/readelf.c:3797
#, c-format
msgid "cannot get attribute code: %s"
msgstr ""
-#: src/readelf.c:3660
+#: src/readelf.c:3805
#, c-format
msgid "cannot get attribute form: %s"
msgstr ""
-#: src/readelf.c:3672
+#: src/readelf.c:3817
#, c-format
msgid "cannot get attribute value: %s"
msgstr ""
-#: src/readelf.c:3838
+#: src/readelf.c:3983
#, c-format
msgid ""
"\n"
@@ -1196,7 +1203,7 @@ msgid ""
" [Offset]\n"
msgstr ""
-#: src/readelf.c:3863
+#: src/readelf.c:4008
#, c-format
msgid ""
" Compilation unit at offset %<PRIu64>:\n"
@@ -1204,49 +1211,49 @@ msgid ""
"<PRIu8>, Offset size: %<PRIu8>\n"
msgstr ""
-#: src/readelf.c:3880
+#: src/readelf.c:4025
#, c-format
msgid "cannot get DIE at offset %<PRIu64> in section '%s': %s"
msgstr ""
-#: src/readelf.c:3891
+#: src/readelf.c:4036
#, c-format
msgid "cannot get DIE offset: %s"
msgstr ""
-#: src/readelf.c:3899
+#: src/readelf.c:4044
#, c-format
msgid "cannot get tag of DIE at offset %<PRIu64> in section '%s': %s"
msgstr ""
-#: src/readelf.c:4016
+#: src/readelf.c:4161
#, c-format
msgid "cannot get next DIE: %s\n"
msgstr ""
-#: src/readelf.c:4023
+#: src/readelf.c:4168
#, c-format
msgid "cannot get next DIE: %s"
msgstr ""
-#: src/readelf.c:4057
+#: src/readelf.c:4202
#, c-format
msgid "cannot get line data section data: %s"
msgstr ""
-#: src/readelf.c:4070
+#: src/readelf.c:4215
#, c-format
msgid ""
"\n"
"Table at offset %Zu:\n"
msgstr ""
-#: src/readelf.c:4079
+#: src/readelf.c:4224
#, c-format
msgid "invalid data in section [%zu] '%s'"
msgstr ""
-#: src/readelf.c:4122
+#: src/readelf.c:4267
#, c-format
msgid ""
"\n"
@@ -1262,139 +1269,139 @@ msgid ""
"Opcodes:\n"
msgstr ""
-#: src/readelf.c:4148
+#: src/readelf.c:4293
#, c-format
msgid " [%*<PRIuFAST8>] %hhu argument\n"
msgid_plural " [%*<PRIuFAST8>] %hhu arguments\n"
msgstr[0] ""
msgstr[1] ""
-#: src/readelf.c:4156
+#: src/readelf.c:4301
msgid ""
"\n"
"Directory table:"
msgstr ""
-#: src/readelf.c:4172
+#: src/readelf.c:4317
msgid ""
"\n"
"File name table:\n"
" Entry Dir Time Size Name"
msgstr ""
-#: src/readelf.c:4201
+#: src/readelf.c:4346
msgid ""
"\n"
"Line number statements:"
msgstr ""
-#: src/readelf.c:4261
+#: src/readelf.c:4406
#, c-format
msgid " special opcode %u: address+%u = %#<PRIx64>, line%+d = %zu\n"
msgstr ""
-#: src/readelf.c:4281
+#: src/readelf.c:4426
#, c-format
msgid " extended opcode %u: "
msgstr ""
-#: src/readelf.c:4286
+#: src/readelf.c:4431
msgid "end of sequence"
msgstr ""
-#: src/readelf.c:4299
+#: src/readelf.c:4444
#, c-format
msgid "set address to %#<PRIx64>\n"
msgstr ""
-#: src/readelf.c:4319
+#: src/readelf.c:4464
#, c-format
msgid "define new file: dir=%u, mtime=%<PRIu64>, length=%<PRIu64>, name=%s\n"
msgstr ""
-#: src/readelf.c:4328
+#: src/readelf.c:4473
msgid "unknown opcode"
msgstr ""
-#: src/readelf.c:4340
+#: src/readelf.c:4485
msgid " copy"
msgstr ""
-#: src/readelf.c:4348
+#: src/readelf.c:4493
#, c-format
msgid " advance address by %u to %#<PRIx64>\n"
msgstr ""
-#: src/readelf.c:4358
+#: src/readelf.c:4503
#, c-format
msgid " advance line by constant %d to %<PRId64>\n"
msgstr ""
-#: src/readelf.c:4366
+#: src/readelf.c:4511
#, c-format
msgid " set file to %<PRIu64>\n"
msgstr ""
-#: src/readelf.c:4376
+#: src/readelf.c:4521
#, c-format
msgid " set column to %<PRIu64>\n"
msgstr ""
-#: src/readelf.c:4383
+#: src/readelf.c:4528
#, c-format
msgid " set '%s' to %<PRIuFAST8>\n"
msgstr ""
-#: src/readelf.c:4389
+#: src/readelf.c:4534
msgid " set basic block flag"
msgstr ""
-#: src/readelf.c:4397
+#: src/readelf.c:4542
#, c-format
msgid " advance address by constant %u to %#<PRIx64>\n"
msgstr ""
-#: src/readelf.c:4410
+#: src/readelf.c:4555
#, c-format
msgid " advance address by fixed value %u to %#<PRIx64>\n"
msgstr ""
-#: src/readelf.c:4417
+#: src/readelf.c:4562
msgid " set prologue end flag"
msgstr ""
-#: src/readelf.c:4422
+#: src/readelf.c:4567
msgid " set epilogue begin flag"
msgstr ""
-#: src/readelf.c:4431
+#: src/readelf.c:4576
#, c-format
msgid " unknown opcode with %<PRIu8> parameter:"
msgid_plural " unknown opcode with %<PRIu8> parameters:"
msgstr[0] ""
msgstr[1] ""
-#: src/readelf.c:4465
+#: src/readelf.c:4610
#, c-format
msgid "cannot get .debug_loc content: %s"
msgstr ""
-#: src/readelf.c:4570
+#: src/readelf.c:4715
#, c-format
msgid "cannot get macro information section data: %s"
msgstr ""
-#: src/readelf.c:4649
+#: src/readelf.c:4794
#, c-format
msgid "%*s*** non-terminated string at end of section"
msgstr ""
-#: src/readelf.c:4717
+#: src/readelf.c:4862
#, c-format
msgid " [%5d] DIE offset: %6<PRId64>, CU DIE offset: %6<PRId64>, name: %s\n"
msgstr ""
-#: src/readelf.c:4756
+#: src/readelf.c:4901
#, c-format
msgid ""
"\n"
@@ -1402,33 +1409,33 @@ msgid ""
" %*s String\n"
msgstr ""
-#: src/readelf.c:4769
+#: src/readelf.c:4914
#, c-format
msgid " *** error while reading strings: %s\n"
msgstr ""
-#: src/readelf.c:4794
+#: src/readelf.c:4939
#, c-format
msgid "cannot get debug context descriptor: %s"
msgstr ""
-#: src/readelf.c:4872
+#: src/readelf.c:5017
#, c-format
msgid ""
"\n"
"Note segment of %<PRId64> bytes at offset %#0<PRIx64>:\n"
msgstr ""
-#: src/readelf.c:4879
+#: src/readelf.c:5024
#, c-format
msgid "cannot get content of note section: %s"
msgstr ""
-#: src/readelf.c:4882
+#: src/readelf.c:5027
msgid " Owner Data size Type\n"
msgstr ""
-#: src/readelf.c:4922
+#: src/readelf.c:5067
#, c-format
msgid " %-13.*s %9<PRId32> %s\n"
msgstr ""
@@ -1645,261 +1652,285 @@ msgstr ""
msgid "cannot set access and modification date of '%s'"
msgstr ""
-#: src/ld.c:86
+#: src/ld.c:85
+msgid "Input File Control:"
+msgstr ""
+
+#: src/ld.c:87
msgid "Include whole archives in the output from now on."
msgstr ""
-#: src/ld.c:88
+#: src/ld.c:89
msgid "Stop including the whole arhives in the output."
msgstr ""
-#: src/ld.c:90 src/ld.c:132 src/ld.c:140
+#: src/ld.c:90 src/ld.c:104 src/ld.c:178
msgid "FILE"
msgstr ""
-#: src/ld.c:90
-msgid "Place output in FILE."
+#: src/ld.c:91
+msgid "Start a group."
msgstr ""
#: src/ld.c:92
-msgid "LEVEL"
+msgid "End a group."
msgstr ""
#: src/ld.c:93
-msgid "Set optimization level to LEVEL."
+msgid "PATH"
msgstr ""
-#: src/ld.c:95
-msgid "Verbose messages."
+#: src/ld.c:94
+msgid "Add PATH to list of directories files are searched in."
msgstr ""
#: src/ld.c:96
-msgid "Trace file opens."
+msgid "Only set DT_NEEDED for following dynamic libs if actually used"
msgstr ""
#: src/ld.c:98
-msgid "Trade speed for less memory usage"
+msgid "Always set DT_NEEDED for following dynamic libs"
msgstr ""
-#: src/ld.c:102
-msgid "Object is marked to not use default search path at runtime."
+#: src/ld.c:100
+msgid "Ignore LD_LIBRARY_PATH environment variable."
+msgstr ""
+
+#: src/ld.c:103
+msgid "Output File Control:"
msgstr ""
#: src/ld.c:104
+msgid "Place output in FILE."
+msgstr ""
+
+#: src/ld.c:107
+msgid "Object is marked to not use default search path at runtime."
+msgstr ""
+
+#: src/ld.c:109
msgid "Same as --whole-archive."
msgstr ""
-#: src/ld.c:105
+#: src/ld.c:110
msgid ""
"Default rules of extracting from archive; weak references are not enough."
msgstr ""
-#: src/ld.c:109
+#: src/ld.c:114
msgid "Weak references cause extraction from archive."
msgstr ""
-#: src/ld.c:111
+#: src/ld.c:116
msgid "Allow multiple definitions; first is used."
msgstr ""
-#: src/ld.c:113
+#: src/ld.c:118
msgid "Disallow/allow undefined symbols in DSOs."
msgstr ""
-#: src/ld.c:116
+#: src/ld.c:121
msgid "Object requires immediate handling of $ORIGIN."
msgstr ""
-#: src/ld.c:118
+#: src/ld.c:123
msgid "Relocation will not be processed lazily."
msgstr ""
-#: src/ld.c:120
+#: src/ld.c:125
msgid "Object cannot be unloaded at runtime."
msgstr ""
-#: src/ld.c:122
+#: src/ld.c:127
msgid "Mark object to be initialized first."
msgstr ""
-#: src/ld.c:124
+#: src/ld.c:129
msgid "Enable/disable lazy-loading flag for following dependencies."
msgstr ""
-#: src/ld.c:126
+#: src/ld.c:131
msgid "Mark object as not loadable with 'dlopen'."
msgstr ""
-#: src/ld.c:128
+#: src/ld.c:133
msgid "Ignore/record dependencies on unused DSOs."
msgstr ""
-#: src/ld.c:130
+#: src/ld.c:135
msgid "Generated DSO will be a system library."
msgstr ""
-#: src/ld.c:134
-msgid "Start a group."
+#: src/ld.c:136
+msgid "ADDRESS"
msgstr ""
-#: src/ld.c:135
-msgid "End a group."
+#: src/ld.c:136
+msgid "Set entry point address."
msgstr ""
-#: src/ld.c:137
-msgid "PATH"
+#: src/ld.c:139
+msgid "Do not link against shared libraries."
msgstr ""
-#: src/ld.c:138
-msgid "Add PATH to list of directories files are searched in."
+#: src/ld.c:142
+msgid "Prefer linking against shared libraries."
msgstr ""
-#: src/ld.c:140
-msgid "Use linker script in FILE."
+#: src/ld.c:143
+msgid "Export all dynamic symbols."
msgstr ""
-#: src/ld.c:142
-msgid "ADDRESS"
+#: src/ld.c:144
+msgid "Strip all symbols."
msgstr ""
-#: src/ld.c:142
-msgid "Set entry point address."
+#: src/ld.c:145
+msgid "Strip debugging symbols."
msgstr ""
-#: src/ld.c:146
-msgid "Do not link against shared libraries."
+#: src/ld.c:147
+msgid "Assume pagesize for the target system to be SIZE."
msgstr ""
#: src/ld.c:149
-msgid "Prefer linking against shared libraries."
+msgid "Set runtime DSO search path."
msgstr ""
-#: src/ld.c:151
-msgid "Export all dynamic symbols."
+#: src/ld.c:152
+msgid "Set link time DSO search path."
msgstr ""
#: src/ld.c:153
-msgid "Strip all symbols."
+msgid "Generate dynamic shared object."
msgstr ""
#: src/ld.c:154
-msgid "Strip debugging symbols."
+msgid "Generate relocatable object."
msgstr ""
#: src/ld.c:157
-msgid "Assume pagesize for the target system to be SIZE."
+msgid "Causes symbol not assigned to a version be reduced to local."
msgstr ""
-#: src/ld.c:162
-msgid "Set runtime DSO search path."
+#: src/ld.c:158
+msgid "Remove unused sections."
msgstr ""
-#: src/ld.c:165
-msgid "Set link time DSO search path."
+#: src/ld.c:161
+msgid "Don't remove unused sections."
msgstr ""
-#: src/ld.c:167
-msgid "Ignore LD_LIBRARY_PATH environment variable."
+#: src/ld.c:162
+msgid "Set soname of shared object."
msgstr ""
-#: src/ld.c:171
-msgid "Read version information from FILE."
+#: src/ld.c:163
+msgid "Set the dynamic linker name."
msgstr ""
-#: src/ld.c:173
-msgid "Set emulation to NAME."
+#: src/ld.c:166
+msgid "Add/suppress addition indentifying link-editor to .comment section"
msgstr ""
-#: src/ld.c:175
-msgid "Generate dynamic shared object."
+#: src/ld.c:169
+msgid "Create .eh_frame_hdr section"
msgstr ""
-#: src/ld.c:176
-msgid "Generate relocatable object."
+#: src/ld.c:171
+msgid "Linker Operation Control:"
msgstr ""
-#: src/ld.c:180
-msgid "Causes symbol not assigned to a version be reduced to local."
+#: src/ld.c:172
+msgid "Verbose messages."
msgstr ""
-#: src/ld.c:182
-msgid "Remove unused sections."
+#: src/ld.c:173
+msgid "Trace file opens."
msgstr ""
-#: src/ld.c:185
-msgid "Don't remove unused sections."
+#: src/ld.c:175
+msgid "Trade speed for less memory usage"
msgstr ""
-#: src/ld.c:187
-msgid "Set soname of shared object."
+#: src/ld.c:176
+msgid "LEVEL"
msgstr ""
-#: src/ld.c:188
-msgid "Set the dynamic linker name."
+#: src/ld.c:177
+msgid "Set optimization level to LEVEL."
msgstr ""
-#: src/ld.c:192
-msgid "Add/suppress addition indentifying link-editor to .comment section"
+#: src/ld.c:178
+msgid "Use linker script in FILE."
msgstr ""
-#: src/ld.c:197
+#: src/ld.c:181
msgid "Select to get parser debug information"
msgstr ""
-#: src/ld.c:204
+#: src/ld.c:184
+msgid "Read version information from FILE."
+msgstr ""
+
+#: src/ld.c:185
+msgid "Set emulation to NAME."
+msgstr ""
+
+#: src/ld.c:191
msgid "Combine object and archive files."
msgstr ""
-#: src/ld.c:207
+#: src/ld.c:194
msgid "[FILE]..."
msgstr ""
-#: src/ld.c:336
+#: src/ld.c:323
#, c-format
msgid "At least one input file needed"
msgstr ""
-#: src/ld.c:347
+#: src/ld.c:334
#, c-format
msgid "error while preparing linking"
msgstr ""
-#: src/ld.c:354
+#: src/ld.c:341
#, c-format
msgid "cannot open linker script '%s'"
msgstr ""
-#: src/ld.c:395
+#: src/ld.c:382
#, c-format
msgid "-( without matching -)"
msgstr ""
-#: src/ld.c:520 src/ld.c:558
+#: src/ld.c:507 src/ld.c:545
#, c-format
msgid "only one option of -G and -r is allowed"
msgstr ""
-#: src/ld.c:542
+#: src/ld.c:529
#, c-format
msgid "more than one '-m' parameter"
msgstr ""
-#: src/ld.c:552 src/ld.c:923
+#: src/ld.c:539 src/ld.c:925
#, c-format
msgid "unknown option `-%c %s'"
msgstr ""
-#: src/ld.c:594
+#: src/ld.c:581
#, c-format
msgid "invalid page size value '%s': ignored"
msgstr ""
-#: src/ld.c:704
+#: src/ld.c:697
#, c-format
msgid "More than one output file name given."
msgstr ""
-#: src/ld.c:721
+#: src/ld.c:714
#, c-format
msgid "Invalid optimization level `%s'"
msgstr ""
@@ -1914,321 +1945,326 @@ msgstr ""
msgid "-) without matching -("
msgstr ""
-#: src/ld.c:952
+#: src/ld.c:958
#, c-format
msgid "unknown option '-%c %s'"
msgstr ""
-#: src/ld.c:1056
+#: src/ld.c:1062
#, c-format
msgid "could not find input file to determine output file format"
msgstr ""
-#: src/ld.c:1058
+#: src/ld.c:1064
#, c-format
msgid "try again with an appropriate '-m' parameter"
msgstr ""
-#: src/ld.c:1350
+#: src/ld.c:1357
#, c-format
msgid "cannot read version script '%s'"
msgstr ""
-#: src/ld.c:1416 src/ld.c:1455
+#: src/ld.c:1423 src/ld.c:1462
#, c-format
msgid "duplicate definition of '%s' in linker script"
msgstr ""
-#: src/ldgeneric.c:191 src/ldgeneric.c:4476
+#: src/ldgeneric.c:202 src/ldgeneric.c:4555
#, c-format
msgid "cannot create string table"
msgstr ""
-#: src/ldgeneric.c:236
+#: src/ldgeneric.c:247
#, c-format
msgid "cannot load ld backend library '%s': %s"
msgstr ""
-#: src/ldgeneric.c:246
+#: src/ldgeneric.c:257
#, c-format
msgid "cannot find init function in ld backend library '%s': %s"
msgstr ""
-#: src/ldgeneric.c:291
+#: src/ldgeneric.c:302
#, c-format
msgid "%s listed more than once as input"
msgstr ""
-#: src/ldgeneric.c:405
+#: src/ldgeneric.c:416
#, c-format
msgid "%s (for -l%s)\n"
msgstr ""
-#: src/ldgeneric.c:406
+#: src/ldgeneric.c:417
#, c-format
msgid "%s (for DT_NEEDED %s)\n"
msgstr ""
-#: src/ldgeneric.c:500
+#: src/ldgeneric.c:511
#, c-format
msgid "cannot open %s"
msgstr ""
-#: src/ldgeneric.c:522
+#: src/ldgeneric.c:533
#, c-format
msgid "Warning: type of `%s' changed from %s in %s to %s in %s"
msgstr ""
-#: src/ldgeneric.c:535
+#: src/ldgeneric.c:546
#, c-format
msgid "Warning: size of `%s' changed from %<PRIu64> in %s to %<PRIu64> in %s"
msgstr ""
-#: src/ldgeneric.c:621
+#: src/ldgeneric.c:632
#, c-format
msgid "(%s+%#<PRIx64>): multiple definition of %s `%s'\n"
msgstr ""
-#: src/ldgeneric.c:651
+#: src/ldgeneric.c:662
#, c-format
msgid "(%s+%#<PRIx64>): first defined here\n"
msgstr ""
-#: src/ldgeneric.c:770
+#: src/ldgeneric.c:781
#, c-format
msgid "%s: cannot get section group data: %s"
msgstr ""
-#: src/ldgeneric.c:791
+#: src/ldgeneric.c:802
#, c-format
msgid "%s: section '%s' with group flag set does not belong to any group"
msgstr ""
-#: src/ldgeneric.c:836
+#: src/ldgeneric.c:847
#, c-format
msgid "%s: section [%2d] '%s' is in more than one section group"
msgstr ""
-#: src/ldgeneric.c:1072 src/ldgeneric.c:1264 src/ldgeneric.c:1273
-#: src/ldgeneric.c:1330 src/ldgeneric.c:1339 src/ldgeneric.c:1591
-#: src/ldgeneric.c:1843
+#: src/ldgeneric.c:1116 src/ldgeneric.c:1325 src/ldgeneric.c:1334
+#: src/ldgeneric.c:1391 src/ldgeneric.c:1400 src/ldgeneric.c:1662
+#: src/ldgeneric.c:1914
#, c-format
msgid "%s: invalid ELF file (%s:%d)\n"
msgstr ""
-#: src/ldgeneric.c:1165
+#: src/ldgeneric.c:1209
#, c-format
msgid "%s: only files of type ET_REL might contain section groups"
msgstr ""
-#: src/ldgeneric.c:1199
+#: src/ldgeneric.c:1243
#, c-format
msgid "%s: cannot determine signature of section group [%2zd] '%s': %s"
msgstr ""
-#: src/ldgeneric.c:1218
+#: src/ldgeneric.c:1262
#, c-format
msgid "%s: section '%s' has unknown type: %d"
msgstr ""
-#: src/ldgeneric.c:1567
+#: src/ldgeneric.c:1638
#, c-format
msgid "cannot get descriptor for ELF file (%s:%d): %s\n"
msgstr ""
-#: src/ldgeneric.c:1736
+#: src/ldgeneric.c:1807
#, c-format
msgid "cannot read archive `%s': %s"
msgstr ""
-#: src/ldgeneric.c:1858
+#: src/ldgeneric.c:1929
#, c-format
msgid "file of type %s cannot be linked in\n"
msgstr ""
-#: src/ldgeneric.c:1870
+#: src/ldgeneric.c:1941
+#, c-format
+msgid "%s: input file incompatible with ELF machine type %s\n"
+msgstr ""
+
+#: src/ldgeneric.c:1953
#, c-format
msgid "%s: cannot get section header string table index: %s\n"
msgstr ""
-#: src/ldgeneric.c:1899
+#: src/ldgeneric.c:1982
#, c-format
msgid "cannot use DSO '%s' when generating relocatable object file"
msgstr ""
-#: src/ldgeneric.c:1984
+#: src/ldgeneric.c:2067
#, c-format
msgid "input file '%s' ignored"
msgstr ""
-#: src/ldgeneric.c:2179
+#: src/ldgeneric.c:2262
#, c-format
msgid "undefined symbol `%s' in %s"
msgstr ""
-#: src/ldgeneric.c:2501
+#: src/ldgeneric.c:2579
#, c-format
msgid "cannot create ELF descriptor for output file: %s"
msgstr ""
-#: src/ldgeneric.c:2508
+#: src/ldgeneric.c:2586
#, c-format
msgid "could not create ELF header for output file: %s"
msgstr ""
-#: src/ldgeneric.c:3018 src/ldgeneric.c:3088 src/ldgeneric.c:3124
-#: src/ldgeneric.c:3811 src/ldgeneric.c:3849 src/ldgeneric.c:3881
-#: src/ldgeneric.c:4098 src/ldgeneric.c:4153 src/ldgeneric.c:4400
-#: src/ldgeneric.c:4456 src/ldgeneric.c:4898 src/ldgeneric.c:4910
+#: src/ldgeneric.c:3101 src/ldgeneric.c:3171 src/ldgeneric.c:3207
+#: src/ldgeneric.c:3890 src/ldgeneric.c:3928 src/ldgeneric.c:3960
+#: src/ldgeneric.c:4177 src/ldgeneric.c:4232 src/ldgeneric.c:4479
+#: src/ldgeneric.c:4535 src/ldgeneric.c:4999 src/ldgeneric.c:5011
#, c-format
msgid "cannot create section for output file: %s"
msgstr ""
-#: src/ldgeneric.c:3238
+#: src/ldgeneric.c:3321
#, c-format
msgid "address computation expression contains variable '%s'"
msgstr ""
-#: src/ldgeneric.c:3283
+#: src/ldgeneric.c:3366
#, c-format
msgid ""
"argument '%<PRIuMAX>' of ALIGN in address computation expression is no power "
"of two"
msgstr ""
-#: src/ldgeneric.c:3466
+#: src/ldgeneric.c:3549
#, c-format
msgid "cannot find entry symbol '%s': defaulting to %#0*<PRIx64>"
msgstr ""
-#: src/ldgeneric.c:3472
+#: src/ldgeneric.c:3555
#, c-format
msgid "no entry symbol specified: defaulting to %#0*<PRIx64>"
msgstr ""
-#: src/ldgeneric.c:3712 src/ldgeneric.c:3733 src/ldgeneric.c:3762
-#: src/ldgeneric.c:5408
+#: src/ldgeneric.c:3791 src/ldgeneric.c:3812 src/ldgeneric.c:3841
+#: src/ldgeneric.c:5511
#, c-format
msgid "cannot create symbol table for output file: %s"
msgstr ""
-#: src/ldgeneric.c:4623 src/ldgeneric.c:5150
+#: src/ldgeneric.c:4703 src/ldgeneric.c:5251
#, c-format
msgid "section index too large in dynamic symbol table"
msgstr ""
-#: src/ldgeneric.c:5043
+#: src/ldgeneric.c:5144
#, c-format
msgid "cannot create versioning section: %s"
msgstr ""
-#: src/ldgeneric.c:5116
+#: src/ldgeneric.c:5217
#, c-format
msgid "cannot create dynamic symbol table for output file: %s"
msgstr ""
-#: src/ldgeneric.c:5257
+#: src/ldgeneric.c:5361
#, c-format
msgid "cannot create hash table section for output file: %s"
msgstr ""
-#: src/ldgeneric.c:5336
+#: src/ldgeneric.c:5439
#, c-format
msgid "cannot create versioning data: %s"
msgstr ""
-#: src/ldgeneric.c:5440 src/ldgeneric.c:5453 src/ldgeneric.c:5517
-#: src/ldgeneric.c:5525
+#: src/ldgeneric.c:5543 src/ldgeneric.c:5556 src/ldgeneric.c:5620
+#: src/ldgeneric.c:5628
#, c-format
msgid "cannot create section header string section: %s"
msgstr ""
-#: src/ldgeneric.c:5447
+#: src/ldgeneric.c:5550
#, c-format
msgid "cannot create section header string section"
msgstr ""
-#: src/ldgeneric.c:5600
+#: src/ldgeneric.c:5710
#, c-format
msgid "cannot create program header: %s"
msgstr ""
-#: src/ldgeneric.c:5608
+#: src/ldgeneric.c:5718
#, c-format
msgid "while determining file layout: %s"
msgstr ""
-#: src/ldgeneric.c:5696
+#: src/ldgeneric.c:5813
#, c-format
msgid "internal error: nobits section follows nobits section"
msgstr ""
-#: src/ldgeneric.c:6192
+#: src/ldgeneric.c:6329
#, c-format
msgid "cannot get header of 0th section: %s"
msgstr ""
-#: src/ldgeneric.c:6208
+#: src/ldgeneric.c:6345
#, c-format
msgid "cannot update ELF header: %s"
msgstr ""
-#: src/ldgeneric.c:6229
+#: src/ldgeneric.c:6366
#, c-format
msgid "linker backend didn't specify function to relocate section"
msgstr ""
-#: src/ldgeneric.c:6241
+#: src/ldgeneric.c:6378
#, c-format
msgid "while writing output file: %s"
msgstr ""
-#: src/ldgeneric.c:6246
+#: src/ldgeneric.c:6383
#, c-format
msgid "while finishing output file: %s"
msgstr ""
-#: src/ldgeneric.c:6252
+#: src/ldgeneric.c:6389
#, c-format
msgid "cannot stat output file"
msgstr ""
-#: src/ldgeneric.c:6268
+#: src/ldgeneric.c:6405
#, c-format
msgid "WARNING: temporary output file overwritten before linking finished"
msgstr ""
-#: src/ldgeneric.c:6321 src/ldgeneric.c:6332 src/ldgeneric.c:6343
-#: src/ldgeneric.c:6361 src/ldgeneric.c:6374 src/ldgeneric.c:6386
+#: src/ldgeneric.c:6458 src/ldgeneric.c:6469 src/ldgeneric.c:6480
+#: src/ldgeneric.c:6498 src/ldgeneric.c:6511 src/ldgeneric.c:6523
#, c-format
msgid "no machine specific '%s' implementation"
msgstr ""
-#: src/ldscript.y:176
+#: src/ldscript.y:178
msgid "mode for segment invalid\n"
msgstr ""
-#: src/ldscript.y:459
+#: src/ldscript.y:465
#, c-format
msgid "while reading version script '%s': %s at line %d"
msgstr ""
-#: src/ldscript.y:460
+#: src/ldscript.y:466
#, c-format
msgid "while reading linker script '%s': %s at line %d"
msgstr ""
-#: src/ldscript.y:738
+#: src/ldscript.y:745
#, c-format
msgid "symbol '%s' in declared both local and global for unnamed version"
msgstr ""
-#: src/ldscript.y:740
+#: src/ldscript.y:747
#, c-format
msgid "symbol '%s' in declared both local and global for version '%s'"
msgstr ""
-#: src/ldscript.y:760 src/ldscript.y:767
+#: src/ldscript.y:767 src/ldscript.y:774
#, c-format
msgid "default visibility set as local and global"
msgstr ""
@@ -2392,13 +2428,13 @@ msgid ""
"section [%2d] '%s': section group [%2zu] '%s' does not preceed group member\n"
msgstr ""
-#: src/elflint.c:562 src/elflint.c:1265 src/elflint.c:1315 src/elflint.c:1423
-#: src/elflint.c:1703 src/elflint.c:2077 src/elflint.c:2238 src/elflint.c:2368
+#: src/elflint.c:562 src/elflint.c:1361 src/elflint.c:1411 src/elflint.c:1521
+#: src/elflint.c:2113 src/elflint.c:2476 src/elflint.c:2637 src/elflint.c:2767
#, c-format
msgid "section [%2d] '%s': cannot get section data\n"
msgstr ""
-#: src/elflint.c:574 src/elflint.c:1430
+#: src/elflint.c:574 src/elflint.c:1528
#, c-format
msgid ""
"section [%2d] '%s': referenced as string table for section [%2d] '%s' but "
@@ -2594,854 +2630,975 @@ msgid ""
"segment size %<PRIu64>\n"
msgstr ""
-#: src/elflint.c:991
+#: src/elflint.c:989
+#, c-format
+msgid "section [%2d] '%s': DT_RELCOUNT used for this RELA section\n"
+msgstr ""
+
+#: src/elflint.c:998 src/elflint.c:1050
#, c-format
msgid "section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"
msgstr ""
-#: src/elflint.c:1031
+#: src/elflint.c:1023 src/elflint.c:1075
+#, c-format
+msgid ""
+"section [%2d] '%s': relative relocations after index %d as specified by "
+"DT_RELCOUNT\n"
+msgstr ""
+
+#: src/elflint.c:1029 src/elflint.c:1081
+#, c-format
+msgid ""
+"section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT "
+"specified %d relative relocations\n"
+msgstr ""
+
+#: src/elflint.c:1041
+#, c-format
+msgid "section [%2d] '%s': DT_RELACOUNT used for this REL section\n"
+msgstr ""
+
+#: src/elflint.c:1123
#, c-format
msgid "section [%2d] '%s': invalid destination section index\n"
msgstr ""
-#: src/elflint.c:1044
+#: src/elflint.c:1136
#, c-format
msgid "section [%2d] '%s': invalid destination section type\n"
msgstr ""
-#: src/elflint.c:1052
+#: src/elflint.c:1144
#, c-format
msgid "section [%2d] '%s': sh_info should be zero\n"
msgstr ""
-#: src/elflint.c:1059
+#: src/elflint.c:1151
#, c-format
msgid "section [%2d] '%s': no relocations for merge-able sections possible\n"
msgstr ""
-#: src/elflint.c:1066
+#: src/elflint.c:1158
#, c-format
msgid "section [%2d] '%s': section entry size does not match ElfXX_Rela\n"
msgstr ""
-#: src/elflint.c:1067
+#: src/elflint.c:1159
#, c-format
msgid "section [%2d] '%s': section entry size does not match ElfXX_Rel\n"
msgstr ""
-#: src/elflint.c:1126
+#: src/elflint.c:1218
#, c-format
msgid "text relocation flag set but there is no read-only segment\n"
msgstr ""
-#: src/elflint.c:1153
+#: src/elflint.c:1245
#, c-format
msgid "section [%2d] '%s': relocation %zu: invalid type\n"
msgstr ""
-#: src/elflint.c:1161
+#: src/elflint.c:1253
#, c-format
msgid ""
"section [%2d] '%s': relocation %zu: relocation type invalid for the file "
"type\n"
msgstr ""
-#: src/elflint.c:1169
+#: src/elflint.c:1261
#, c-format
msgid "section [%2d] '%s': relocation %zu: invalid symbol index\n"
msgstr ""
-#: src/elflint.c:1183
+#: src/elflint.c:1279
#, c-format
msgid ""
"section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can "
"be used with %s\n"
msgstr ""
-#: src/elflint.c:1199
+#: src/elflint.c:1295
#, c-format
msgid "section [%2d] '%s': relocation %zu: offset out of bounds\n"
msgstr ""
-#: src/elflint.c:1214
+#: src/elflint.c:1310
#, c-format
msgid ""
"section [%2d] '%s': relocation %zu: copy relocation against symbol of type %"
"s\n"
msgstr ""
-#: src/elflint.c:1235
+#: src/elflint.c:1331
#, c-format
msgid ""
"section [%2d] '%s': relocation %zu: read-only section modified but text "
"relocation flag not set\n"
msgstr ""
-#: src/elflint.c:1250
+#: src/elflint.c:1346
#, c-format
msgid "section [%2d] '%s': relocations are against loaded and unloaded data\n"
msgstr ""
-#: src/elflint.c:1289 src/elflint.c:1339
+#: src/elflint.c:1385 src/elflint.c:1435
#, c-format
msgid "section [%2d] '%s': cannot get relocation %zu: %s\n"
msgstr ""
-#: src/elflint.c:1418
+#: src/elflint.c:1516
#, c-format
msgid "more than one dynamic section present\n"
msgstr ""
-#: src/elflint.c:1436
+#: src/elflint.c:1534
#, c-format
msgid "section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"
msgstr ""
-#: src/elflint.c:1441 src/elflint.c:1643
+#: src/elflint.c:1539 src/elflint.c:1831
#, c-format
msgid "section [%2d] '%s': sh_info not zero\n"
msgstr ""
-#: src/elflint.c:1451
+#: src/elflint.c:1549
#, c-format
msgid "section [%2d] '%s': cannot get dynamic section entry %zu: %s\n"
msgstr ""
-#: src/elflint.c:1459
+#: src/elflint.c:1557
#, c-format
msgid "section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n"
msgstr ""
-#: src/elflint.c:1466
+#: src/elflint.c:1564
#, c-format
msgid "section [%2d] '%s': entry %zu: unknown tag\n"
msgstr ""
-#: src/elflint.c:1477
+#: src/elflint.c:1575
#, c-format
msgid "section [%2d] '%s': entry %zu: more than one entry with tag %s\n"
msgstr ""
-#: src/elflint.c:1487
+#: src/elflint.c:1585
#, c-format
msgid "section [%2d] '%s': entry %zu: level 2 tag %s used\n"
msgstr ""
-#: src/elflint.c:1499
+#: src/elflint.c:1603
#, c-format
msgid ""
"section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"
msgstr ""
-#: src/elflint.c:1554
+#: src/elflint.c:1625
+#, c-format
+msgid ""
+"section [%2d] '%s': entry %zu: pointer does not match address of section [%"
+"2d] '%s' referenced by sh_link\n"
+msgstr ""
+
+#: src/elflint.c:1668
#, c-format
msgid ""
"section [%2d] '%s': entry %zu: %s value must point into loaded segment\n"
msgstr ""
-#: src/elflint.c:1572
+#: src/elflint.c:1683
+#, c-format
+msgid ""
+"section [%2d] '%s': entry %zu: %s value must be valid offset in section [%"
+"2d] '%s'\n"
+msgstr ""
+
+#: src/elflint.c:1703 src/elflint.c:1731
#, c-format
msgid "section [%2d] '%s': contains %s entry but not %s\n"
msgstr ""
-#: src/elflint.c:1584
+#: src/elflint.c:1715
#, c-format
msgid "section [%2d] '%s': mandatory tag %s not present\n"
msgstr ""
-#: src/elflint.c:1594 src/elflint.c:1601
+#: src/elflint.c:1724
+#, c-format
+msgid "section [%2d] '%s': no hash section present\n"
+msgstr ""
+
+#: src/elflint.c:1739 src/elflint.c:1746
#, c-format
msgid "section [%2d] '%s': not all of %s, %s, and %s are present\n"
msgstr ""
-#: src/elflint.c:1613
+#: src/elflint.c:1756 src/elflint.c:1760
+#, c-format
+msgid "section [%2d] '%s': %s tag missing in DSO marked during prelinking\n"
+msgstr ""
+
+#: src/elflint.c:1766
+#, c-format
+msgid "section [%2d] '%s': non-DSO file marked as dependency during prelink\n"
+msgstr ""
+
+#: src/elflint.c:1777 src/elflint.c:1781 src/elflint.c:1785 src/elflint.c:1789
+#, c-format
+msgid "section [%2d] '%s': %s tag missing in prelinked executable\n"
+msgstr ""
+
+#: src/elflint.c:1801
#, c-format
msgid ""
"section [%2d] '%s': only relocatable files can have extended section index\n"
msgstr ""
-#: src/elflint.c:1623
+#: src/elflint.c:1811
#, c-format
msgid ""
"section [%2d] '%s': extended section index section not for symbol table\n"
msgstr ""
-#: src/elflint.c:1628
+#: src/elflint.c:1816
#, c-format
msgid "cannot get data for symbol section\n"
msgstr ""
-#: src/elflint.c:1631 src/elflint.c:1717
+#: src/elflint.c:1819
#, c-format
msgid "section [%2d] '%s': entry size does not match Elf32_Word\n"
msgstr ""
-#: src/elflint.c:1638
+#: src/elflint.c:1826
#, c-format
msgid "section [%2d] '%s': extended index table too small for symbol table\n"
msgstr ""
-#: src/elflint.c:1653
+#: src/elflint.c:1841
#, c-format
msgid ""
"section [%2d] '%s': extended section index in section [%2zu] '%s' refers to "
"same symbol table\n"
msgstr ""
-#: src/elflint.c:1664
+#: src/elflint.c:1852
#, c-format
msgid "symbol 0 should have zero extended section index\n"
msgstr ""
-#: src/elflint.c:1676
+#: src/elflint.c:1864
#, c-format
msgid "cannot get data for symbol %zu\n"
msgstr ""
-#: src/elflint.c:1681
+#: src/elflint.c:1869
#, c-format
msgid "extended section index is %<PRIu32> but symbol index is not XINDEX\n"
msgstr ""
-#: src/elflint.c:1694
+#: src/elflint.c:1885 src/elflint.c:1926
#, c-format
-msgid "section [%2d] '%s': relocatable files cannot have hash tables\n"
+msgid ""
+"section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"
msgstr ""
-#: src/elflint.c:1712
+#: src/elflint.c:1897 src/elflint.c:1938
#, c-format
-msgid "section [%2d] '%s': hash table not for dynamic symbol table\n"
+msgid "section [%2d] '%s': chain array too large\n"
msgstr ""
-#: src/elflint.c:1722
+#: src/elflint.c:1906 src/elflint.c:1947
#, c-format
-msgid "section [%2d] '%s': not marked to be allocated\n"
+msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n"
+msgstr ""
+
+#: src/elflint.c:1912
+#, c-format
+msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n"
+msgstr ""
+
+#: src/elflint.c:1953
+#, c-format
+msgid "section [%2d] '%s': hash chain reference %<PRIu64> out of bounds\n"
msgstr ""
-#: src/elflint.c:1727
+#: src/elflint.c:1968
+#, c-format
+msgid "section [%2d] '%s': bitmask size not power of 2: %u\n"
+msgstr ""
+
+#: src/elflint.c:1979
#, c-format
msgid ""
-"section [%2d] '%s': hash table has not even room for nbucket and nchain\n"
+"section [%2d] '%s': hash table section is too small (is %ld, expected at "
+"least%ld)\n"
+msgstr ""
+
+#: src/elflint.c:1987
+#, c-format
+msgid "section [%2d] '%s': 2nd hash function shift too big: %u\n"
msgstr ""
-#: src/elflint.c:1737
+#: src/elflint.c:2019
#, c-format
msgid ""
-"section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"
+"section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n"
msgstr ""
-#: src/elflint.c:1748
+#: src/elflint.c:2040
#, c-format
-msgid "section [%2d] '%s': chain array not large enough\n"
+msgid ""
+"section [%2d] '%s': symbol %u referenced in chain for bucket %zu is "
+"undefined\n"
msgstr ""
-#: src/elflint.c:1753
+#: src/elflint.c:2050
#, c-format
-msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n"
+msgid ""
+"section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n"
msgstr ""
-#: src/elflint.c:1759
+#: src/elflint.c:2080
#, c-format
-msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n"
+msgid "section [%2d] '%s': hash chain for bucket %zu out of bounds\n"
+msgstr ""
+
+#: src/elflint.c:2085
+#, c-format
+msgid ""
+"section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n"
+msgstr ""
+
+#: src/elflint.c:2091
+#, c-format
+msgid "section [%2d] '%s': bitmask does not match names in the hash table\n"
+msgstr ""
+
+#: src/elflint.c:2104
+#, c-format
+msgid "section [%2d] '%s': relocatable files cannot have hash tables\n"
+msgstr ""
+
+#: src/elflint.c:2122
+#, c-format
+msgid "section [%2d] '%s': hash table not for dynamic symbol table\n"
+msgstr ""
+
+#: src/elflint.c:2130
+#, c-format
+msgid "section [%2d] '%s': hash table entry size incorrect\n"
+msgstr ""
+
+#: src/elflint.c:2135
+#, c-format
+msgid "section [%2d] '%s': not marked to be allocated\n"
msgstr ""
-#: src/elflint.c:1771
+#: src/elflint.c:2140
+#, c-format
+msgid ""
+"section [%2d] '%s': hash table has not even room for initial administrative "
+"entries\n"
+msgstr ""
+
+#: src/elflint.c:2170
#, c-format
msgid "section [%2d] '%s': nonzero sh_%s for NULL section\n"
msgstr ""
-#: src/elflint.c:1791
+#: src/elflint.c:2190
#, c-format
msgid ""
"section [%2d] '%s': section groups only allowed in relocatable object files\n"
msgstr ""
-#: src/elflint.c:1802
+#: src/elflint.c:2201
#, c-format
msgid "section [%2d] '%s': cannot get symbol table: %s\n"
msgstr ""
-#: src/elflint.c:1807
+#: src/elflint.c:2206
#, c-format
msgid "section [%2d] '%s': section reference in sh_link is no symbol table\n"
msgstr ""
-#: src/elflint.c:1813
+#: src/elflint.c:2212
#, c-format
msgid "section [%2d] '%s': invalid symbol index in sh_info\n"
msgstr ""
-#: src/elflint.c:1818
+#: src/elflint.c:2217
#, c-format
msgid "section [%2d] '%s': sh_flags not zero\n"
msgstr ""
-#: src/elflint.c:1823
+#: src/elflint.c:2222
#, c-format
msgid "section [%2d] '%s': sh_flags not set correctly\n"
msgstr ""
-#: src/elflint.c:1829
+#: src/elflint.c:2228
#, c-format
msgid "section [%2d] '%s': cannot get data: %s\n"
msgstr ""
-#: src/elflint.c:1838
+#: src/elflint.c:2237
#, c-format
msgid "section [%2d] '%s': section size not multiple of sizeof(Elf32_Word)\n"
msgstr ""
-#: src/elflint.c:1843
+#: src/elflint.c:2242
#, c-format
msgid "section [%2d] '%s': section group without flags word\n"
msgstr ""
-#: src/elflint.c:1849
+#: src/elflint.c:2248
#, c-format
msgid "section [%2d] '%s': section group without member\n"
msgstr ""
-#: src/elflint.c:1853
+#: src/elflint.c:2252
#, c-format
msgid "section [%2d] '%s': section group with only one member\n"
msgstr ""
-#: src/elflint.c:1864
+#: src/elflint.c:2263
#, c-format
msgid "section [%2d] '%s': unknown section group flags\n"
msgstr ""
-#: src/elflint.c:1876
+#: src/elflint.c:2275
#, c-format
msgid "section [%2d] '%s': section index %Zu out of range\n"
msgstr ""
-#: src/elflint.c:1885
+#: src/elflint.c:2284
#, c-format
msgid "section [%2d] '%s': cannot get section header for element %zu: %s\n"
msgstr ""
-#: src/elflint.c:1892
+#: src/elflint.c:2291
#, c-format
msgid "section [%2d] '%s': section group contains another group [%2d] '%s'\n"
msgstr ""
-#: src/elflint.c:1898
+#: src/elflint.c:2297
#, c-format
msgid ""
"section [%2d] '%s': element %Zu references section [%2d] '%s' without "
"SHF_GROUP flag set\n"
msgstr ""
-#: src/elflint.c:1905
+#: src/elflint.c:2304
#, c-format
msgid "section [%2d] '%s' is contained in more than one section group\n"
msgstr ""
-#: src/elflint.c:2091
+#: src/elflint.c:2490
#, c-format
msgid ""
"section [%2d] '%s' refers in sh_link to section [%2d] '%s' which is no "
"dynamic symbol table\n"
msgstr ""
-#: src/elflint.c:2102
+#: src/elflint.c:2501
#, c-format
msgid ""
"section [%2d] '%s' has different number of entries than symbol table [%2d] '%"
"s'\n"
msgstr ""
-#: src/elflint.c:2118
+#: src/elflint.c:2517
#, c-format
msgid "section [%2d] '%s': symbol %d: cannot read version data\n"
msgstr ""
-#: src/elflint.c:2134
+#: src/elflint.c:2533
#, c-format
msgid "section [%2d] '%s': symbol %d: local symbol with global scope\n"
msgstr ""
-#: src/elflint.c:2142
+#: src/elflint.c:2541
#, c-format
msgid "section [%2d] '%s': symbol %d: local symbol with version\n"
msgstr ""
-#: src/elflint.c:2156
+#: src/elflint.c:2555
#, c-format
msgid "section [%2d] '%s': symbol %d: invalid version index %d\n"
msgstr ""
-#: src/elflint.c:2161
+#: src/elflint.c:2560
#, c-format
msgid ""
"section [%2d] '%s': symbol %d: version index %d is for defined version\n"
msgstr ""
-#: src/elflint.c:2171
+#: src/elflint.c:2570
#, c-format
msgid ""
"section [%2d] '%s': symbol %d: version index %d is for requested version\n"
msgstr ""
-#: src/elflint.c:2223
+#: src/elflint.c:2622
#, c-format
msgid "more than one version reference section present\n"
msgstr ""
-#: src/elflint.c:2231 src/elflint.c:2360
+#: src/elflint.c:2630 src/elflint.c:2759
#, c-format
msgid "section [%2d] '%s': sh_link does not link to string table\n"
msgstr ""
-#: src/elflint.c:2254 src/elflint.c:2412
+#: src/elflint.c:2653 src/elflint.c:2811
#, c-format
msgid "section [%2d] '%s': entry %d has wrong version %d\n"
msgstr ""
-#: src/elflint.c:2260 src/elflint.c:2418
+#: src/elflint.c:2659 src/elflint.c:2817
#, c-format
msgid "section [%2d] '%s': entry %d has wrong offset of auxiliary data\n"
msgstr ""
-#: src/elflint.c:2268
+#: src/elflint.c:2667
#, c-format
msgid "section [%2d] '%s': entry %d has invalid file reference\n"
msgstr ""
-#: src/elflint.c:2276
+#: src/elflint.c:2675
#, c-format
msgid "section [%2d] '%s': entry %d references unknown dependency\n"
msgstr ""
-#: src/elflint.c:2288
+#: src/elflint.c:2687
#, c-format
msgid "section [%2d] '%s': auxiliary entry %d of entry %d has unknown flag\n"
msgstr ""
-#: src/elflint.c:2295
+#: src/elflint.c:2694
#, c-format
msgid ""
"section [%2d] '%s': auxiliary entry %d of entry %d has invalid name "
"reference\n"
msgstr ""
-#: src/elflint.c:2302
+#: src/elflint.c:2701
#, c-format
msgid ""
"section [%2d] '%s': auxiliary entry %d of entry %d has wrong hash value: %"
"#x, expected %#x\n"
msgstr ""
-#: src/elflint.c:2312
+#: src/elflint.c:2711
#, c-format
msgid ""
"section [%2d] '%s': auxiliary entry %d of entry %d has duplicate version "
"name '%s'\n"
msgstr ""
-#: src/elflint.c:2323
+#: src/elflint.c:2722
#, c-format
msgid ""
"section [%2d] '%s': auxiliary entry %d of entry %d has wrong next field\n"
msgstr ""
-#: src/elflint.c:2339 src/elflint.c:2497
+#: src/elflint.c:2738 src/elflint.c:2896
#, c-format
msgid "section [%2d] '%s': entry %d has invalid offset to next entry\n"
msgstr ""
-#: src/elflint.c:2352
+#: src/elflint.c:2751
#, c-format
msgid "more than one version definition section present\n"
msgstr ""
-#: src/elflint.c:2397
+#: src/elflint.c:2796
#, c-format
msgid "section [%2d] '%s': more than one BASE definition\n"
msgstr ""
-#: src/elflint.c:2401
+#: src/elflint.c:2800
#, c-format
msgid "section [%2d] '%s': BASE definition must have index VER_NDX_GLOBAL\n"
msgstr ""
-#: src/elflint.c:2407
+#: src/elflint.c:2806
#, c-format
msgid "section [%2d] '%s': entry %d has unknown flag\n"
msgstr ""
-#: src/elflint.c:2431
+#: src/elflint.c:2830
#, c-format
msgid "section [%2d] '%s': entry %d has invalid name reference\n"
msgstr ""
-#: src/elflint.c:2438
+#: src/elflint.c:2837
#, c-format
msgid "section [%2d] '%s': entry %d has wrong hash value: %#x, expected %#x\n"
msgstr ""
-#: src/elflint.c:2447
+#: src/elflint.c:2846
#, c-format
msgid "section [%2d] '%s': entry %d has duplicate version name '%s'\n"
msgstr ""
-#: src/elflint.c:2466
+#: src/elflint.c:2865
#, c-format
msgid ""
"section [%2d] '%s': entry %d has invalid name reference in auxiliary data\n"
msgstr ""
-#: src/elflint.c:2481
+#: src/elflint.c:2880
#, c-format
msgid "section [%2d] '%s': entry %d has wrong next field in auxiliary data\n"
msgstr ""
-#: src/elflint.c:2503
+#: src/elflint.c:2902
#, c-format
msgid "section [%2d] '%s': no BASE definition\n"
msgstr ""
-#: src/elflint.c:2519
+#: src/elflint.c:2918
#, c-format
msgid "section [%2d] '%s': unknown parent version '%s'\n"
msgstr ""
-#: src/elflint.c:2599
+#: src/elflint.c:2998
#, c-format
msgid "cannot get section header of zeroth section\n"
msgstr ""
-#: src/elflint.c:2603
+#: src/elflint.c:3002
#, c-format
msgid "zeroth section has nonzero name\n"
msgstr ""
-#: src/elflint.c:2605
+#: src/elflint.c:3004
#, c-format
msgid "zeroth section has nonzero type\n"
msgstr ""
-#: src/elflint.c:2607
+#: src/elflint.c:3006
#, c-format
msgid "zeroth section has nonzero flags\n"
msgstr ""
-#: src/elflint.c:2609
+#: src/elflint.c:3008
#, c-format
msgid "zeroth section has nonzero address\n"
msgstr ""
-#: src/elflint.c:2611
+#: src/elflint.c:3010
#, c-format
msgid "zeroth section has nonzero offset\n"
msgstr ""
-#: src/elflint.c:2613
+#: src/elflint.c:3012
#, c-format
msgid "zeroth section has nonzero info field\n"
msgstr ""
-#: src/elflint.c:2615
+#: src/elflint.c:3014
#, c-format
msgid "zeroth section has nonzero align value\n"
msgstr ""
-#: src/elflint.c:2617
+#: src/elflint.c:3016
#, c-format
msgid "zeroth section has nonzero entry size value\n"
msgstr ""
-#: src/elflint.c:2620
+#: src/elflint.c:3019
#, c-format
msgid ""
"zeroth section has nonzero size value while ELF header has nonzero shnum "
"value\n"
msgstr ""
-#: src/elflint.c:2624
+#: src/elflint.c:3023
#, c-format
msgid ""
"zeroth section has nonzero link value while ELF header does not signal "
"overflow in shstrndx\n"
msgstr ""
-#: src/elflint.c:2636
+#: src/elflint.c:3035
#, c-format
msgid "cannot get section header for section [%2zu] '%s': %s\n"
msgstr ""
-#: src/elflint.c:2645
+#: src/elflint.c:3044
#, c-format
msgid "section [%2zu]: invalid name\n"
msgstr ""
-#: src/elflint.c:2667
+#: src/elflint.c:3066
#, c-format
msgid "section [%2d] '%s' has wrong type: expected %s, is %s\n"
msgstr ""
-#: src/elflint.c:2681
+#: src/elflint.c:3080
#, c-format
msgid "section [%2zu] '%s' has wrong flags: expected %s, is %s\n"
msgstr ""
-#: src/elflint.c:2698
+#: src/elflint.c:3097
#, c-format
msgid ""
"section [%2zu] '%s' has wrong flags: expected %s and possibly %s, is %s\n"
msgstr ""
-#: src/elflint.c:2716
+#: src/elflint.c:3115
#, c-format
msgid "section [%2zu] '%s' present in object file\n"
msgstr ""
-#: src/elflint.c:2722 src/elflint.c:2754
+#: src/elflint.c:3121 src/elflint.c:3153
#, c-format
msgid ""
"section [%2zu] '%s' has SHF_ALLOC flag set but there is no loadable segment\n"
msgstr ""
-#: src/elflint.c:2727 src/elflint.c:2759
+#: src/elflint.c:3126 src/elflint.c:3158
#, c-format
msgid ""
"section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable "
"segments\n"
msgstr ""
-#: src/elflint.c:2735
+#: src/elflint.c:3134
#, c-format
msgid ""
"section [%2zu] '%s' is extension section index table in non-object file\n"
msgstr ""
-#: src/elflint.c:2770
+#: src/elflint.c:3169
#, c-format
msgid "section [%2zu] '%s': size not multiple of entry size\n"
msgstr ""
-#: src/elflint.c:2775
+#: src/elflint.c:3174
#, c-format
msgid "cannot get section header\n"
msgstr ""
-#: src/elflint.c:2784
+#: src/elflint.c:3183
#, c-format
msgid "section [%2zu] '%s' has unsupported type %d\n"
msgstr ""
-#: src/elflint.c:2792
+#: src/elflint.c:3191
#, c-format
msgid "section [%2zu] '%s' contains unknown flag(s) %#<PRIx64>\n"
msgstr ""
-#: src/elflint.c:2800
+#: src/elflint.c:3199
#, c-format
msgid "section [%2zu] '%s': thread-local data sections address not zero\n"
msgstr ""
-#: src/elflint.c:2808
+#: src/elflint.c:3207
#, c-format
msgid "section [%2zu] '%s': invalid section reference in link value\n"
msgstr ""
-#: src/elflint.c:2813
+#: src/elflint.c:3212
#, c-format
msgid "section [%2zu] '%s': invalid section reference in info value\n"
msgstr ""
-#: src/elflint.c:2820
+#: src/elflint.c:3219
#, c-format
msgid "section [%2zu] '%s': strings flag set without merge flag\n"
msgstr ""
-#: src/elflint.c:2825
+#: src/elflint.c:3224
#, c-format
msgid "section [%2zu] '%s': merge flag set but entry size is zero\n"
msgstr ""
-#: src/elflint.c:2852
+#: src/elflint.c:3251
#, c-format
msgid ""
"section [%2zu] '%s' not fully contained in segment of program header entry %"
"d\n"
msgstr ""
-#: src/elflint.c:2860
+#: src/elflint.c:3259
#, c-format
msgid ""
"section [%2zu] '%s' has type NOBITS but is read from the file in segment of "
"program header entry %d\n"
msgstr ""
-#: src/elflint.c:2869
+#: src/elflint.c:3268
#, c-format
msgid ""
"section [%2zu] '%s' has not type NOBITS but is not read from the file in "
"segment of program header entry %d\n"
msgstr ""
-#: src/elflint.c:2878
+#: src/elflint.c:3277
#, c-format
msgid ""
"section [%2zu] '%s': alloc flag set but section not in any loaded segment\n"
msgstr ""
-#: src/elflint.c:2884
+#: src/elflint.c:3283
#, c-format
msgid ""
"section [%2zu] '%s': ELF header says this is the section header string table "
"but type is not SHT_TYPE\n"
msgstr ""
-#: src/elflint.c:2892
+#: src/elflint.c:3291
#, c-format
msgid ""
"section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"
msgstr ""
-#: src/elflint.c:2933
+#: src/elflint.c:3333
#, c-format
msgid "more than one version symbol table present\n"
msgstr ""
-#: src/elflint.c:2952
+#: src/elflint.c:3352
#, c-format
msgid "INTERP program header entry but no .interp section\n"
msgstr ""
-#: src/elflint.c:2957
+#: src/elflint.c:3357
#, c-format
msgid ""
"no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section "
"exist\n"
msgstr ""
-#: src/elflint.c:2970
+#: src/elflint.c:3370
#, c-format
msgid "duplicate version index %d\n"
msgstr ""
-#: src/elflint.c:2984
+#: src/elflint.c:3384
#, c-format
msgid ".gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n"
msgstr ""
-#: src/elflint.c:2996
+#: src/elflint.c:3396
#, c-format
msgid "phdr[%d]: no note entries defined for the type of file\n"
msgstr ""
-#: src/elflint.c:3083
+#: src/elflint.c:3483
#, c-format
msgid "phdr[%d]: note entries probably in form of a 32-bit ELF file\n"
msgstr ""
-#: src/elflint.c:3086
+#: src/elflint.c:3486
#, c-format
msgid "phdr[%d]: extra %zu bytes after last note\n"
msgstr ""
-#: src/elflint.c:3115
+#: src/elflint.c:3515
#, c-format
msgid "phdr[%d]: unknown core file note type %<PRIu64> at offset %<PRIu64>\n"
msgstr ""
-#: src/elflint.c:3123
+#: src/elflint.c:3523
#, c-format
msgid "phdr[%d]: unknown object file note type %<PRIu64> at offset %<PRIu64>\n"
msgstr ""
-#: src/elflint.c:3145
+#: src/elflint.c:3545
#, c-format
msgid ""
"only executables, shared objects, and core files can have program headers\n"
msgstr ""
-#: src/elflint.c:3160
+#: src/elflint.c:3560
#, c-format
msgid "cannot get program header entry %d: %s\n"
msgstr ""
-#: src/elflint.c:3169
+#: src/elflint.c:3569
#, c-format
msgid "program header entry %d: unknown program header entry type %#<PRIx64>\n"
msgstr ""
-#: src/elflint.c:3180
+#: src/elflint.c:3580
#, c-format
msgid "more than one INTERP entry in program header\n"
msgstr ""
-#: src/elflint.c:3188
+#: src/elflint.c:3588
#, c-format
msgid "more than one TLS entry in program header\n"
msgstr ""
-#: src/elflint.c:3195
+#: src/elflint.c:3595
#, c-format
msgid "static executable cannot have dynamic sections\n"
msgstr ""
-#: src/elflint.c:3209
+#: src/elflint.c:3609
#, c-format
msgid "dynamic section reference in program header has wrong offset\n"
msgstr ""
-#: src/elflint.c:3212
+#: src/elflint.c:3612
#, c-format
msgid "dynamic section size mismatch in program and section header\n"
msgstr ""
-#: src/elflint.c:3222
+#: src/elflint.c:3622
#, c-format
msgid "more than one GNU_RELRO entry in program header\n"
msgstr ""
-#: src/elflint.c:3243
+#: src/elflint.c:3643
#, c-format
msgid "loadable segment GNU_RELRO applies to is not writable\n"
msgstr ""
-#: src/elflint.c:3246
+#: src/elflint.c:3646
#, c-format
msgid "loadable segment GNU_RELRO applies to is executable\n"
msgstr ""
-#: src/elflint.c:3253 src/elflint.c:3276
+#: src/elflint.c:3653 src/elflint.c:3676
#, c-format
msgid "%s segment not contained in a loaded segment\n"
msgstr ""
-#: src/elflint.c:3282
+#: src/elflint.c:3682
#, c-format
msgid "program header offset in ELF header and PHDR entry do not match"
msgstr ""
-#: src/elflint.c:3287
+#: src/elflint.c:3687
#, c-format
msgid "program header entry %d: file size greater than memory size\n"
msgstr ""
-#: src/elflint.c:3294
+#: src/elflint.c:3694
#, c-format
msgid "program header entry %d: alignment not a power of 2\n"
msgstr ""
-#: src/elflint.c:3297
+#: src/elflint.c:3697
#, c-format
msgid ""
"program header entry %d: file offset and virtual address not module of "
"alignment\n"
msgstr ""
-#: src/elflint.c:3333
+#: src/elflint.c:3733
#, c-format
msgid "cannot read ELF header: %s\n"
msgstr ""
-#: src/elflint.c:3354
+#: src/elflint.c:3754
#, c-format
msgid "text relocation flag set but not needed\n"
msgstr ""
@@ -3454,16 +3611,20 @@ msgstr ""
msgid "Show only base names of source files"
msgstr ""
-#: src/addr2line.c:66
-msgid "Additional show function names"
+#: src/addr2line.c:67
+msgid "Show absolute file names using compilation directory"
+msgstr ""
+
+#: src/addr2line.c:68
+msgid "Also show function names"
msgstr ""
-#: src/addr2line.c:77
+#: src/addr2line.c:79
msgid ""
"Locate source files and line information for ADDRs (in a.out by default)."
msgstr ""
-#: src/addr2line.c:81
+#: src/addr2line.c:83
msgid "[ADDR...]"
msgstr ""
diff --git a/elfutils/src/ChangeLog b/elfutils/src/ChangeLog
index 3927c44a..5a12ac62 100644
--- a/elfutils/src/ChangeLog
+++ b/elfutils/src/ChangeLog
@@ -1,3 +1,164 @@
+2006-08-08 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
+ Keep track of which "high DT" entries are present.
+ Check that either old or GNU-style hash table is present.
+ If GNU-style hash table is used a symbol table is mandatory.
+ Check that if any prelink entry is present all of them are.
+ (check_gnu_hash): Only fail for undefined symbols in GNU-style hash
+ table if they don't refer to functions.
+
+2006-07-17 Roland McGrath <roland@redhat.com>
+
+ * elflint.c (struct version_namelist): Use GElf_Versym for `ndx' field.
+ (add_version): Likewise for argument.
+ (check_versym): Cast constant to GElf_Versym for comparison.
+
+2006-07-12 Roland McGrath <roland@redhat.com>
+
+ * readelf.c (handle_gnu_hash): Add casts for machines where
+ Elf32_Word != unsigned int.
+
+2006-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c (check_sysv_hash64): Fix printf format.
+
+2006-07-11 Roland McGrath <roland@redhat.com>
+
+ * addr2line.c (options): English fix in -f doc string.
+
+ * addr2line.c (use_comp_dir): New variable.
+ (options, parse_opt): Grok -A/--absolute to set it.
+ (handle_address): If set, prepend dwfl_line_comp_dir results to
+ relative file names.
+
+2006-07-06 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c: Adjust for latest new hash table format.
+ * readelf.c: Likewise.
+
+ * elflint.c (check_versym): Ignore hidden bit when comparing version
+ numbers.
+
+2006-07-05 Ulrich Drepper <drepper@redhat.com>
+
+ * ldgeneric.c (ld_generic_create_outfile): Correctly recognize
+ discarded COMDAT symbols.
+
+ * i386_ld.c (elf_i386_count_relocations): Lot of corrections.
+ (elf_i386_create_relocations): Likewise.
+ * ld.h (struct symbol): Add local and hidden bits.
+ * ld.c (create_special_section_symbol): These synthsized symbols
+ are local and hidden.
+ * ldgeneric.c (file_process2): Check whether input file matches
+ the emulation.
+ (fillin_special_symbol): Create symbols as local and/or hidden
+ if requested.
+ (ld_generic_create_outfile): Make local copy of symbol.
+ Don't hide global, defined symbols in dynamic symbol table unless
+ requested. Synthetic symbols have no version information.
+
+ * elflint.c: Add support for checking 64-bit SysV-style hash tables.
+ * readelf.c: Add support for printing 64-bit SysV-style hash tables.
+
+2006-07-04 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c (is_rel_dyn): Fix and extend DT_RELCOUNT/DT_RELACOUNT
+ testing.
+
+2006-07-03 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c: Add testing of DT_GNU_HASH.
+ * readelf.c: Implement showing histogram for DT_GNU_HASH section.
+
+ * Makefile.am: Add hacks to create dependency files for non-generic
+ linker.
+
+2006-06-12 Ulrich Drepper <drepper@redhat.com>
+
+ * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
+ section if creating a DSO and no interpreter is given.
+ (ld_generic_create_outfile): Don't store reference to symbols in
+ discarded COMDAT groups. Don't create PHDR and INTERP program header
+ for DSO if no interpreter is specified.
+ (create_verneed_data): Pretty printing.
+
+ * ldscript.y (content): If a DSO is created don't set default
+ interpreter from linker script.
+
+ * i386_ld.c (elf_i386_count_relocations): Do not add relocations
+ for symbols in discarded COMDAT groups.
+ (elf_i386_create_relocations): Likewise.
+ * ld.h (struct scninfo): Add unused_comdat.
+ * ldgeneric.c (add_section): Also check group signature when
+ matching COMDAT sections.
+ (add_relocatable_file): Ignore symbols in COMDAT group which are
+ discarded.
+
+ * elflint.c (check_one_reloc): For *_NONE relocs only check type
+ and symbol reference.
+
+2006-06-11 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c (check_dynamic): Fix checking value of tags which are
+ offsets in the string section. Make sure DT_STRTAB points to the
+ section referenced in sh_link.
+
+ * ld.c (options): Add headers. Add short option 'R' for '--rpath'.
+
+ * ld.c: Recognize --eh-frame-hdr option.
+ * ld.h (struct ld_state): Add eh_frame_hdr field.
+ * ldgeneric.c (struct unw_eh_frame_hdr): Define.
+
+ * ldgeneric.c (add_section): Use ebl_sh_flags_combine instead of
+ SH_FLAGS_COMBINE.
+ (add_relocatable_file): Minor optimization of last change.
+ (match_section): Don't preserve SHF_GROUP flag any longer.
+
+2006-06-10 Ulrich Drepper <drepper@redhat.com>
+
+ * ld.c (parse_z_option): Recognize execstack and noexecstack.
+ Handle record and ignore as position dependent options.
+ (parse_z_option_2): Handle ignore and record here.
+ * ld.h (struct ld_state): Add execstack field.
+ * ldgeneric.c (add_relocatable_file): Recognize .note.GNU-stack
+ sections.
+ (ld_generic_create_outfile): Fix program header creation in native
+ linker. Add PT_GNU_STACK program header.
+
+2006-06-09 Ulrich Drepper <drepper@redhat.com>
+
+ * i386_ld.c (elf_i386_finalize_plt): Don't change symbol table entries
+ for PLT entries if there is no local definition.
+
+ * ld.c (parse_option): Handle -z ignore like --as-needed and
+ -z record like --no-as-needed.
+ * ld.h (struct ld_state): Remove ignore_unused_dsos field.
+ * ldgeneric.c (new_generated_scn): Always compute ndt_needed by
+ looping over DSOs. When deciding about adding DT_NEEDED entries
+ use ->as_needed instead of ignore_unused_dsos.
+
+2006-05-31 Ulrich Drepper <drepper@redhat.com>
+
+ * ld.c: Recognize --as-needed and --no-as-needed options.
+ * ld.h (struct usedfile): Add as_needed field.
+ (struct ld_state): Likewise.
+ * ldgeneric.c (ld_handle_filename_list): Copy as_needed flag from
+ the list.
+ * ldscript.y (filename_id_list): Split to correctly parse all
+ combinations.
+ (mark_as_needed): Fix loop.
+
+2006-05-28 Ulrich Drepper <drepper@redhat.com>
+
+ * addr2line.c (print_dwarf_function): Use unsigned type for lineno
+ and colno.
+
+2006-05-27 Ulrich Drepper <drepper@redhat.com>
+
+ * readelf.c (handle_relocs_rela): Better notations for addon value.
+ (print_ehdr): Distinguish e_ident[EI_VERSION] from e_version.
+
2006-04-04 Ulrich Drepper <drepper@redhat.com>
* addr2line.c: Update copyright year.
diff --git a/elfutils/src/Makefile.am b/elfutils/src/Makefile.am
index 49e01740..604483ab 100644
--- a/elfutils/src/Makefile.am
+++ b/elfutils/src/Makefile.am
@@ -63,6 +63,12 @@ else
noinst_LIBRARIES = libld_elf.a $(ld_dsos)
noinst_PROGRAMS = $(ld_dsos:_pic.a=.so)
endif
+if NEVER
+# We never build this library but we need to get the dependency files
+# of all the linker backends that might be used in a non-generic linker.
+noinst_LIBRARIES += libdummy.a
+libdummy_a_SOURCES = i386_ld.c
+endif
textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@@ -102,6 +108,7 @@ size_LDADD = $(libelf) $(libeu) $(libmudflap)
strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
if NATIVE_LD
+# -ldl is always needed for libebl.
ld_LDADD += libld_elf.a
endif
ld_LDFLAGS = -rdynamic
@@ -117,9 +124,10 @@ ldlex.o: ldscript.c
ldlex_no_Werror = yes
ldscript.h: ldscript.c
+if NATIVE_LD
# Machine-specific linker code.
-libld_elf_a_SOURCES = $(base_cpu)_ld.c
-
+libld_elf_a_SOURCES := $(base_cpu)_ld.c
+else
libld_elf_i386_pic_a_SOURCES =
am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
@@ -129,6 +137,7 @@ libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map
$(libelf) $(libeu) \
-Wl,--version-script,$(srcdir)/libld_elf_i386.map
$(textrel_check)
+endif
%.os: %.c %.o
diff --git a/elfutils/src/Makefile.in b/elfutils/src/Makefile.in
index 00bc433e..a76b6373 100644
--- a/elfutils/src/Makefile.in
+++ b/elfutils/src/Makefile.in
@@ -43,7 +43,12 @@ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \
findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \
objdump$(EXEEXT) ranlib$(EXEEXT) strings$(EXEEXT)
@NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
-@NATIVE_LD_TRUE@am__append_1 = libld_elf.a
+# We never build this library but we need to get the dependency files
+# of all the linker backends that might be used in a non-generic linker.
+@NEVER_TRUE@am__append_1 = libdummy.a
+# -ldl is always needed for libebl.
+@NATIVE_LD_TRUE@am__append_2 = libld_elf.a
+@NATIVE_LD_TRUE@am_libld_elf_i386_pic_a_OBJECTS =
subdir = src
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in ChangeLog ldlex.c ldscript.c ylwrap
@@ -58,9 +63,15 @@ CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
+libdummy_a_AR = $(AR) $(ARFLAGS)
+libdummy_a_LIBADD =
+am__libdummy_a_SOURCES_DIST = i386_ld.c
+@NEVER_TRUE@am_libdummy_a_OBJECTS = i386_ld.$(OBJEXT)
+libdummy_a_OBJECTS = $(am_libdummy_a_OBJECTS)
libld_elf_a_AR = $(AR) $(ARFLAGS)
libld_elf_a_LIBADD =
-am_libld_elf_a_OBJECTS = $(base_cpu)_ld.$(OBJEXT)
+am__libld_elf_a_SOURCES_DIST = $(base_cpu)_ld.c
+@NATIVE_LD_TRUE@am_libld_elf_a_OBJECTS = $(base_cpu)_ld.$(OBJEXT)
libld_elf_a_OBJECTS = $(am_libld_elf_a_OBJECTS)
libld_elf_i386_pic_a_AR = $(AR) $(ARFLAGS)
libld_elf_i386_pic_a_LIBADD =
@@ -142,14 +153,15 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
-SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \
- addr2line.c elfcmp.c elflint.c findtextrel.c $(ld_SOURCES) \
- $(libld_elf_i386_so_SOURCES) nm.c objdump.c ranlib.c readelf.c \
- size.c strings.c strip.c
-DIST_SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \
- addr2line.c elfcmp.c elflint.c findtextrel.c $(ld_SOURCES) \
- $(libld_elf_i386_so_SOURCES) nm.c objdump.c ranlib.c readelf.c \
- size.c strings.c strip.c
+SOURCES = $(libdummy_a_SOURCES) $(libld_elf_a_SOURCES) \
+ $(libld_elf_i386_pic_a_SOURCES) addr2line.c elfcmp.c elflint.c \
+ findtextrel.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \
+ objdump.c ranlib.c readelf.c size.c strings.c strip.c
+DIST_SOURCES = $(am__libdummy_a_SOURCES_DIST) \
+ $(am__libld_elf_a_SOURCES_DIST) \
+ $(libld_elf_i386_pic_a_SOURCES) addr2line.c elfcmp.c elflint.c \
+ findtextrel.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \
+ objdump.c ranlib.c readelf.c size.c strings.c strip.c
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -207,6 +219,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -285,9 +299,11 @@ AM_YFLAGS = -pld
AM_LFLAGS = -Pld -olex.yy.c
native_ld = @native_ld@
ld_dsos = libld_elf_i386_pic.a
-@NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a $(ld_dsos)
-@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a
+@NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a $(ld_dsos) \
+@NATIVE_LD_FALSE@ $(am__append_1)
+@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a $(am__append_1)
@NATIVE_LD_TRUE@native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
+@NEVER_TRUE@libdummy_a_SOURCES = i386_ld.c
textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
versionhash.c
@@ -314,7 +330,7 @@ nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
size_LDADD = $(libelf) $(libeu) $(libmudflap)
strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
- $(am__append_1)
+ $(am__append_2)
ld_LDFLAGS = -rdynamic
elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
@@ -326,10 +342,10 @@ strings_LDADD = $(libelf) $(libeu) $(libmudflap)
ldlex_no_Werror = yes
# Machine-specific linker code.
-libld_elf_a_SOURCES = $(base_cpu)_ld.c
-libld_elf_i386_pic_a_SOURCES =
-am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
-libld_elf_i386_so_SOURCES =
+@NATIVE_LD_TRUE@libld_elf_a_SOURCES := $(base_cpu)_ld.c
+@NATIVE_LD_FALSE@libld_elf_i386_pic_a_SOURCES =
+@NATIVE_LD_FALSE@am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
+@NATIVE_LD_FALSE@libld_elf_i386_so_SOURCES =
CLEANFILES = none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv
all: all-am
@@ -367,6 +383,10 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdummy.a: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
+ -rm -f libdummy.a
+ $(libdummy_a_AR) libdummy.a $(libdummy_a_OBJECTS) $(libdummy_a_LIBADD)
+ $(RANLIB) libdummy.a
libld_elf.a: $(libld_elf_a_OBJECTS) $(libld_elf_a_DEPENDENCIES)
-rm -f libld_elf.a
$(libld_elf_a_AR) libld_elf.a $(libld_elf_a_OBJECTS) $(libld_elf_a_LIBADD)
@@ -416,6 +436,9 @@ findtextrel$(EXEEXT): $(findtextrel_OBJECTS) $(findtextrel_DEPENDENCIES)
ld$(EXEEXT): $(ld_OBJECTS) $(ld_DEPENDENCIES)
@rm -f ld$(EXEEXT)
$(LINK) $(ld_LDFLAGS) $(ld_OBJECTS) $(ld_LDADD) $(LIBS)
+@NATIVE_LD_TRUE@libld_elf_i386.so$(EXEEXT): $(libld_elf_i386_so_OBJECTS) $(libld_elf_i386_so_DEPENDENCIES)
+@NATIVE_LD_TRUE@ @rm -f libld_elf_i386.so$(EXEEXT)
+@NATIVE_LD_TRUE@ $(LINK) $(libld_elf_i386_so_LDFLAGS) $(libld_elf_i386_so_OBJECTS) $(libld_elf_i386_so_LDADD) $(LIBS)
nm$(EXEEXT): $(nm_OBJECTS) $(nm_DEPENDENCIES)
@rm -f nm$(EXEEXT)
$(LINK) $(nm_LDFLAGS) $(nm_OBJECTS) $(nm_LDADD) $(LIBS)
@@ -449,6 +472,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfcmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflint.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findtextrel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_ld.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ld.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldgeneric.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldlex.Po@am__quote@
@@ -679,11 +703,11 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
ldlex.o: ldscript.c
ldscript.h: ldscript.c
-libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- $(libelf) $(libeu) \
- -Wl,--version-script,$(srcdir)/libld_elf_i386.map
- $(textrel_check)
+@NATIVE_LD_FALSE@libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map
+@NATIVE_LD_FALSE@ $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+@NATIVE_LD_FALSE@ $(libelf) $(libeu) \
+@NATIVE_LD_FALSE@ -Wl,--version-script,$(srcdir)/libld_elf_i386.map
+@NATIVE_LD_FALSE@ $(textrel_check)
%.os: %.c %.o
if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \
diff --git a/elfutils/src/addr2line.c b/elfutils/src/addr2line.c
index bc0ea803..1229ce48 100644
--- a/elfutils/src/addr2line.c
+++ b/elfutils/src/addr2line.c
@@ -63,7 +63,9 @@ static const struct argp_option options[] =
{
{ NULL, 0, NULL, 0, N_("Output Selection:"), 0 },
{ "basenames", 's', NULL, 0, N_("Show only base names of source files"), 0 },
- { "functions", 'f', NULL, 0, N_("Additional show function names"), 0 },
+ { "absolute", 'A', NULL, 0,
+ N_("Show absolute file names using compilation directory"), 0 },
+ { "functions", 'f', NULL, 0, N_("Also show function names"), 0 },
{ NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 },
/* Unsupported options. */
@@ -99,6 +101,9 @@ static void handle_address (GElf_Addr addr, Dwfl *dwfl);
/* True if only base names of files should be shown. */
static bool only_basenames;
+/* True if absolute file names based on DW_AT_comp_dir should be shown. */
+static bool use_comp_dir;
+
/* True if function names should be shown. */
static bool show_functions;
@@ -207,6 +212,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
only_basenames = true;
break;
+ case 'A':
+ use_comp_dir = true;
+ break;
+
case 'f':
show_functions = true;
break;
@@ -258,7 +267,8 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr)
&attr_mem), &val) == 0)
{
const char *file = dwarf_filesrc (files, val, NULL, NULL);
- int lineno = 0, colno = 0;
+ unsigned int lineno = 0;
+ unsigned int colno = 0;
if (dwarf_formudata (dwarf_attr (&scopes[i],
DW_AT_call_line,
&attr_mem), &val) == 0)
@@ -306,13 +316,24 @@ handle_address (GElf_Addr addr, Dwfl *dwfl)
if (line != NULL && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol,
NULL, NULL)) != NULL)
{
+ const char *comp_dir = "";
+ const char *comp_dir_sep = "";
+
if (only_basenames)
src = basename (src);
+ else if (use_comp_dir && src[0] != '/')
+ {
+ comp_dir = dwfl_line_comp_dir (line);
+ if (comp_dir != NULL)
+ comp_dir_sep = "/";
+ }
if (linecol != 0)
- printf ("%s:%d:%d\n", src, lineno, linecol);
+ printf ("%s%s%s:%d:%d\n",
+ comp_dir, comp_dir_sep, src, lineno, linecol);
else
- printf ("%s:%d\n", src, lineno);
+ printf ("%s%s%s:%d\n",
+ comp_dir, comp_dir_sep, src, lineno);
}
else
puts ("??:0");
diff --git a/elfutils/src/elflint.c b/elfutils/src/elflint.c
index 0a415b00..c96e8ab0 100644
--- a/elfutils/src/elflint.c
+++ b/elfutils/src/elflint.c
@@ -951,14 +951,14 @@ section [%2d] '%s': _DYNAMIC symbol size %" PRIu64 " does not match dynamic segm
static bool
is_rel_dyn (Ebl *ebl, const GElf_Ehdr *ehdr, int idx, const GElf_Shdr *shdr,
- bool rela)
+ bool is_rela)
{
/* If this is no executable or DSO it cannot be a .rel.dyn section. */
if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN)
return false;
/* Check the section name. Unfortunately necessary. */
- if (strcmp (section_name (ebl, idx), rela ? ".rela.dyn" : ".rel.dyn"))
+ if (strcmp (section_name (ebl, idx), is_rela ? ".rela.dyn" : ".rel.dyn"))
return false;
/* When a .rel.dyn section is used a DT_RELCOUNT dynamic section
@@ -984,14 +984,106 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *ehdr, int idx, const GElf_Shdr *shdr,
if (dyn->d_tag == DT_RELCOUNT)
{
- /* Found it. One last check: does the number
- specified number of relative relocations exceed
- the total number of relocations? */
- if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
+ /* Found it. Does the type match. */
+ if (is_rela)
ERROR (gettext ("\
+section [%2d] '%s': DT_RELCOUNT used for this RELA section\n"),
+ idx, section_name (ebl, idx));
+ else
+ {
+ /* Does the number specified number of relative
+ relocations exceed the total number of
+ relocations? */
+ if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
+ ERROR (gettext ("\
section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
- idx, section_name (ebl, idx),
- (int) dyn->d_un.d_val);
+ idx, section_name (ebl, idx),
+ (int) dyn->d_un.d_val);
+
+ /* Make sure the specified number of relocations are
+ relative. */
+ Elf_Data *reldata = elf_getdata (elf_getscn (ebl->elf,
+ idx), NULL);
+ if (reldata != NULL)
+ for (size_t inner = 0;
+ inner < shdr->sh_size / shdr->sh_entsize;
+ ++inner)
+ {
+ GElf_Rel rel_mem;
+ GElf_Rel *rel = gelf_getrel (reldata, inner,
+ &rel_mem);
+ if (rel == NULL)
+ /* The problem will be reported elsewhere. */
+ break;
+
+ if (ebl_relative_reloc_p (ebl,
+ GELF_R_TYPE (rel->r_info)))
+ {
+ if (inner >= dyn->d_un.d_val)
+ ERROR (gettext ("\
+section [%2d] '%s': relative relocations after index %d as specified by DT_RELCOUNT\n"),
+ idx, section_name (ebl, idx),
+ (int) dyn->d_un.d_val);
+ }
+ else if (inner < dyn->d_un.d_val)
+ ERROR (gettext ("\
+section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT specified %d relative relocations\n"),
+ idx, section_name (ebl, idx),
+ inner, (int) dyn->d_un.d_val);
+ }
+ }
+ }
+
+ if (dyn->d_tag == DT_RELACOUNT)
+ {
+ /* Found it. Does the type match. */
+ if (!is_rela)
+ ERROR (gettext ("\
+section [%2d] '%s': DT_RELACOUNT used for this REL section\n"),
+ idx, section_name (ebl, idx));
+ else
+ {
+ /* Does the number specified number of relative
+ relocations exceed the total number of
+ relocations? */
+ if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
+ ERROR (gettext ("\
+section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
+ idx, section_name (ebl, idx),
+ (int) dyn->d_un.d_val);
+
+ /* Make sure the specified number of relocations are
+ relative. */
+ Elf_Data *reldata = elf_getdata (elf_getscn (ebl->elf,
+ idx), NULL);
+ if (reldata != NULL)
+ for (size_t inner = 0;
+ inner < shdr->sh_size / shdr->sh_entsize;
+ ++inner)
+ {
+ GElf_Rela rela_mem;
+ GElf_Rela *rela = gelf_getrela (reldata, inner,
+ &rela_mem);
+ if (rela == NULL)
+ /* The problem will be reported elsewhere. */
+ break;
+
+ if (ebl_relative_reloc_p (ebl,
+ GELF_R_TYPE (rela->r_info)))
+ {
+ if (inner >= dyn->d_un.d_val)
+ ERROR (gettext ("\
+section [%2d] '%s': relative relocations after index %d as specified by DT_RELCOUNT\n"),
+ idx, section_name (ebl, idx),
+ (int) dyn->d_un.d_val);
+ }
+ else if (inner < dyn->d_un.d_val)
+ ERROR (gettext ("\
+section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT specified %d relative relocations\n"),
+ idx, section_name (ebl, idx),
+ inner, (int) dyn->d_un.d_val);
+ }
+ }
}
}
@@ -1170,6 +1262,10 @@ section [%2d] '%s': relocation %zu: relocation type invalid for the file type\n"
section [%2d] '%s': relocation %zu: invalid symbol index\n"),
idx, section_name (ebl, idx), cnt);
+ /* No more tests if this is a no-op relocation. */
+ if (ebl_none_reloc_p (ebl, GELF_R_TYPE (r_info)))
+ return;
+
if (ebl_gotpc_reloc_check (ebl, GELF_R_TYPE (r_info)))
{
const char *name;
@@ -1373,8 +1469,7 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
[DT_PLTRELSZ] = { [DT_JMPREL] = true },
[DT_HASH] = { [DT_SYMTAB] = true },
[DT_STRTAB] = { [DT_STRSZ] = true },
- [DT_SYMTAB] = { [DT_STRTAB] = true, [DT_HASH] = true,
- [DT_SYMENT] = true },
+ [DT_SYMTAB] = { [DT_STRTAB] = true, [DT_SYMENT] = true },
[DT_RELA] = { [DT_RELASZ] = true, [DT_RELAENT] = true },
[DT_RELASZ] = { [DT_RELA] = true },
[DT_RELAENT] = { [DT_RELA] = true },
@@ -1391,6 +1486,8 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
[DT_PLTRELSZ] = { [DT_JMPREL] = true }
};
bool has_dt[DT_NUM];
+ bool has_val_dt[DT_VALNUM];
+ bool has_addr_dt[DT_ADDRNUM];
static const bool level2[DT_NUM] =
{
[DT_RPATH] = true,
@@ -1401,7 +1498,6 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
static const bool mandatory[DT_NUM] =
{
[DT_NULL] = true,
- [DT_HASH] = true,
[DT_STRTAB] = true,
[DT_SYMTAB] = true,
[DT_STRSZ] = true,
@@ -1413,6 +1509,8 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
GElf_Word pltrelsz = 0;
memset (has_dt, '\0', sizeof (has_dt));
+ memset (has_val_dt, '\0', sizeof (has_val_dt));
+ memset (has_addr_dt, '\0', sizeof (has_addr_dt));
if (++ndynamic == 2)
ERROR (gettext ("more than one dynamic section present\n"));
@@ -1493,6 +1591,12 @@ section [%2d] '%s': entry %zu: level 2 tag %s used\n"),
has_dt[dyn->d_tag] = true;
}
+ else if (dyn->d_tag <= DT_VALRNGHI
+ && DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
+ has_val_dt[DT_VALTAGIDX (dyn->d_tag)] = true;
+ else if (dyn->d_tag <= DT_ADDRRNGHI
+ && DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
+ has_addr_dt[DT_ADDRTAGIDX (dyn->d_tag)] = true;
if (dyn->d_tag == DT_PLTREL && dyn->d_un.d_val != DT_REL
&& dyn->d_un.d_val != DT_RELA)
@@ -1513,32 +1617,42 @@ section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"),
switch (dyn->d_tag)
{
size_t n;
+ case DT_STRTAB:
+ /* We require the referenced section is the same as the one
+ specified in sh_link. */
+ if (strshdr->sh_addr != dyn->d_un.d_val)
+ {
+ ERROR (gettext ("\
+section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] '%s' referenced by sh_link\n"),
+ idx, section_name (ebl, idx), cnt,
+ shdr->sh_link, section_name (ebl, shdr->sh_link));
+ break;
+ }
+ goto check_addr;
+
default:
if (dyn->d_tag < DT_ADDRRNGLO || dyn->d_tag > DT_ADDRRNGHI)
/* Value is no pointer. */
break;
/* FALLTHROUGH */
- case DT_PLTGOT:
+ case DT_AUXILIARY:
+ case DT_FILTER:
+ case DT_FINI:
+ case DT_FINI_ARRAY:
case DT_HASH:
- case DT_STRTAB:
- case DT_SYMTAB:
- case DT_RELA:
case DT_INIT:
- case DT_FINI:
- case DT_SONAME:
- case DT_RPATH:
- case DT_SYMBOLIC:
- case DT_REL:
- case DT_JMPREL:
case DT_INIT_ARRAY:
- case DT_FINI_ARRAY:
- case DT_RUNPATH:
- case DT_VERSYM:
+ case DT_JMPREL:
+ case DT_PLTGOT:
+ case DT_REL:
+ case DT_RELA:
+ case DT_SYMBOLIC:
+ case DT_SYMTAB:
case DT_VERDEF:
case DT_VERNEED:
- case DT_AUXILIARY:
- case DT_FILTER:
+ case DT_VERSYM:
+ check_addr:
for (n = 0; n < ehdr->e_phnum; ++n)
{
GElf_Phdr phdr_mem;
@@ -1557,6 +1671,23 @@ section [%2d] '%s': entry %zu: %s value must point into loaded segment\n"),
ebl_dynamic_tag_name (ebl, dyn->d_tag, buf,
sizeof (buf)));
}
+ break;
+
+ case DT_NEEDED:
+ case DT_RPATH:
+ case DT_RUNPATH:
+ case DT_SONAME:
+ if (dyn->d_un.d_ptr >= strshdr->sh_size)
+ {
+ char buf[50];
+ ERROR (gettext ("\
+section [%2d] '%s': entry %zu: %s value must be valid offset in section [%2d] '%s'\n"),
+ idx, section_name (ebl, idx), cnt,
+ ebl_dynamic_tag_name (ebl, dyn->d_tag, buf,
+ sizeof (buf)),
+ shdr->sh_link, section_name (ebl, shdr->sh_link));
+ }
+ break;
}
}
@@ -1588,6 +1719,20 @@ section [%2d] '%s': mandatory tag %s not present\n"),
}
}
+ /* Make sure we have an hash table. */
+ if (!has_dt[DT_HASH] && !has_addr_dt[DT_ADDRTAGIDX (DT_GNU_HASH)])
+ ERROR (gettext ("\
+section [%2d] '%s': no hash section present\n"),
+ idx, section_name (ebl, idx));
+
+ /* The GNU-style hash table also needs a symbol table. */
+ if (!has_dt[DT_HASH] && has_addr_dt[DT_ADDRTAGIDX (DT_GNU_HASH)]
+ && !has_dt[DT_SYMTAB])
+ ERROR (gettext ("\
+section [%2d] '%s': contains %s entry but not %s\n"),
+ idx, section_name (ebl, idx),
+ "DT_GNU_HASH", "DT_SYMTAB");
+
/* Check the rel/rela tags. At least one group must be available. */
if ((has_dt[DT_RELA] || has_dt[DT_RELASZ] || has_dt[DT_RELAENT])
&& (!has_dt[DT_RELA] || !has_dt[DT_RELASZ] || !has_dt[DT_RELAENT]))
@@ -1602,6 +1747,49 @@ section [%2d] '%s': not all of %s, %s, and %s are present\n"),
section [%2d] '%s': not all of %s, %s, and %s are present\n"),
idx, section_name (ebl, idx),
"DT_REL", "DT_RELSZ", "DT_RELENT");
+
+ /* Check that all prelink sections are present if any of them is. */
+ if (has_val_dt[DT_VALTAGIDX (DT_GNU_PRELINKED)]
+ || has_val_dt[DT_VALTAGIDX (DT_CHECKSUM)])
+ {
+ if (!has_val_dt[DT_VALTAGIDX (DT_GNU_PRELINKED)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in DSO marked during prelinking\n"),
+ idx, section_name (ebl, idx), "DT_GNU_PRELINKED");
+ if (!has_val_dt[DT_VALTAGIDX (DT_CHECKSUM)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in DSO marked during prelinking\n"),
+ idx, section_name (ebl, idx), "DT_CHECKSUM");
+
+ /* Only DSOs can be marked like this. */
+ if (ehdr->e_type != ET_DYN)
+ ERROR (gettext ("\
+section [%2d] '%s': non-DSO file marked as dependency during prelink\n"),
+ idx, section_name (ebl, idx));
+ }
+
+ if (has_val_dt[DT_VALTAGIDX (DT_GNU_CONFLICTSZ)]
+ || has_val_dt[DT_VALTAGIDX (DT_GNU_LIBLISTSZ)]
+ || has_addr_dt[DT_ADDRTAGIDX (DT_GNU_CONFLICT)]
+ || has_addr_dt[DT_ADDRTAGIDX (DT_GNU_LIBLIST)])
+ {
+ if (!has_val_dt[DT_VALTAGIDX (DT_GNU_CONFLICTSZ)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in prelinked executable\n"),
+ idx, section_name (ebl, idx), "DT_GNU_CONFLICTSZ");
+ if (!has_val_dt[DT_VALTAGIDX (DT_GNU_LIBLISTSZ)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in prelinked executable\n"),
+ idx, section_name (ebl, idx), "DT_GNU_LIBLISTSZ");
+ if (!has_addr_dt[DT_ADDRTAGIDX (DT_GNU_CONFLICT)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in prelinked executable\n"),
+ idx, section_name (ebl, idx), "DT_GNU_CONFLICT");
+ if (!has_addr_dt[DT_ADDRTAGIDX (DT_GNU_LIBLIST)])
+ ERROR (gettext ("\
+section [%2d] '%s': %s tag missing in prelinked executable\n"),
+ idx, section_name (ebl, idx), "DT_GNU_LIBLIST");
+ }
}
@@ -1687,7 +1875,229 @@ extended section index is %" PRIu32 " but symbol index is not XINDEX\n"),
static void
-check_hash (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
+check_sysv_hash (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx,
+ GElf_Shdr *symshdr)
+{
+ Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
+ Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1];
+
+ if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize)
+ ERROR (gettext ("\
+section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"),
+ idx, section_name (ebl, idx), (long int) shdr->sh_size,
+ (long int) ((2 + nbucket + nchain) * shdr->sh_entsize));
+
+ size_t maxidx = nchain;
+
+ if (symshdr != NULL)
+ {
+ size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
+
+ if (nchain > symshdr->sh_size / symshdr->sh_entsize)
+ ERROR (gettext ("section [%2d] '%s': chain array too large\n"),
+ idx, section_name (ebl, idx));
+
+ maxidx = symsize;
+ }
+
+ size_t cnt;
+ for (cnt = 2; cnt < 2 + nbucket; ++cnt)
+ if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
+ ERROR (gettext ("\
+section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
+ idx, section_name (ebl, idx), cnt - 2);
+
+ for (; cnt < 2 + nbucket + nchain; ++cnt)
+ if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
+ ERROR (gettext ("\
+section [%2d] '%s': hash chain reference %zu out of bounds\n"),
+ idx, section_name (ebl, idx), cnt - 2 - nbucket);
+}
+
+
+static void
+check_sysv_hash64 (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx,
+ GElf_Shdr *symshdr)
+{
+ Elf64_Xword nbucket = ((Elf64_Xword *) data->d_buf)[0];
+ Elf64_Xword nchain = ((Elf64_Xword *) data->d_buf)[1];
+
+ if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize)
+ ERROR (gettext ("\
+section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"),
+ idx, section_name (ebl, idx), (long int) shdr->sh_size,
+ (long int) ((2 + nbucket + nchain) * shdr->sh_entsize));
+
+ size_t maxidx = nchain;
+
+ if (symshdr != NULL)
+ {
+ size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
+
+ if (nchain > symshdr->sh_size / symshdr->sh_entsize)
+ ERROR (gettext ("section [%2d] '%s': chain array too large\n"),
+ idx, section_name (ebl, idx));
+
+ maxidx = symsize;
+ }
+
+ size_t cnt;
+ for (cnt = 2; cnt < 2 + nbucket; ++cnt)
+ if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
+ ERROR (gettext ("\
+section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
+ idx, section_name (ebl, idx), cnt - 2);
+
+ for (; cnt < 2 + nbucket + nchain; ++cnt)
+ if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
+ ERROR (gettext ("\
+section [%2d] '%s': hash chain reference %" PRIu64 " out of bounds\n"),
+ idx, section_name (ebl, idx), (uint64_t) (cnt - 2 - nbucket));
+}
+
+
+static void
+check_gnu_hash (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx,
+ GElf_Shdr *symshdr)
+{
+ Elf32_Word nbuckets = ((Elf32_Word *) data->d_buf)[0];
+ Elf32_Word symbias = ((Elf32_Word *) data->d_buf)[1];
+ Elf32_Word bitmask_words = ((Elf32_Word *) data->d_buf)[2];
+
+ if (!powerof2 (bitmask_words))
+ ERROR (gettext ("\
+section [%2d] '%s': bitmask size not power of 2: %u\n"),
+ idx, section_name (ebl, idx), bitmask_words);
+
+ size_t bitmask_idxmask = bitmask_words - 1;
+ if (gelf_getclass (ebl->elf) == ELFCLASS64)
+ bitmask_words *= 2;
+ Elf32_Word shift = ((Elf32_Word *) data->d_buf)[3];
+
+ if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))
+ {
+ ERROR (gettext ("\
+section [%2d] '%s': hash table section is too small (is %ld, expected at least%ld)\n"),
+ idx, section_name (ebl, idx), (long int) shdr->sh_size,
+ (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
+ return;
+ }
+
+ if (shift > 31)
+ ERROR (gettext ("\
+section [%2d] '%s': 2nd hash function shift too big: %u\n"),
+ idx, section_name (ebl, idx), shift);
+
+ size_t maxidx = shdr->sh_size / sizeof (Elf32_Word) - (4 + bitmask_words
+ + nbuckets);
+
+ if (symshdr != NULL)
+ maxidx = MIN (maxidx, symshdr->sh_size / symshdr->sh_entsize);
+
+ /* We need the symbol section data. */
+ Elf_Data *symdata = elf_getdata (elf_getscn (ebl->elf, shdr->sh_link), NULL);
+
+ union
+ {
+ Elf32_Word *p32;
+ Elf64_Xword *p64;
+ } bitmask = { .p32 = &((Elf32_Word *) data->d_buf)[4] },
+ collected = { .p32 = xcalloc (bitmask_words, sizeof (Elf32_Word)) };
+
+ size_t classbits = gelf_getclass (ebl->elf) == ELFCLASS32 ? 32 : 64;
+
+ size_t cnt;
+ for (cnt = 4 + bitmask_words; cnt < 4 + bitmask_words + nbuckets; ++cnt)
+ {
+ Elf32_Word symidx = ((Elf32_Word *) data->d_buf)[cnt];
+
+ if (symidx == 0)
+ continue;
+
+ if (symidx < symbias)
+ {
+ ERROR (gettext ("\
+section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n"),
+ idx, section_name (ebl, idx), cnt - (4 + bitmask_words));
+ continue;
+ }
+
+ while (symidx - symbias < maxidx)
+ {
+ Elf32_Word chainhash = ((Elf32_Word *) data->d_buf)[4
+ + bitmask_words
+ + nbuckets
+ + symidx
+ - symbias];
+
+ if (symdata != NULL)
+ {
+ /* Check that the referenced symbol is not undefined. */
+ GElf_Sym sym_mem;
+ GElf_Sym *sym = gelf_getsym (symdata, symidx, &sym_mem);
+ if (sym != NULL && sym->st_shndx == SHN_UNDEF
+ && GELF_ST_TYPE (sym->st_info) != STT_FUNC)
+ ERROR (gettext ("\
+section [%2d] '%s': symbol %u referenced in chain for bucket %zu is undefined\n"),
+ idx, section_name (ebl, idx), symidx, cnt / 2 - 1);
+
+ const char *symname = elf_strptr (ebl->elf, symshdr->sh_link,
+ sym->st_name);
+ if (symname != NULL)
+ {
+ Elf32_Word hval = elf_gnu_hash (symname);
+ if ((hval & ~1u) != (chainhash & ~1u))
+ ERROR (gettext ("\
+section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n"),
+ idx, section_name (ebl, idx), symidx, cnt / 2 - 1);
+
+ /* Set the bits in the bitmask. */
+ size_t maskidx = (hval / classbits) & bitmask_idxmask;
+ if (classbits == 32)
+ {
+ collected.p32[maskidx]
+ |= UINT32_C (1) << (hval & (classbits - 1));
+ collected.p32[maskidx]
+ |= UINT32_C (1) << ((hval >> shift) & (classbits - 1));
+ }
+ else
+ {
+ collected.p64[maskidx]
+ |= UINT64_C (1) << (hval & (classbits - 1));
+ collected.p64[maskidx]
+ |= UINT64_C (1) << ((hval >> shift) & (classbits - 1));
+ }
+ }
+ }
+
+ if ((chainhash & 1) != 0)
+ break;
+
+ ++symidx;
+ }
+
+ if (symidx - symbias >= maxidx)
+ ERROR (gettext ("\
+section [%2d] '%s': hash chain for bucket %zu out of bounds\n"),
+ idx, section_name (ebl, idx), cnt / 2 - 1);
+ else if (symshdr != NULL
+ && symidx > symshdr->sh_size / symshdr->sh_entsize)
+ ERROR (gettext ("\
+section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n"),
+ idx, section_name (ebl, idx), cnt / 2 - 1);
+ }
+
+ if (memcmp (collected.p32, bitmask.p32, bitmask_words * sizeof (Elf32_Word)))
+ ERROR (gettext ("\
+section [%2d] '%s': bitmask does not match names in the hash table\n"),
+ idx, section_name (ebl, idx));
+
+ free (collected.p32);
+}
+
+
+static void
+check_hash (int tag, Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
{
if (ehdr->e_type == ET_REL)
{
@@ -1713,52 +2123,41 @@ section [%2d] '%s': relocatable files cannot have hash tables\n"),
section [%2d] '%s': hash table not for dynamic symbol table\n"),
idx, section_name (ebl, idx));
- if (shdr->sh_entsize != sizeof (Elf32_Word))
+ if (shdr->sh_entsize != (tag == SHT_GNU_HASH
+ ? (gelf_getclass (ebl->elf) == ELFCLASS32
+ ? sizeof (Elf32_Word) : 0)
+ : (size_t) ebl_sysvhash_entrysize (ebl)))
ERROR (gettext ("\
-section [%2d] '%s': entry size does not match Elf32_Word\n"),
+section [%2d] '%s': hash table entry size incorrect\n"),
idx, section_name (ebl, idx));
if ((shdr->sh_flags & SHF_ALLOC) == 0)
ERROR (gettext ("section [%2d] '%s': not marked to be allocated\n"),
idx, section_name (ebl, idx));
- if (shdr->sh_size < 2 * shdr->sh_entsize)
+ if (shdr->sh_size < (tag == SHT_GNU_HASH ? 4 : 2) * (shdr->sh_entsize ?: 4))
{
ERROR (gettext ("\
-section [%2d] '%s': hash table has not even room for nbucket and nchain\n"),
+section [%2d] '%s': hash table has not even room for initial administrative entries\n"),
idx, section_name (ebl, idx));
return;
}
- Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
- Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1];
-
- if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize)
- ERROR (gettext ("\
-section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"),
- idx, section_name (ebl, idx), (long int) shdr->sh_size,
- (long int) ((2 + nbucket + nchain) * shdr->sh_entsize));
-
- if (symshdr != NULL)
+ switch (tag)
{
- size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
- size_t cnt;
-
- if (nchain < symshdr->sh_size / symshdr->sh_entsize)
- ERROR (gettext ("section [%2d] '%s': chain array not large enough\n"),
- idx, section_name (ebl, idx));
+ case SHT_HASH:
+ if (ebl_sysvhash_entrysize (ebl) == sizeof (Elf64_Xword))
+ check_sysv_hash64 (ebl, shdr, data, idx, symshdr);
+ else
+ check_sysv_hash (ebl, shdr, data, idx, symshdr);
+ break;
- for (cnt = 2; cnt < 2 + nbucket; ++cnt)
- if (((Elf32_Word *) data->d_buf)[cnt] >= symsize)
- ERROR (gettext ("\
-section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
- idx, section_name (ebl, idx), cnt - 2);
+ case SHT_GNU_HASH:
+ check_gnu_hash (ebl, shdr, data, idx, symshdr);
+ break;
- for (; cnt < 2 + nbucket + nchain; ++cnt)
- if (((Elf32_Word *) data->d_buf)[cnt] >= symsize)
- ERROR (gettext ("\
-section [%2d] '%s': hash chain reference %zu out of bounds\n"),
- idx, section_name (ebl, idx), cnt - 2 - nbucket);
+ default:
+ assert (! "should not happen");
}
}
@@ -2028,14 +2427,14 @@ static struct version_namelist
{
const char *objname;
const char *name;
- GElf_Word ndx;
+ GElf_Versym ndx;
enum { ver_def, ver_need } type;
struct version_namelist *next;
} *version_namelist;
static int
-add_version (const char *objname, const char *name, GElf_Word ndx, int type)
+add_version (const char *objname, const char *name, GElf_Versym ndx, int type)
{
/* Check that there are no duplications. */
struct version_namelist *nlp = version_namelist;
@@ -2147,7 +2546,7 @@ section [%2d] '%s': symbol %d: local symbol with version\n"),
index we need for this symbol. */
struct version_namelist *runp = version_namelist;
while (runp != NULL)
- if (runp->ndx == *versym)
+ if (runp->ndx == (*versym & (GElf_Versym) 0x7fff))
break;
else
runp = runp->next;
@@ -2914,7 +3313,8 @@ section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"),
break;
case SHT_HASH:
- check_hash (ebl, ehdr, shdr, cnt);
+ case SHT_GNU_HASH:
+ check_hash (shdr->sh_type, ebl, ehdr, shdr, cnt);
break;
case SHT_NULL:
diff --git a/elfutils/src/i386_ld.c b/elfutils/src/i386_ld.c
index 1724d324..c79804cd 100644
--- a/elfutils/src/i386_ld.c
+++ b/elfutils/src/i386_ld.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -72,7 +72,7 @@ elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)),
Elf_Data *data;
/* Iterate over all the input sections. Appropriate data buffers in the
- output sections were already created. I get them iteratively, too. */
+ output sections were already created. */
runp = firstp;
data = NULL;
do
@@ -149,8 +149,8 @@ elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)),
assert (xndx < SHN_LORESERVE || xndx > SHN_HIRESERVE);
/* We fortunately don't have to do much. The relocations
- mostly get only updates of the offset. Only is a
- relocation referred to a section do we have to do
+ mostly get only updates of the offset. Only for a
+ relocation referring to a section do we have to do
something. In this case the reference to the sections
has no direct equivalent since the part the input section
contributes need not start at the same offset as in the
@@ -159,15 +159,13 @@ elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)),
itself. */
if (XELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
- Elf32_Word toadd;
-
- /* We expect here on R_386_32 relocations. */
+ /* We expect here only R_386_32 relocations. */
assert (XELF_R_TYPE (rel->r_info) == R_386_32);
/* Avoid writing to the section memory if this is
effectively a no-op since it might save a
copy-on-write operation. */
- toadd = file->scninfo[xndx].offset;
+ Elf32_Word toadd = file->scninfo[xndx].offset;
if (toadd != 0)
add_4ubyte_unaligned (reltgtdata->d_buf + rel->r_offset,
toadd);
@@ -396,14 +394,19 @@ elf_i386_finalize_plt (struct ld_state *statep, size_t nsym,
/* Point the GOT entry at the PLT entry, after the initial jmp. */
((Elf32_Word *) data->d_buf)[3 + cnt] = pltentryaddr + 6;
- /* The value of the symbol is the address of the corresponding PLT
- entry. Store the address, also for the normal symbol table if
- this is necessary. */
- ((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_value = pltentryaddr;
- if (symdata != NULL)
- ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + cnt].st_value
- = pltentryaddr;
+ /* If the symbol is defined, adjust the address. */
+ if (((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_shndx != SHN_UNDEF)
+ {
+ /* The value of the symbol is the address of the corresponding PLT
+ entry. Store the address, also for the normal symbol table if
+ this is necessary. */
+ ((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_value = pltentryaddr;
+
+ if (symdata != NULL)
+ ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + cnt].st_value
+ = pltentryaddr;
+ }
}
/* Create the .plt section. */
@@ -520,10 +523,17 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo)
{
Elf32_Word r_sym = XELF_R_SYM (rel->r_info);
+ /* Symbols in COMDAT group sections which are discarded do
+ not have to be relocated. */
+ if (r_sym >= scninfo->fileinfo->nlocalsymbols
+ && unlikely (scninfo->fileinfo->symref[r_sym] == NULL))
+ continue;
+
switch (XELF_R_TYPE (rel->r_info))
{
case R_386_GOT32:
- if (! scninfo->fileinfo->symref[r_sym]->defined)
+ if (! scninfo->fileinfo->symref[r_sym]->defined
+ || scninfo->fileinfo->symref[r_sym]->in_dso)
relsize += sizeof (Elf32_Rel);
/* This relocation is not emitted in the output file but
@@ -546,6 +556,8 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo)
if (statep->file_type == dso_file_type)
{
relsize += sizeof (Elf32_Rel);
+ // XXX Do we have to check whether the target
+ // XXX section is read-only first?
statep->dt_flags |= DF_TEXTREL;
}
else
@@ -565,10 +577,9 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo)
}
}
else if (statep->file_type == dso_file_type
- && r_sym >= SCNINFO_SHDR (scninfo->fileinfo->scninfo[shdr->sh_link].shdr).sh_info
- && scninfo->fileinfo->symref[r_sym]->outdynsymidx != 0
&& XELF_R_TYPE (rel->r_info) == R_386_32)
relsize += sizeof (Elf32_Rel);
+
break;
case R_386_PLT32:
@@ -692,8 +703,7 @@ elf_i386_create_relocations (struct ld_state *statep,
/* Cache the access to the symbol table data. */
Elf_Data *symdata = elf_getdata (scninfo[rshdr->sh_link].scn, NULL);
- int cnt;
- for (cnt = 0; cnt < nrels; ++cnt)
+ for (int cnt = 0; cnt < nrels; ++cnt)
{
XElf_Rel_vardef (rel);
XElf_Rel *rel2;
@@ -712,16 +722,24 @@ elf_i386_create_relocations (struct ld_state *statep,
section in the output file and the addend. */
value = scninfo[sym->st_shndx].offset + sym->st_value;
}
- else if (symref[idx]->in_dso)
+ else
{
- /* MERGE.VALUE contains the PLT index. We have to add 1 since
- there is this one special PLT entry at the beginning. */
- assert (symref[idx]->merge.value != 0
- || symref[idx]->type != STT_FUNC);
- value = pltaddr + symref[idx]->merge.value * PLT_ENTRY_SIZE;
+ if (symref[idx] == NULL)
+ /* Symbol in ignored COMDAT group section. */
+ continue;
+
+ if (symref[idx]->in_dso)
+ {
+ /* MERGE.VALUE contains the PLT index. We have to
+ add 1 since there is this one special PLT entry
+ at the beginning. */
+ assert (symref[idx]->merge.value != 0
+ || symref[idx]->type != STT_FUNC);
+ value = pltaddr + symref[idx]->merge.value * PLT_ENTRY_SIZE;
+ }
+ else
+ value = symref[idx]->merge.value;
}
- else
- value = symref[idx]->merge.value;
/* Address of the relocated memory in the data buffer. */
void *relloc = (char *) data->d_buf + rel->r_offset;
@@ -794,8 +812,7 @@ elf_i386_create_relocations (struct ld_state *statep,
}
}
else if (statep->file_type == dso_file_type
- && idx >= SCNINFO_SHDR (scninfo[rshdr->sh_link].shdr).sh_info
- && symref[idx]->outdynsymidx != 0)
+ && XELF_R_TYPE (rel->r_info) == R_386_32)
{
#if NATIVE_ELF != 0
xelf_getrel_ptr (reldyndata, nreldyn, rel2);
@@ -803,8 +820,15 @@ elf_i386_create_relocations (struct ld_state *statep,
rel2 = &rel_mem;
#endif
rel2->r_offset = value;
- rel2->r_info
- = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_32);
+
+ /* For symbols we do not export we generate a relative
+ relocation. */
+ if (idx < SCNINFO_SHDR (scninfo[rshdr->sh_link].shdr).sh_info
+ || symref[idx]->outdynsymidx == 0)
+ rel2->r_info = XELF_R_INFO (0, R_386_RELATIVE);
+ else
+ rel2->r_info
+ = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_32);
(void) xelf_update_rel (reldyndata, nreldyn, rel2);
++nreldyn;
diff --git a/elfutils/src/ld.c b/elfutils/src/ld.c
index 110072f9..61627e58 100644
--- a/elfutils/src/ld.c
+++ b/elfutils/src/ld.c
@@ -62,7 +62,6 @@ enum
ARGP_static,
ARGP_dynamic,
ARGP_pagesize,
- ARGP_rpath,
ARGP_rpath_link,
ARGP_runpath,
ARGP_runpath_link,
@@ -71,6 +70,9 @@ enum
ARGP_no_gc_sections,
ARGP_no_undefined,
ARGP_conserve,
+ ARGP_as_needed,
+ ARGP_no_as_needed,
+ ARGP_eh_frame_hdr,
#if YYDEBUG
ARGP_yydebug,
#endif
@@ -80,23 +82,26 @@ enum
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =
{
- /* XXX This list will be reordered and section names will be added.
- Just not right now. */
+ { NULL, 0, NULL, 0, N_("Input File Control:"), 0 },
{ "whole-archive", ARGP_whole_archive, NULL, 0,
N_("Include whole archives in the output from now on."), 0 },
{ "no-whole-archive", ARGP_no_whole_archive, NULL, 0,
N_("Stop including the whole arhives in the output."), 0 },
+ { NULL, 'l', N_("FILE"), OPTION_HIDDEN, NULL, 0 },
+ { NULL, '(', NULL, 0, N_("Start a group."), 0 },
+ { NULL, ')', NULL, 0, N_("End a group."), 0 },
+ { NULL, 'L', N_("PATH"), 0,
+ N_("Add PATH to list of directories files are searched in."), 0 },
+ { "as-needed", ARGP_as_needed, NULL, 0,
+ N_("Only set DT_NEEDED for following dynamic libs if actually used"), 0 },
+ { "no-as-needed", ARGP_no_as_needed, NULL, 0,
+ N_("Always set DT_NEEDED for following dynamic libs"), 0 },
+ { "rpath-link", ARGP_rpath_link, "PATH", OPTION_HIDDEN, NULL, 0 },
+ { NULL, 'i', NULL, 0, N_("Ignore LD_LIBRARY_PATH environment variable."),
+ 0 },
+ { NULL, 0, NULL, 0, N_("Output File Control:"), 0 },
{ "output", 'o', N_("FILE"), 0, N_("Place output in FILE."), 0 },
-
- { NULL, 'O', N_("LEVEL"), OPTION_ARG_OPTIONAL,
- N_("Set optimization level to LEVEL."), 0 },
-
- { "verbose", 'v', NULL, 0, N_("Verbose messages."), 0 },
- { "trace", 't', NULL, 0, N_("Trace file opens."), 0 },
- { "conserve-memory", ARGP_conserve, NULL, 0,
- N_("Trade speed for less memory usage"), 0 },
-
{ NULL, 'z', "KEYWORD", OPTION_HIDDEN, NULL, 0 },
{ "-z nodefaultlib", '\0', NULL, OPTION_DOC,
N_("Object is marked to not use default search path at runtime."), 0 },
@@ -128,74 +133,56 @@ Default rules of extracting from archive; weak references are not enough."),
N_("Ignore/record dependencies on unused DSOs."), 0 },
{ "-z systemlibrary", '\0', NULL, OPTION_DOC,
N_("Generated DSO will be a system library."), 0 },
-
- { NULL, 'l', N_("FILE"), OPTION_HIDDEN, NULL, 0 },
-
- { NULL, '(', NULL, 0, N_("Start a group."), 0 },
- { NULL, ')', NULL, 0, N_("End a group."), 0 },
-
- { NULL, 'L', N_("PATH"), 0,
- N_("Add PATH to list of directories files are searched in."), 0 },
-
- { NULL, 'c', N_("FILE"), 0, N_("Use linker script in FILE."), 0 },
-
{ "entry", 'e', N_("ADDRESS"), 0, N_("Set entry point address."), 0 },
-
{ "static", ARGP_static, NULL, OPTION_HIDDEN, NULL, 0 },
{ "-B static", ARGP_static, NULL, OPTION_DOC,
N_("Do not link against shared libraries."), 0 },
{ "dynamic", ARGP_dynamic, NULL, OPTION_HIDDEN, NULL, 0 },
{ "-B dynamic", ARGP_dynamic, NULL, OPTION_DOC,
N_("Prefer linking against shared libraries."), 0 },
-
{ "export-dynamic", 'E', NULL, 0, N_("Export all dynamic symbols."), 0 },
-
{ "strip-all", 's', NULL, 0, N_("Strip all symbols."), 0 },
{ "strip-debug", 'S', NULL, 0, N_("Strip debugging symbols."), 0 },
-
{ "pagesize", ARGP_pagesize, "SIZE", 0,
N_("Assume pagesize for the target system to be SIZE."), 0 },
-
- { "rpath", ARGP_rpath, "PATH", OPTION_HIDDEN, NULL, 0 },
- { "rpath-link", ARGP_rpath_link, "PATH", OPTION_HIDDEN, NULL, 0 },
-
+ { "rpath", 'R', "PATH", OPTION_HIDDEN, NULL, 0 },
{ "runpath", ARGP_runpath, "PATH", 0, N_("Set runtime DSO search path."),
0 },
{ "runpath-link", ARGP_runpath_link, "PATH", 0,
N_("Set link time DSO search path."), 0 },
-
- { NULL, 'i', NULL, 0, N_("Ignore LD_LIBRARY_PATH environment variable."),
- 0 },
-
- { "version-script", ARGP_version_script, "FILE", 0,
- N_("Read version information from FILE."), 0 },
-
- { "emulation", 'm', "NAME", 0, N_("Set emulation to NAME."), 0 },
-
{ "shared", 'G', NULL, 0, N_("Generate dynamic shared object."), 0 },
{ NULL, 'r', NULL, 0L, N_("Generate relocatable object."), 0 },
-
{ NULL, 'B', "KEYWORD", OPTION_HIDDEN, "", 0 },
{ "-B local", 'B', NULL, OPTION_DOC,
N_("Causes symbol not assigned to a version be reduced to local."), 0 },
-
{ "gc-sections", ARGP_gc_sections, NULL, 0, N_("Remove unused sections."),
0 },
{ "no-gc-sections", ARGP_no_gc_sections, NULL, 0,
N_("Don't remove unused sections."), 0 },
-
{ "soname", 'h', "NAME", 0, N_("Set soname of shared object."), 0 },
{ "dynamic-linker", 'I', "NAME", 0, N_("Set the dynamic linker name."), 0 },
-
{ NULL, 'Q', "YN", OPTION_HIDDEN, NULL, 0 },
{ "-Q y | n", 'Q', NULL, OPTION_DOC,
N_("Add/suppress addition indentifying link-editor to .comment section"),
0 },
+ { "eh-frame-hdr", ARGP_eh_frame_hdr, NULL, 0,
+ N_("Create .eh_frame_hdr section"), 0 },
+ { NULL, 0, NULL, 0, N_("Linker Operation Control:"), 0 },
+ { "verbose", 'v', NULL, 0, N_("Verbose messages."), 0 },
+ { "trace", 't', NULL, 0, N_("Trace file opens."), 0 },
+ { "conserve-memory", ARGP_conserve, NULL, 0,
+ N_("Trade speed for less memory usage"), 0 },
+ { NULL, 'O', N_("LEVEL"), OPTION_ARG_OPTIONAL,
+ N_("Set optimization level to LEVEL."), 0 },
+ { NULL, 'c', N_("FILE"), 0, N_("Use linker script in FILE."), 0 },
#if YYDEBUG
{ "yydebug", ARGP_yydebug, NULL, 0,
N_("Select to get parser debug information"), 0 },
#endif
+ { "version-script", ARGP_version_script, "FILE", 0,
+ N_("Read version information from FILE."), 0 },
+ { "emulation", 'm', "NAME", 0, N_("Set emulation to NAME."), 0 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
@@ -599,7 +586,7 @@ parse_opt_1st (int key, char *arg,
}
break;
- case ARGP_rpath:
+ case 'R':
add_rxxpath (&ld_state.rpath, arg);
break;
@@ -620,6 +607,10 @@ parse_opt_1st (int key, char *arg,
ld_state.gc_sections = key == ARGP_gc_sections;
break;
+ case ARGP_eh_frame_hdr:
+ ld_state.eh_frame_hdr = true;
+ break;
+
case 's':
if (arg == NULL)
{
@@ -636,6 +627,8 @@ parse_opt_1st (int key, char *arg,
case 'O':
case ARGP_whole_archive:
case ARGP_no_whole_archive:
+ case ARGP_as_needed:
+ case ARGP_no_as_needed:
case 'L':
case '(':
case ')':
@@ -732,6 +725,13 @@ parse_opt_2nd (int key, char *arg,
ld_state.extract_rule = defaultextract;
break;
+ case ARGP_as_needed:
+ ld_state.as_needed = true;
+ break;
+ case ARGP_no_as_needed:
+ ld_state.as_needed = false;
+ break;
+
case ARGP_static:
case ARGP_dynamic:
/* Enable/disable use for DSOs. */
@@ -909,17 +909,19 @@ parse_z_option (const char *arg)
/* This is only meaningful if we create a DSO. */
&& ld_state.file_type == dso_file_type)
ld_state.dt_flags_1 |= DF_1_NOOPEN;
- else if (strcmp (arg, "ignore") == 0)
- ld_state.ignore_unused_dsos = true;
- else if (strcmp (arg, "record") == 0)
- ld_state.ignore_unused_dsos = false;
else if (strcmp (arg, "systemlibrary") == 0)
ld_state.is_system_library = true;
+ else if (strcmp (arg, "execstack") == 0)
+ ld_state.execstack = execstack_true;
+ else if (strcmp (arg, "noexecstack") == 0)
+ ld_state.execstack = execstack_false_force;
else if (strcmp (arg, "allextract") != 0
&& strcmp (arg, "defaultextract") != 0
&& strcmp (arg, "weakextract") != 0
&& strcmp (arg, "lazyload") != 0
- && strcmp (arg, "nolazyload") != 0)
+ && strcmp (arg, "nolazyload") != 0
+ && strcmp (arg, "ignore") != 0
+ && strcmp (arg, "record") != 0)
error (0, 0, gettext ("unknown option `-%c %s'"), 'z', arg);
}
@@ -937,6 +939,10 @@ parse_z_option_2 (const char *arg)
ld_state.lazyload = true;
else if (strcmp (arg, "nolazyload") == 0)
ld_state.lazyload = false;
+ else if (strcmp (arg, "ignore") == 0)
+ ld_state.as_needed = true;
+ else if (strcmp (arg, "record") == 0)
+ ld_state.as_needed = false;
}
@@ -1107,6 +1113,7 @@ ld_new_inputfile (const char *fname, enum file_type type)
newfile->soname = newfile->fname = newfile->rfname = fname;
newfile->file_type = type;
newfile->extract_rule = ld_state.extract_rule;
+ newfile->as_needed = ld_state.as_needed;
newfile->lazyload = ld_state.lazyload;
newfile->status = not_opened;
@@ -1512,6 +1519,8 @@ create_special_section_symbol (struct symbol **symp, const char *name)
abort ();
(*symp)->defined = 1;
+ (*symp)->local = 1;
+ (*symp)->hidden = 1;
(*symp)->type = STT_OBJECT;
++ld_state.nsymtab;
diff --git a/elfutils/src/ld.h b/elfutils/src/ld.h
index 3de257ca..59633e65 100644
--- a/elfutils/src/ld.h
+++ b/elfutils/src/ld.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2005 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -115,6 +115,10 @@ struct usedfiles
used in a reference. */
bool used;
+ /* True when file should be added to DT_NEEDED list only when
+ directly referenced. */
+ bool as_needed;
+
/* If nonzero this is the archive sequence number which can be used to
determine whether back refernces from -( -) or GROUP statements
have to be followed. */
@@ -170,6 +174,8 @@ struct usedfiles
Elf32_Word allsectionsidx;
/* True if the section is used. */
bool used;
+ /* True if section is an unused COMDAT section. */
+ bool unused_comdat;
/* Section group number. This is the index of the SHT_GROUP section. */
Elf32_Word grpid;
/* Pointer back to the containing file information structure. */
@@ -440,6 +446,8 @@ struct symbol
unsigned int weak:1;
unsigned int added:1;
unsigned int merged:1;
+ unsigned int local:1;
+ unsigned int hidden:1;
/* Nonzero if the symbol is on the from_dso list. */
unsigned int on_dsolist:1;
/* Nonzero if symbol needs copy relocation, reset when the
@@ -791,6 +799,10 @@ struct ld_state
/* If true static linking is requested. */
bool statically;
+ /* If true, add DT_NEEDED entries for following files if they are
+ needed. */
+ bool as_needed;
+
/* How to extract elements from archives. */
enum extract_rule extract_rule;
@@ -948,6 +960,14 @@ struct ld_state
bool default_bind_local;
bool default_bind_global;
+ /* Execuatable stack selection. */
+ enum execstack
+ {
+ execstack_false = 0,
+ execstack_true,
+ execstack_false_force
+ } execstack;
+
/* True if only used sections are used. */
bool gc_sections;
@@ -991,9 +1011,8 @@ struct ld_state
/* Lazy-loading state for dependencies. */
bool lazyload;
- /* True is DSOs which are not used in the linking process are not
- recorded. */
- bool ignore_unused_dsos;
+ /* True if an .eh_frame_hdr section should be generated. */
+ bool eh_frame_hdr;
/* True if in executables all global symbols should be exported in
diff --git a/elfutils/src/ldgeneric.c b/elfutils/src/ldgeneric.c
index c4c18a96..d282a1d8 100644
--- a/elfutils/src/ldgeneric.c
+++ b/elfutils/src/ldgeneric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -49,6 +49,17 @@
#include "list.h"
+/* Header of .eh_frame_hdr section. */
+struct unw_eh_frame_hdr
+{
+ unsigned char version;
+ unsigned char eh_frame_ptr_enc;
+ unsigned char fde_count_enc;
+ unsigned char table_enc;
+};
+#define EH_FRAME_HDR_VERSION 1
+
+
/* Prototypes for local functions. */
static const char **ld_generic_lib_extensions (struct ld_state *)
__attribute__ ((__const__));
@@ -980,7 +991,36 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo)
}
/* XXX Possibly unaligned memory access. */
- is_comdat = ((Elf32_Word *) grpscndata->d_buf)[0] & GRP_COMDAT;
+ if ((((Elf32_Word *) grpscndata->d_buf)[0] & GRP_COMDAT) != 0)
+ {
+ /* We have to compare the group signatures. There might
+ be sections with the same name but belonging to
+ groups with different signatures. This means we have
+ to compare the new group signature with all those
+ already collected. There might also be some
+ non-group sections in the mix. */
+ struct scninfo *runp = queued->last;
+ do
+ {
+ if (SCNINFO_SHDR (runp->shdr).sh_flags & SHF_GROUP)
+ {
+ struct scninfo *grpscn2
+ = find_section_group (runp->fileinfo,
+ elf_ndxscn (runp->scn),
+ &grpscndata);
+
+ if (strcmp (grpscn->symbols->name,
+ grpscn2->symbols->name) == 0)
+ {
+ scninfo->unused_comdat = is_comdat = true;
+ break;
+ }
+ }
+
+ runp = runp->next;
+ }
+ while (runp != queued->last);
+ }
}
if (!is_comdat)
@@ -989,7 +1029,8 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo)
scninfo->next = queued->last->next;
queued->last = queued->last->next = scninfo;
- queued->flags = SH_FLAGS_COMBINE (queued->flags, shdr->sh_flags);
+ queued->flags = ebl_sh_flags_combine (ld_state.ebl, queued->flags,
+ shdr->sh_flags);
queued->align = MAX (queued->align, shdr->sh_addralign);
}
}
@@ -1028,6 +1069,9 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
size_t nsymbols = 0;
size_t nlocalsymbols = 0;
bool has_merge_sections = false;
+ /* Unless we have different information we assume the code needs
+ an executable stack. */
+ enum execstack execstack = execstack_true;
/* Prerequisites. */
assert (fileinfo->elf != NULL);
@@ -1234,9 +1278,26 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
|| shdr->sh_type == SHT_INIT_ARRAY
|| shdr->sh_type == SHT_FINI_ARRAY
|| shdr->sh_type == SHT_PREINIT_ARRAY))
- add_section (fileinfo, &fileinfo->scninfo[cnt]);
+ {
+ /* Check whether the check needs to be executable. */
+ if (shdr->sh_type == SHT_PROGBITS
+ && (shdr->sh_flags & SHF_EXECINSTR) == 0
+ && strcmp (elf_strptr (fileinfo->elf, fileinfo->shstrndx,
+ shdr->sh_name),
+ ".note.GNU-stack") == 0)
+ execstack = execstack_false;
+
+ add_section (fileinfo, &fileinfo->scninfo[cnt]);
+ }
}
+ /* Now we know more about the requirements for an executable stack
+ of the result. */
+ if (fileinfo->file_type == relocatable_file_type
+ && execstack == execstack_true
+ && ld_state.execstack != execstack_false_force)
+ ld_state.execstack = execstack_true;
+
/* Handle the symbols. Record defined and undefined symbols in the
hash table. In theory there can be a file without any symbol
table. */
@@ -1346,6 +1407,11 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
if (unlikely (shndx == SHN_ABS) && secttype == SHT_DYNSYM)
continue;
+ if ((shndx < SHN_LORESERVE || shndx > SHN_HIRESERVE)
+ && fileinfo->scninfo[shndx].unused_comdat)
+ /* The symbol is not used. */
+ continue;
+
/* If the DSO uses symbols determine whether this is the default
version. Otherwise we'll ignore the symbol. */
if (versymdata != NULL)
@@ -1370,9 +1436,9 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
_GLOBAL_OFFSET_TABLE_, _DYNAMIC. */
// XXX This loop is hot and the following tests hardly ever match.
// XXX Maybe move the tests somewhere they are executed less often.
- if (((unlikely (hval == 165832675)
+ if (((unlikely (hval == 165832675ul)
&& strcmp (search.name, "_DYNAMIC") == 0)
- || (unlikely (hval == 102264335)
+ || (unlikely (hval == 102264335ul)
&& strcmp (search.name, "_GLOBAL_OFFSET_TABLE_") == 0))
&& sym->st_shndx != SHN_UNDEF
/* If somebody defines such a variable in a relocatable we
@@ -1385,7 +1451,7 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
struct symbol *newp;
if (likely (oldp == NULL))
{
- /* No symbol of this name know. Add it. */
+ /* No symbol of this name known. Add it. */
newp = (struct symbol *) obstack_alloc (&ld_state.smem,
sizeof (*newp));
newp->name = search.name;
@@ -1401,6 +1467,8 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
newp->weak = XELF_ST_BIND (sym->st_info) == STB_WEAK;
newp->added = 0;
newp->merged = 0;
+ newp->local = 0;
+ newp->hidden = 0;
newp->need_copy = 0;
newp->on_dsolist = 0;
newp->in_dso = secttype == SHT_DYNSYM;
@@ -1534,8 +1602,11 @@ ld_handle_filename_list (struct filename_list *fnames)
curp = runp->real = ld_new_inputfile (runp->name, relocatable_file_type);
/* Set flags for group handling. */
- runp->real->group_start = runp->group_start;
- runp->real->group_end = runp->group_end;
+ curp->group_start = runp->group_start;
+ curp->group_end = runp->group_end;
+
+ /* Set as-needed flag from the file, not the command line. */
+ curp->as_needed = runp->as_needed;
/* Read the file and everything else which comes up, including
handling groups. */
@@ -1863,6 +1934,18 @@ file_process2 (struct usedfiles *fileinfo)
return 1;
}
+ /* Make sure the file type matches the backend. */
+ if (FILEINFO_EHDR (fileinfo->ehdr).e_machine
+ != ebl_get_elfmachine (ld_state.ebl))
+ {
+ fprintf (stderr, gettext ("\
+%s: input file incompatible with ELF machine type %s\n"),
+ fileinfo->rfname,
+ ebl_backend_name (ld_state.ebl));
+ fileinfo->status = closed;
+ return 1;
+ }
+
/* Determine the section header string table section index. */
if (unlikely (elf_getshstrndx (fileinfo->elf, &fileinfo->shstrndx)
< 0))
@@ -2261,15 +2344,15 @@ ld_generic_generate_sections (struct ld_state *statep)
program header. */
if (dynamically_linked_p ())
{
- int ndt_needed;
/* Use any versioning (defined or required)? */
bool use_versioning = false;
/* Use version requirements? */
bool need_version = false;
/* First the .interp section. */
- new_generated_scn (scn_dot_interp, ".interp", SHT_PROGBITS, SHF_ALLOC,
- 0, 1);
+ if (ld_state.interp != NULL || ld_state.file_type != dso_file_type)
+ new_generated_scn (scn_dot_interp, ".interp", SHT_PROGBITS, SHF_ALLOC,
+ 0, 1);
/* Now the .dynamic section. */
new_generated_scn (scn_dot_dynamic, ".dynamic", SHT_DYNAMIC,
@@ -2292,11 +2375,6 @@ ld_generic_generate_sections (struct ld_state *statep)
new_generated_scn (scn_dot_hash, ".hash", SHT_HASH, SHF_ALLOC,
sizeof (Elf32_Word), sizeof (Elf32_Word));
- /* By default we add all DSOs provided on the command line. If
- the user added '-z ignore' to the command line we only add
- those which are actually used. */
- ndt_needed = ld_state.ignore_unused_dsos ? 0 : ld_state.ndsofiles;
-
/* Create the section associated with the PLT if necessary. */
if (ld_state.nplt > 0)
{
@@ -2371,29 +2449,29 @@ ld_generic_generate_sections (struct ld_state *statep)
new_generated_scn (scn_dot_version_r, ".gnu.version_r",
SHT_GNU_verneed, SHF_ALLOC, 0,
xelf_fsize (ld_state.outelf, ELF_T_WORD, 1));
+ }
- /* Now count the used DSOs since this is what the user
- wants. */
- ndt_needed = 0;
- if (ld_state.ndsofiles > 0)
- {
- struct usedfiles *frunp = ld_state.dsofiles;
+ /* Now count the used DSOs since this is what the user
+ wants. */
+ int ndt_needed = 0;
+ if (ld_state.ndsofiles > 0)
+ {
+ struct usedfiles *frunp = ld_state.dsofiles;
- do
- if (! ld_state.ignore_unused_dsos || frunp->used)
- {
- ++ndt_needed;
- if (frunp->lazyload)
- /* We have to create another dynamic section
- entry for the DT_POSFLAG_1 entry.
-
- XXX Once more functionality than the
- lazyloading flag are suppported the test
- must be extended. */
- ++ndt_needed;
- }
- while ((frunp = frunp->next) != ld_state.dsofiles);
- }
+ do
+ if (! frunp->as_needed || frunp->used)
+ {
+ ++ndt_needed;
+ if (frunp->lazyload)
+ /* We have to create another dynamic section
+ entry for the DT_POSFLAG_1 entry.
+
+ XXX Once more functionality than the lazyloading
+ flag are suppported the test must be
+ extended. */
+ ++ndt_needed;
+ }
+ while ((frunp = frunp->next) != ld_state.dsofiles);
}
if (use_versioning)
@@ -2471,7 +2549,7 @@ ld_generic_open_outfile (struct ld_state *statep, int machine, int klass,
{
strcpy (mempcpy (tempfname, ld_state.outfname, outfname_len), ".XXXXXX");
- /* The useof mktemp() here is fine. We do not want to use
+ /* The use of mktemp() here is fine. We do not want to use
mkstemp() since then the umask isn't used. And the output
file will have these permissions anyhow. Any intruder could
change the file later if it would be possible now. */
@@ -2666,7 +2744,7 @@ match_section (const char *osectname, struct filemask_section_name *sectmask,
const char *brfname = basename (runp->fileinfo->rfname);
/* If the section isn't used, the name doesn't match the positive
- inclusion list or the name does match the negative inclusion
+ inclusion list, or the name does match the negative inclusion
list, ignore the section. */
if (!runp->used
|| (sectmask->filemask != NULL
@@ -2711,7 +2789,9 @@ match_section (const char *osectname, struct filemask_section_name *sectmask,
newp->kind = scn_normal;
newp->name = osectname;
newp->type = SCNINFO_SHDR (found->shdr).sh_type;
- newp->flags = SCNINFO_SHDR (found->shdr).sh_flags;
+ /* Executable or DSO do not have section groups. Drop that
+ information. */
+ newp->flags = SCNINFO_SHDR (found->shdr).sh_flags & ~SHF_GROUP;
newp->segment_nr = segment_nr;
newp->last = found->next = found;
newp->used = true;
@@ -2742,9 +2822,12 @@ match_section (const char *osectname, struct filemask_section_name *sectmask,
/* XXX Any better choice? */
queued->type = SHT_PROGBITS;
if (queued->flags != SCNINFO_SHDR (found->shdr).sh_flags)
+ /* Executable or DSO do not have section groups. Drop that
+ information. */
queued->flags = ebl_sh_flags_combine (ld_state.ebl,
queued->flags,
- SCNINFO_SHDR (found->shdr).sh_flags);
+ SCNINFO_SHDR (found->shdr).sh_flags
+ & ~SHF_GROUP);
/* Accumulate the relocation section size. */
queued->relsize += found->relsize;
@@ -3173,7 +3256,7 @@ reduce_symbol_p (XElf_Sym *sym, struct Ebl_Strent *strent)
{
search.id = strndupa (str, version - str);
if (*++version == VER_CHR)
- /* Skip the second '@' signalling a default definition. */
+ /* Skip the second '@' signaling a default definition. */
++version;
}
else
@@ -3491,9 +3574,9 @@ fillin_special_symbol (struct symbol *symst, size_t scnidx, size_t nsym,
/* The name offset will be filled in later. */
sym->st_name = 0;
/* Traditionally: globally visible. */
- sym->st_info = XELF_ST_INFO (STB_GLOBAL, symst->type);
- /* No special visibility or so. */
- sym->st_other = 0;
+ sym->st_info = XELF_ST_INFO (symst->local ? STB_LOCAL : STB_GLOBAL,
+ symst->type);
+ sym->st_other = symst->hidden ? STV_HIDDEN : STV_DEFAULT;
/* Reference to the GOT or dynamic section. Since the GOT and
dynamic section are only created for executables and DSOs it
cannot be that the section index is too large. */
@@ -3580,66 +3663,62 @@ allocate_version_names (struct usedfiles *runp, struct Ebl_Strtab *dynstrtab)
}
-XElf_Off
+static XElf_Off
create_verneed_data (XElf_Off offset, Elf_Data *verneeddata,
struct usedfiles *runp, int *ntotal)
{
- size_t verneed_size = xelf_fsize (ld_state.outelf, ELF_T_VNEED, 1);
- size_t vernaux_size = xelf_fsize (ld_state.outelf, ELF_T_VNAUX, 1);
- int need_offset;
- bool filled = false;
- GElf_Verneed verneed;
- GElf_Vernaux vernaux;
- int ndef = 0;
-size_t cnt;
-
- /* If this DSO has no versions skip it. */
- if (runp->nverdefused == 0)
- return offset;
-
- /* We fill in the Verneed record last. Remember the
- offset. */
- need_offset = offset;
- offset += verneed_size;
-
- for (cnt = 2; cnt <= runp->nverdef; ++cnt)
- if (runp->verdefused[cnt] != 0)
- {
- assert (runp->verdefent[cnt] != NULL);
+ size_t verneed_size = xelf_fsize (ld_state.outelf, ELF_T_VNEED, 1);
+ size_t vernaux_size = xelf_fsize (ld_state.outelf, ELF_T_VNAUX, 1);
+ int need_offset;
+ bool filled = false;
+ GElf_Verneed verneed;
+ GElf_Vernaux vernaux;
+ int ndef = 0;
+ size_t cnt;
- if (filled)
- {
- vernaux.vna_next = vernaux_size;
- (void) gelf_update_vernaux (verneeddata, offset,
- &vernaux);
- offset += vernaux_size;
- }
+ /* If this DSO has no versions skip it. */
+ if (runp->nverdefused == 0)
+ return offset;
- vernaux.vna_hash
- = elf_hash (ebl_string (runp->verdefent[cnt]));
- vernaux.vna_flags = 0;
- vernaux.vna_other = runp->verdefused[cnt];
- vernaux.vna_name = ebl_strtaboffset (runp->verdefent[cnt]);
- filled = true;
- ++ndef;
- }
+ /* We fill in the Verneed record last. Remember the offset. */
+ need_offset = offset;
+ offset += verneed_size;
+
+ for (cnt = 2; cnt <= runp->nverdef; ++cnt)
+ if (runp->verdefused[cnt] != 0)
+ {
+ assert (runp->verdefent[cnt] != NULL);
+
+ if (filled)
+ {
+ vernaux.vna_next = vernaux_size;
+ (void) gelf_update_vernaux (verneeddata, offset, &vernaux);
+ offset += vernaux_size;
+ }
+
+ vernaux.vna_hash = elf_hash (ebl_string (runp->verdefent[cnt]));
+ vernaux.vna_flags = 0;
+ vernaux.vna_other = runp->verdefused[cnt];
+ vernaux.vna_name = ebl_strtaboffset (runp->verdefent[cnt]);
+ filled = true;
+ ++ndef;
+ }
- assert (filled);
- vernaux.vna_next = 0;
- (void) gelf_update_vernaux (verneeddata, offset, &vernaux);
- offset += vernaux_size;
-
- verneed.vn_version = VER_NEED_CURRENT;
- verneed.vn_cnt = ndef;
- verneed.vn_file = ebl_strtaboffset (runp->verdefent[1]);
- /* The first auxiliary entry is always found directly
- after the verneed entry. */
- verneed.vn_aux = verneed_size;
- verneed.vn_next = --*ntotal > 0 ? offset - need_offset : 0;
- (void) gelf_update_verneed (verneeddata, need_offset,
- &verneed);
-
- return offset;
+ assert (filled);
+ vernaux.vna_next = 0;
+ (void) gelf_update_vernaux (verneeddata, offset, &vernaux);
+ offset += vernaux_size;
+
+ verneed.vn_version = VER_NEED_CURRENT;
+ verneed.vn_cnt = ndef;
+ verneed.vn_file = ebl_strtaboffset (runp->verdefent[1]);
+ /* The first auxiliary entry is always found directly
+ after the verneed entry. */
+ verneed.vn_aux = verneed_size;
+ verneed.vn_next = --*ntotal > 0 ? offset - need_offset : 0;
+ (void) gelf_update_verneed (verneeddata, need_offset, &verneed);
+
+ return offset;
}
@@ -3654,7 +3733,7 @@ size_t cnt;
For executables (shared or not) we have to create the program header,
additional sections like the .interp, eventually (in addition) create
a dynamic symbol table and a dynamic section. Also the relocations
-have to be processed differently. */
+ have to be processed differently. */
static int
ld_generic_create_outfile (struct ld_state *statep)
{
@@ -3920,7 +3999,7 @@ ld_generic_create_outfile (struct ld_state *statep)
struct usedfiles *frunp = ld_state.dsofiles;
do
- if (! ld_state.ignore_unused_dsos || frunp->used)
+ if (! frunp->as_needed || frunp->used)
frunp->sonameent = ebl_strtabadd (dynstrtab, frunp->soname,
0);
while ((frunp = frunp->next) != ld_state.dsofiles);
@@ -4522,6 +4601,7 @@ ld_generic_create_outfile (struct ld_state *statep)
file = ld_state.relfiles->next;
symdata = elf_getdata (elf_getscn (ld_state.outelf, ld_state.symscnidx),
NULL);
+
do
{
size_t maxcnt;
@@ -4580,11 +4660,11 @@ ld_generic_create_outfile (struct ld_state *statep)
continue;
#if NATIVE_ELF != 0
- /* Copy old data. */
- XElf_Sym *sym2 = sym;
- assert (nsym < nsym_allocated);
- xelf_getsym (symdata, nsym, sym);
- *sym = *sym2;
+ /* Copy old data. We create a temporary copy because the
+ symbol might still be discarded. */
+ XElf_Sym sym_mem;
+ sym_mem = *sym;
+ sym = &sym_mem;
#endif
if (sym->st_shndx != SHN_UNDEF
@@ -4689,6 +4769,7 @@ section index too large in dynamic symbol table"));
/* Once we know the name this field will get the correct
offset. For now set it to zero which means no name
associated. */
+ GElf_Word st_name = sym->st_name;
sym->st_name = 0;
/* If we had to merge sections we have a completely new
@@ -4699,7 +4780,7 @@ section index too large in dynamic symbol table"));
/* Create the record in the output sections. */
assert (nsym < nsym_allocated);
- xelf_update_symshndx (symdata, xndxdata, nsym, sym, xndx, 0);
+ xelf_update_symshndx (symdata, xndxdata, nsym, sym, xndx, 1);
/* Add the reference to the symbol record in case we need it.
Find the symbol if this has not happened yet. We do
@@ -4707,12 +4788,33 @@ section index too large in dynamic symbol table"));
if (defp == NULL && cnt >= file->nlocalsymbols)
{
defp = file->symref[cnt];
- assert (defp != NULL);
+
+ if (defp == NULL)
+ {
+ /* This is a symbol in a discarded COMDAT section.
+ Find the definition we actually use. */
+ // XXX The question is: do we have to do this here
+ // XXX or can we do it earlier when we discard the
+ // XXX section.
+ struct symbol search;
+ search.name = elf_strptr (file->elf, file->symstridx,
+ st_name);
+ struct symbol *realp
+ = ld_symbol_tab_find (&ld_state.symbol_tab,
+ elf_hash (search.name), &search);
+ if (realp == NULL)
+ // XXX What to do here?
+ error (EXIT_FAILURE, 0,
+ "couldn't find symbol from COMDAT section");
+
+ file->symref[cnt] = realp;
+
+ continue;
+ }
}
- /* Store the reference to the symbol record. The
- sorting code will have to keep this array in the
- correct order, too. */
+ /* Store the reference to the symbol record. The sorting
+ code will have to keep this array in the correct order, too. */
ndxtosym[nsym] = defp;
/* One more entry finished. */
@@ -4729,7 +4831,6 @@ section index too large in dynamic symbol table"));
nothing. */
assert (xndxdata == NULL || need_xndx);
-
/* Create the version related sections. */
if (ld_state.verneedscnidx != 0)
{
@@ -5162,7 +5263,8 @@ section index too large in dynamic symbol table"));
if (XELF_ST_TYPE (sym->st_info) == STT_FILE
|| XELF_ST_VISIBILITY (sym->st_other) == STV_INTERNAL
|| XELF_ST_VISIBILITY (sym->st_other) == STV_HIDDEN
- || (!ndxtosym[cnt]->in_dso && ndxtosym[cnt]->defined))
+ || (!ld_state.export_all_dynamic
+ && !ndxtosym[cnt]->in_dso && ndxtosym[cnt]->defined))
{
symstrent[cnt] = NULL;
continue;
@@ -5185,7 +5287,9 @@ section index too large in dynamic symbol table"));
{
struct symbol *symp = ndxtosym[cnt];
- if (symp->file->verdefdata != NULL)
+ /* Synthetic symbols (i.e., those with no file attached)
+ have no version information. */
+ if (symp->file != NULL && symp->file->verdefdata != NULL)
{
GElf_Versym versym;
@@ -5280,7 +5384,6 @@ cannot create hash table section for output file: %s"),
if (symstrent[cnt] != NULL)
{
XElf_Sym_vardef (sym);
- size_t hashidx;
size_t dynidx = ndxtosym[cnt]->outdynsymidx;
#if NATIVE_ELF != 0
@@ -5298,7 +5401,7 @@ cannot create hash table section for output file: %s"),
(void) xelf_update_sym (dynsymdata, dynidx, sym);
/* Add to the hash table. */
- hashidx = hashcodes[dynidx] % nbucket;
+ size_t hashidx = hashcodes[dynidx] % nbucket;
if (bucket[hashidx] == 0)
bucket[hashidx] = dynidx;
else
@@ -5425,7 +5528,7 @@ cannot create hash table section for output file: %s"),
strtab_ent = ebl_strtabadd (ld_state.shstrtab, ".strtab", 8);
/* At this point we would have to test for failures in the
allocation. But we skip this. First, the problem will be caught
- latter when doing more allocations for the section header table.
+ later when doing more allocations for the section header table.
Even if this would not be the case all that would happen is that
the section names are empty. The binary would still be usable if
it is an executable or a DSO. Not adding the test here saves
@@ -5530,11 +5633,7 @@ cannot create hash table section for output file: %s"),
groups = ld_state.groups;
while (groups != NULL)
{
- Elf_Scn *scn;
- struct scngroup *oldp;
- Elf32_Word si;
-
- scn = elf_getscn (ld_state.outelf, groups->outscnidx);
+ Elf_Scn *scn = elf_getscn (ld_state.outelf, groups->outscnidx);
xelf_getshdr (scn, shdr);
assert (shdr != NULL);
@@ -5545,7 +5644,8 @@ cannot create hash table section for output file: %s"),
shdr->sh_entsize = sizeof (Elf32_Word);
/* Determine the index for the signature symbol. */
- si = groups->symbol->file->symindirect[groups->symbol->symidx];
+ Elf32_Word si
+ = groups->symbol->file->symindirect[groups->symbol->symidx];
if (si == 0)
{
assert (groups->symbol->file->symref[groups->symbol->symidx]
@@ -5557,7 +5657,7 @@ cannot create hash table section for output file: %s"),
(void) xelf_update_shdr (scn, shdr);
- oldp = groups;
+ struct scngroup *oldp = groups;
groups = groups->next;
free (oldp);
}
@@ -5580,6 +5680,10 @@ cannot create hash table section for output file: %s"),
XXX Determine whether the segment is non-empty. */
nphdr = 0;
+
+ /* We always add a PT_GNU_stack entry. */
+ ++nphdr;
+
segment = ld_state.output_segments;
while (segment != NULL)
{
@@ -5590,10 +5694,16 @@ cannot create hash table section for output file: %s"),
/* Add the number of SHT_NOTE sections. We counted them earlier. */
nphdr += ld_state.nnotesections;
- /* If we create a DSO or the file is linked against DSOs we have three
- more entries: INTERP, PHDR, DYNAMIC. */
+ /* If we create a DSO or the file is linked against DSOs we have
+ at least one more entry: DYNAMIC. If an interpreter is
+ specified we add PHDR and INTERP, too. */
if (dynamically_linked_p ())
- nphdr += 3;
+ {
+ ++nphdr;
+
+ if (ld_state.interp != NULL || ld_state.file_type != dso_file_type)
+ nphdr += 2;
+ }
/* Create the program header structure. */
if (xelf_newphdr (ld_state.outelf, nphdr) == 0)
@@ -5621,7 +5731,14 @@ cannot create hash table section for output file: %s"),
addr = shdr->sh_offset;
/* The index of the first loadable segment. */
- nphdr = 1 + (dynamically_linked_p () == true) * 2;
+ nphdr = 0;
+ if (dynamically_linked_p ())
+ {
+ ++nphdr;
+ if (ld_state.interp != NULL
+ || ld_state.file_type != dso_file_type)
+ nphdr += 2;
+ }
segment = ld_state.output_segments;
while (segment != NULL)
@@ -5779,20 +5896,23 @@ internal error: nobits section follows nobits section"));
xelf_getehdr (ld_state.outelf, ehdr);
assert (ehdr != NULL);
- xelf_getphdr_ptr (ld_state.outelf, 1, phdr);
- phdr->p_type = PT_PHDR;
- phdr->p_offset = ehdr->e_phoff;
- phdr->p_vaddr = ld_state.output_segments->addr + phdr->p_offset;
- phdr->p_paddr = phdr->p_vaddr;
- phdr->p_filesz = ehdr->e_phnum * ehdr->e_phentsize;
- phdr->p_memsz = phdr->p_filesz;
- phdr->p_flags = 0; /* No need to set PF_R or so. */
- phdr->p_align = xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1);
- (void) xelf_update_phdr (ld_state.outelf, 0, phdr);
+ /* Add the stack information. */
+ xelf_getphdr_ptr (ld_state.outelf, nphdr, phdr);
+ phdr->p_type = PT_GNU_STACK;
+ phdr->p_offset = 0;
+ phdr->p_vaddr = 0;
+ phdr->p_paddr = 0;
+ phdr->p_filesz = 0;
+ phdr->p_memsz = 0;
+ phdr->p_flags = ld_state.execstack == execstack_true ? PF_X : 0;
+ phdr->p_align = 0;
+ (void) xelf_update_phdr (ld_state.outelf, nphdr, phdr);
+ ++nphdr;
- /* Adjust the addresses in the addresses of the symbol according
- to the load addresses of the sections. */
+
+ /* Adjust the addresses in the address fields of the symbol
+ records according to the load addresses of the sections. */
if (ld_state.need_symtab)
for (cnt = 1; cnt < nsym; ++cnt)
{
@@ -5892,24 +6012,41 @@ internal error: nobits section follows nobits section"));
{
Elf_Scn *outscn;
- assert (ld_state.interpscnidx != 0);
- xelf_getshdr (elf_getscn (ld_state.outelf, ld_state.interpscnidx),
- shdr);
- assert (shdr != NULL);
+ int idx = 0;
+ if (ld_state.interp != NULL || ld_state.file_type != dso_file_type)
+ {
+ assert (ld_state.interpscnidx != 0);
+ xelf_getshdr (elf_getscn (ld_state.outelf,
+ ld_state.interpscnidx), shdr);
+ assert (shdr != NULL);
- /* The interpreter string. */
- // XXX Do we need to support files (DSOs) without interpreters?
- xelf_getphdr_ptr (ld_state.outelf, 1, phdr);
- phdr->p_type = PT_INTERP;
- phdr->p_offset = shdr->sh_offset;
- phdr->p_vaddr = shdr->sh_addr;
- phdr->p_paddr = phdr->p_vaddr;
- phdr->p_filesz = shdr->sh_size;
- phdr->p_memsz = phdr->p_filesz;
- phdr->p_flags = 0; /* No need to set PF_R or so. */
- phdr->p_align = 1; /* It's a string. */
+ xelf_getphdr_ptr (ld_state.outelf, idx, phdr);
+ phdr->p_type = PT_PHDR;
+ phdr->p_offset = ehdr->e_phoff;
+ phdr->p_vaddr = ld_state.output_segments->addr + phdr->p_offset;
+ phdr->p_paddr = phdr->p_vaddr;
+ phdr->p_filesz = ehdr->e_phnum * ehdr->e_phentsize;
+ phdr->p_memsz = phdr->p_filesz;
+ phdr->p_flags = 0; /* No need to set PF_R or so. */
+ phdr->p_align = xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1);
+
+ (void) xelf_update_phdr (ld_state.outelf, idx, phdr);
+ ++idx;
+
+ /* The interpreter string. */
+ xelf_getphdr_ptr (ld_state.outelf, idx, phdr);
+ phdr->p_type = PT_INTERP;
+ phdr->p_offset = shdr->sh_offset;
+ phdr->p_vaddr = shdr->sh_addr;
+ phdr->p_paddr = phdr->p_vaddr;
+ phdr->p_filesz = shdr->sh_size;
+ phdr->p_memsz = phdr->p_filesz;
+ phdr->p_flags = 0; /* No need to set PF_R or so. */
+ phdr->p_align = 1; /* It's a string. */
- (void) xelf_update_phdr (ld_state.outelf, 1, phdr);
+ (void) xelf_update_phdr (ld_state.outelf, idx, phdr);
+ ++idx;
+ }
/* The pointer to the dynamic section. We this we need to
get the information for the dynamic section first. */
@@ -5918,7 +6055,7 @@ internal error: nobits section follows nobits section"));
xelf_getshdr (outscn, shdr);
assert (shdr != NULL);
- xelf_getphdr_ptr (ld_state.outelf, 2, phdr);
+ xelf_getphdr_ptr (ld_state.outelf, idx, phdr);
phdr->p_type = PT_DYNAMIC;
phdr->p_offset = shdr->sh_offset;
phdr->p_vaddr = shdr->sh_addr;
@@ -5928,7 +6065,7 @@ internal error: nobits section follows nobits section"));
phdr->p_flags = 0; /* No need to set PF_R or so. */
phdr->p_align = shdr->sh_addralign;
- (void) xelf_update_phdr (ld_state.outelf, 2, phdr);
+ (void) xelf_update_phdr (ld_state.outelf, idx, phdr);
/* Fill in the reference to the .dynstr section. */
assert (ld_state.dynstrscnidx != 0);
@@ -5945,7 +6082,7 @@ internal error: nobits section follows nobits section"));
struct usedfiles *runp = ld_state.dsofiles->next;
do
- if (! ld_state.ignore_unused_dsos || runp->used)
+ if (runp->used || !runp->as_needed)
{
/* Add the position-dependent flag if necessary. */
if (runp->lazyload)
diff --git a/elfutils/src/ldscript.c b/elfutils/src/ldscript.c
index eb7eb358..063b792e 100644
--- a/elfutils/src/ldscript.c
+++ b/elfutils/src/ldscript.c
@@ -129,7 +129,7 @@
#line 1 "/home/drepper/devel/elfutils/src/ldscript.y"
/* Parser for linker scripts.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -395,16 +395,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 32
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 228
+#define YYLAST 226
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 40
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 22
+#define YYNNTS 23
/* YYNRULES -- Number of rules. */
-#define YYNRULES 65
+#define YYNRULES 66
/* YYNRULES -- Number of states. */
-#define YYNSTATES 158
+#define YYNSTATES 159
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -456,50 +456,51 @@ static const unsigned char yyprhs[] =
37, 43, 49, 54, 59, 64, 69, 74, 77, 79,
82, 87, 90, 94, 101, 104, 106, 108, 113, 116,
122, 124, 129, 134, 135, 140, 144, 148, 152, 156,
- 160, 164, 166, 168, 170, 172, 177, 182, 186, 188,
- 190, 191, 194, 196, 201, 207, 214, 217, 219, 222,
- 225, 229, 232, 234, 236, 238
+ 160, 164, 166, 168, 170, 172, 176, 178, 180, 181,
+ 186, 191, 193, 196, 198, 203, 209, 216, 219, 221,
+ 224, 227, 231, 234, 236, 238, 240
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
- 41, 0, -1, 42, -1, 27, 55, -1, 42, 43,
+ 41, 0, -1, 42, -1, 27, 56, -1, 42, 43,
-1, 43, -1, 6, 33, 11, 34, 35, -1, 22,
- 33, 60, 34, 35, -1, 20, 33, 18, 34, 35,
- -1, 13, 33, 60, 34, 35, -1, 23, 16, 36,
+ 33, 61, 34, 35, -1, 20, 33, 18, 34, 35,
+ -1, 13, 33, 61, 34, 35, -1, 23, 16, 36,
44, 37, -1, 23, 1, 36, 44, 37, -1, 10,
33, 53, 34, -1, 12, 33, 53, 34, -1, 5,
- 33, 53, 34, -1, 26, 36, 55, 37, -1, 19,
- 33, 60, 34, -1, 44, 45, -1, 45, -1, 46,
+ 33, 53, 34, -1, 26, 36, 56, 37, -1, 19,
+ 33, 61, 34, -1, 44, 45, -1, 45, -1, 46,
35, -1, 11, 36, 47, 37, -1, 11, 35, -1,
11, 38, 52, -1, 21, 33, 11, 38, 52, 34,
-1, 47, 48, -1, 48, -1, 49, -1, 14, 33,
- 49, 34, -1, 46, 35, -1, 61, 33, 51, 50,
+ 49, 34, -1, 46, 35, -1, 62, 33, 51, 50,
34, -1, 11, -1, 25, 33, 11, 34, -1, 7,
- 33, 60, 34, -1, -1, 4, 33, 52, 34, -1,
+ 33, 61, 34, -1, -1, 4, 33, 52, 34, -1,
33, 52, 34, -1, 52, 31, 52, -1, 52, 17,
52, -1, 52, 3, 52, -1, 52, 29, 52, -1,
52, 28, 52, -1, 18, -1, 11, -1, 24, -1,
- 20, -1, 10, 33, 53, 34, -1, 5, 33, 53,
- 34, -1, 53, 54, 60, -1, 60, -1, 39, -1,
- -1, 55, 56, -1, 56, -1, 36, 57, 37, 35,
- -1, 60, 36, 57, 37, 35, -1, 60, 36, 57,
- 37, 60, 35, -1, 57, 58, -1, 58, -1, 9,
- 59, -1, 15, 59, -1, 59, 61, 35, -1, 61,
- 35, -1, 8, -1, 11, -1, 60, -1, 31, -1
+ 20, -1, 53, 54, 55, -1, 55, -1, 39, -1,
+ -1, 10, 33, 53, 34, -1, 5, 33, 53, 34,
+ -1, 61, -1, 56, 57, -1, 57, -1, 36, 58,
+ 37, 35, -1, 61, 36, 58, 37, 35, -1, 61,
+ 36, 58, 37, 61, 35, -1, 58, 59, -1, 59,
+ -1, 9, 60, -1, 15, 60, -1, 60, 62, 35,
+ -1, 62, 35, -1, 8, -1, 11, -1, 61, -1,
+ 31, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 142, 142, 143, 147, 148, 151, 156, 160, 165,
- 170, 174, 180, 191, 193, 195, 197, 201, 206, 210,
- 215, 227, 251, 253, 257, 262, 266, 271, 278, 285,
- 296, 298, 302, 305, 308, 313, 315, 321, 327, 333,
- 339, 345, 350, 355, 357, 361, 372, 374, 380, 384,
- 385, 388, 393, 397, 403, 409, 418, 420, 424, 426,
- 431, 437, 441, 443, 447, 449
+ 0, 143, 143, 144, 148, 149, 152, 157, 161, 166,
+ 172, 176, 182, 193, 195, 197, 199, 203, 208, 212,
+ 217, 229, 253, 255, 259, 264, 268, 273, 280, 287,
+ 298, 300, 304, 307, 310, 315, 317, 323, 329, 335,
+ 341, 347, 352, 357, 359, 363, 368, 372, 373, 376,
+ 387, 389, 394, 399, 403, 409, 415, 424, 426, 430,
+ 432, 437, 443, 447, 449, 453, 455
};
#endif
@@ -517,8 +518,8 @@ static const char *const yytname[] =
"','", "$accept", "script_or_version", "file", "content",
"outputsections", "outputsection", "assignment", "inputsections",
"inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr",
- "filename_id_list", "comma_opt", "versionlist", "version",
- "version_stmt_list", "version_stmt", "filename_id_star_list",
+ "filename_id_list", "comma_opt", "filename_id_listelem", "versionlist",
+ "version", "version_stmt_list", "version_stmt", "filename_id_star_list",
"filename_id", "filename_id_star", 0
};
#endif
@@ -542,9 +543,9 @@ static const unsigned char yyr1[] =
43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
45, 45, 46, 46, 47, 47, 48, 48, 48, 49,
50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 53, 53, 53, 53, 54,
- 54, 55, 55, 56, 56, 56, 57, 57, 58, 58,
- 59, 59, 60, 60, 61, 61
+ 52, 52, 52, 52, 52, 53, 53, 54, 54, 55,
+ 55, 55, 56, 56, 57, 57, 57, 58, 58, 59,
+ 59, 60, 60, 61, 61, 62, 62
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -554,9 +555,9 @@ static const unsigned char yyr2[] =
5, 5, 4, 4, 4, 4, 4, 2, 1, 2,
4, 2, 3, 6, 2, 1, 1, 4, 2, 5,
1, 4, 4, 0, 4, 3, 3, 3, 3, 3,
- 3, 1, 1, 1, 1, 4, 4, 3, 1, 1,
- 0, 2, 1, 4, 5, 6, 2, 1, 2, 2,
- 3, 2, 1, 1, 1, 1
+ 3, 1, 1, 1, 1, 3, 1, 1, 0, 4,
+ 4, 1, 2, 1, 4, 5, 6, 2, 1, 2,
+ 2, 3, 2, 1, 1, 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -566,59 +567,59 @@ static const unsigned char yydefact[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 2, 5, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 62, 63, 0, 3,
- 52, 0, 1, 4, 0, 0, 50, 48, 0, 50,
- 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 57, 51, 0, 0, 0, 14, 49, 0, 0,
- 12, 13, 0, 16, 0, 0, 0, 0, 0, 18,
- 0, 0, 15, 65, 58, 64, 0, 59, 0, 56,
- 0, 50, 50, 47, 6, 9, 8, 7, 21, 0,
- 0, 0, 11, 17, 19, 10, 0, 61, 53, 0,
- 46, 45, 63, 0, 0, 0, 25, 26, 0, 0,
- 42, 41, 44, 43, 0, 22, 0, 60, 54, 0,
- 0, 28, 20, 24, 33, 0, 0, 0, 0, 0,
- 0, 0, 0, 55, 0, 0, 0, 0, 35, 38,
- 37, 40, 39, 36, 0, 27, 0, 30, 0, 0,
- 34, 23, 0, 0, 29, 32, 0, 31
+ 0, 0, 0, 0, 0, 0, 63, 64, 0, 3,
+ 53, 0, 1, 4, 0, 0, 48, 46, 51, 0,
+ 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 58, 52, 0, 0, 0, 14, 47, 0,
+ 0, 12, 13, 0, 16, 0, 0, 0, 0, 0,
+ 18, 0, 0, 15, 66, 59, 65, 0, 60, 0,
+ 57, 0, 48, 48, 45, 6, 9, 8, 7, 21,
+ 0, 0, 0, 11, 17, 19, 10, 0, 62, 54,
+ 0, 50, 49, 64, 0, 0, 0, 25, 26, 0,
+ 0, 42, 41, 44, 43, 0, 22, 0, 61, 55,
+ 0, 0, 28, 20, 24, 33, 0, 0, 0, 0,
+ 0, 0, 0, 0, 56, 0, 0, 0, 0, 35,
+ 38, 37, 40, 39, 36, 0, 27, 0, 30, 0,
+ 0, 34, 23, 0, 0, 29, 32, 0, 31
};
/* YYDEFGOTO[NTERM-NUM]. */
static const short int yydefgoto[] =
{
- -1, 12, 13, 14, 68, 69, 70, 105, 106, 107,
- 149, 136, 115, 36, 58, 29, 30, 50, 51, 74,
- 75, 108
+ -1, 12, 13, 14, 69, 70, 71, 106, 107, 108,
+ 150, 137, 116, 36, 59, 37, 29, 30, 51, 52,
+ 75, 76, 109
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -46
+#define YYPACT_NINF -86
static const short int yypact[] =
{
- 105, -12, -1, 26, 30, 51, 81, 89, 93, 120,
- 84, 4, 103, 128, -46, 14, 126, 14, 14, 135,
- 135, 121, 135, 109, 116, 4, -46, -46, 87, 4,
- -46, 139, -46, -46, 129, 144, 22, -46, 145, 127,
- 130, 147, 148, 149, 150, 9, 9, 61, 2, 2,
- 67, -46, -46, 87, 14, 14, -46, -46, 135, 143,
- -46, -46, 151, -46, 152, 153, 138, 156, 5, -46,
- 155, 79, -46, -46, 2, -46, 157, 2, 158, -46,
- 68, 131, 133, -46, -46, -46, -46, -46, -46, 98,
- 46, 169, -46, -46, -46, -46, 159, -46, -46, 78,
- -46, -46, 160, 162, 161, 54, -46, -46, 164, 166,
- -46, -46, -46, -46, 46, 64, 163, -46, -46, 165,
- 2, -46, -46, -46, 178, 46, 0, 46, 46, 46,
- 46, 46, 46, -46, 168, 170, 119, 20, -46, 64,
- 64, 70, 77, 146, 24, -46, 135, -46, 171, 172,
- -46, -46, 173, 180, -46, -46, 174, -46
+ 111, -18, -14, 23, 45, 70, 75, 85, 92, 97,
+ 91, 19, 128, 134, -86, 162, 96, 162, 162, 5,
+ 5, 123, 5, 93, 99, 19, -86, -86, 117, 19,
+ -86, 115, -86, -86, 125, 144, 71, -86, -86, 145,
+ 116, 135, 147, 148, 149, 150, 101, 101, 14, 83,
+ 83, 55, -86, -86, 117, 162, 162, -86, -86, 162,
+ 133, -86, -86, 143, -86, 151, 152, 107, 155, 63,
+ -86, 154, 74, -86, -86, 83, -86, 156, 83, 157,
+ -86, 56, 137, 141, -86, -86, -86, -86, -86, -86,
+ 88, 48, 174, -86, -86, -86, -86, 158, -86, -86,
+ 69, -86, -86, 159, 161, 160, 12, -86, -86, 163,
+ 165, -86, -86, -86, -86, 48, 59, 164, -86, -86,
+ 166, 83, -86, -86, -86, 183, 48, 0, 48, 48,
+ 48, 48, 48, 48, -86, 169, 167, 90, 7, -86,
+ 59, 59, 44, 66, 103, 29, -86, 5, -86, 171,
+ 172, -86, -86, 173, 188, -86, -86, 175, -86
};
/* YYPGOTO[NTERM-NUM]. */
static const short int yypgoto[] =
{
- -46, -46, -46, 192, 167, 100, 18, -46, 104, 90,
- -46, -46, 28, -16, -46, 186, 31, 175, -45, 176,
- -11, -3
+ -86, -86, -86, 192, 168, 80, -85, -86, 102, 89,
+ -86, -86, 33, -16, -86, 153, 186, 38, 170, -39,
+ 176, -11, 4
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -628,56 +629,56 @@ static const short int yypgoto[] =
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
- 31, 39, 40, 127, 37, 79, 37, 37, 41, 42,
- 26, 44, 26, 27, 31, 27, 66, 128, 31, 34,
- 66, 15, 26, 127, 35, 27, 67, 127, 129, 130,
- 67, 131, 16, 73, 138, 79, 31, 128, 81, 82,
- 28, 128, 92, 37, 37, 76, 76, 83, 129, 130,
- 109, 131, 129, 130, 150, 131, 56, 110, 151, 17,
- 52, 57, 26, 18, 111, 102, 112, 127, 103, 26,
- 113, 96, 27, 127, 96, 67, 48, 48, 52, 114,
- 127, 128, 49, 49, 19, 73, 26, 128, 119, 27,
- 66, 122, 129, 130, 128, 131, 48, 28, 72, 130,
- 67, 131, 49, 32, 78, 99, 26, 104, 131, 102,
- 1, 2, 103, 118, 20, 3, 95, 4, 5, 67,
- 25, 23, 21, 104, 6, 7, 22, 8, 9, 73,
- 147, 10, 11, 1, 2, 152, 24, 38, 3, 43,
- 4, 5, 126, 26, 148, 45, 27, 6, 7, 127,
- 8, 9, 46, 137, 10, 139, 140, 141, 142, 143,
- 144, 60, 54, 128, 61, 100, 57, 101, 93, 57,
- 57, 93, 57, 88, 89, 53, 90, 55, 84, 59,
- 116, 62, 63, 64, 65, 135, 85, 86, 87, 91,
- 94, 156, 97, 98, 117, 120, 121, 124, 90, 125,
- 133, 132, 145, 146, 153, 33, 154, 155, 157, 123,
- 134, 47, 0, 71, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 77, 0, 0, 80
+ 31, 40, 41, 128, 38, 105, 38, 38, 42, 43,
+ 128, 45, 80, 26, 31, 15, 27, 129, 31, 16,
+ 26, 105, 26, 103, 129, 27, 104, 26, 130, 131,
+ 27, 132, 128, 68, 139, 130, 131, 31, 132, 82,
+ 83, 151, 80, 74, 38, 38, 129, 128, 38, 123,
+ 28, 73, 110, 77, 77, 28, 17, 130, 131, 111,
+ 132, 129, 128, 152, 49, 49, 112, 53, 113, 128,
+ 50, 50, 114, 131, 67, 132, 129, 26, 18, 97,
+ 27, 115, 97, 129, 68, 67, 53, 130, 131, 120,
+ 132, 26, 79, 100, 27, 68, 26, 132, 23, 103,
+ 93, 148, 104, 19, 119, 57, 128, 39, 20, 68,
+ 58, 96, 67, 24, 74, 149, 1, 2, 21, 74,
+ 129, 3, 68, 4, 5, 22, 49, 25, 32, 46,
+ 6, 7, 50, 8, 9, 47, 153, 10, 11, 1,
+ 2, 44, 89, 90, 3, 91, 4, 5, 127, 94,
+ 61, 54, 94, 6, 7, 58, 8, 9, 55, 138,
+ 10, 140, 141, 142, 143, 144, 145, 34, 85, 62,
+ 26, 101, 35, 27, 58, 102, 58, 56, 86, 60,
+ 58, 63, 64, 65, 66, 117, 87, 88, 92, 95,
+ 136, 98, 99, 118, 121, 122, 125, 91, 126, 157,
+ 147, 134, 133, 146, 154, 33, 155, 156, 124, 158,
+ 135, 48, 84, 0, 0, 72, 0, 0, 0, 0,
+ 0, 0, 0, 0, 81, 0, 78
};
static const short int yycheck[] =
{
- 11, 17, 18, 3, 15, 50, 17, 18, 19, 20,
- 8, 22, 8, 11, 25, 11, 11, 17, 29, 5,
- 11, 33, 8, 3, 10, 11, 21, 3, 28, 29,
- 21, 31, 33, 31, 34, 80, 47, 17, 54, 55,
- 36, 17, 37, 54, 55, 48, 49, 58, 28, 29,
- 4, 31, 28, 29, 34, 31, 34, 11, 34, 33,
- 29, 39, 8, 33, 18, 11, 20, 3, 14, 8,
- 24, 74, 11, 3, 77, 21, 9, 9, 47, 33,
- 3, 17, 15, 15, 33, 31, 8, 17, 99, 11,
- 11, 37, 28, 29, 17, 31, 9, 36, 37, 29,
- 21, 31, 15, 0, 37, 37, 8, 89, 31, 11,
- 5, 6, 14, 35, 33, 10, 37, 12, 13, 21,
- 36, 1, 33, 105, 19, 20, 33, 22, 23, 31,
- 11, 26, 27, 5, 6, 146, 16, 11, 10, 18,
- 12, 13, 114, 8, 25, 36, 11, 19, 20, 3,
- 22, 23, 36, 125, 26, 127, 128, 129, 130, 131,
- 132, 34, 33, 17, 34, 34, 39, 34, 68, 39,
- 39, 71, 39, 35, 36, 36, 38, 33, 35, 34,
- 11, 34, 34, 34, 34, 7, 35, 35, 35, 33,
- 35, 11, 35, 35, 35, 33, 35, 33, 38, 33,
- 35, 38, 34, 33, 33, 13, 34, 34, 34, 105,
- 120, 25, -1, 46, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 49, -1, -1, 53
+ 11, 17, 18, 3, 15, 90, 17, 18, 19, 20,
+ 3, 22, 51, 8, 25, 33, 11, 17, 29, 33,
+ 8, 106, 8, 11, 17, 11, 14, 8, 28, 29,
+ 11, 31, 3, 21, 34, 28, 29, 48, 31, 55,
+ 56, 34, 81, 31, 55, 56, 17, 3, 59, 37,
+ 36, 37, 4, 49, 50, 36, 33, 28, 29, 11,
+ 31, 17, 3, 34, 9, 9, 18, 29, 20, 3,
+ 15, 15, 24, 29, 11, 31, 17, 8, 33, 75,
+ 11, 33, 78, 17, 21, 11, 48, 28, 29, 100,
+ 31, 8, 37, 37, 11, 21, 8, 31, 1, 11,
+ 37, 11, 14, 33, 35, 34, 3, 11, 33, 21,
+ 39, 37, 11, 16, 31, 25, 5, 6, 33, 31,
+ 17, 10, 21, 12, 13, 33, 9, 36, 0, 36,
+ 19, 20, 15, 22, 23, 36, 147, 26, 27, 5,
+ 6, 18, 35, 36, 10, 38, 12, 13, 115, 69,
+ 34, 36, 72, 19, 20, 39, 22, 23, 33, 126,
+ 26, 128, 129, 130, 131, 132, 133, 5, 35, 34,
+ 8, 34, 10, 11, 39, 34, 39, 33, 35, 34,
+ 39, 34, 34, 34, 34, 11, 35, 35, 33, 35,
+ 7, 35, 35, 35, 33, 35, 33, 38, 33, 11,
+ 33, 35, 38, 34, 33, 13, 34, 34, 106, 34,
+ 121, 25, 59, -1, -1, 47, -1, -1, -1, -1,
+ -1, -1, -1, -1, 54, -1, 50
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -686,20 +687,20 @@ static const unsigned char yystos[] =
{
0, 5, 6, 10, 12, 13, 19, 20, 22, 23,
26, 27, 41, 42, 43, 33, 33, 33, 33, 33,
- 33, 33, 33, 1, 16, 36, 8, 11, 36, 55,
- 56, 60, 0, 43, 5, 10, 53, 60, 11, 53,
- 53, 60, 60, 18, 60, 36, 36, 55, 9, 15,
- 57, 58, 56, 36, 33, 33, 34, 39, 54, 34,
- 34, 34, 34, 34, 34, 34, 11, 21, 44, 45,
- 46, 44, 37, 31, 59, 60, 61, 59, 37, 58,
- 57, 53, 53, 60, 35, 35, 35, 35, 35, 36,
- 38, 33, 37, 45, 35, 37, 61, 35, 35, 37,
- 34, 34, 11, 14, 46, 47, 48, 49, 61, 4,
- 11, 18, 20, 24, 33, 52, 11, 35, 35, 60,
- 33, 35, 37, 48, 33, 33, 52, 3, 17, 28,
- 29, 31, 38, 35, 49, 7, 51, 52, 34, 52,
- 52, 52, 52, 52, 52, 34, 33, 11, 25, 50,
- 34, 34, 60, 33, 34, 34, 11, 34
+ 33, 33, 33, 1, 16, 36, 8, 11, 36, 56,
+ 57, 61, 0, 43, 5, 10, 53, 55, 61, 11,
+ 53, 53, 61, 61, 18, 61, 36, 36, 56, 9,
+ 15, 58, 59, 57, 36, 33, 33, 34, 39, 54,
+ 34, 34, 34, 34, 34, 34, 34, 11, 21, 44,
+ 45, 46, 44, 37, 31, 60, 61, 62, 60, 37,
+ 59, 58, 53, 53, 55, 35, 35, 35, 35, 35,
+ 36, 38, 33, 37, 45, 35, 37, 62, 35, 35,
+ 37, 34, 34, 11, 14, 46, 47, 48, 49, 62,
+ 4, 11, 18, 20, 24, 33, 52, 11, 35, 35,
+ 61, 33, 35, 37, 48, 33, 33, 52, 3, 17,
+ 28, 29, 31, 38, 35, 49, 7, 51, 52, 34,
+ 52, 52, 52, 52, 52, 52, 34, 33, 11, 25,
+ 50, 34, 34, 61, 33, 34, 34, 11, 34
};
#define yyerrok (yyerrstatus = 0)
@@ -1122,7 +1123,7 @@ yyparse (void)
#else
int
yyparse ()
- ;
+
#endif
#endif
{
@@ -1369,12 +1370,12 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 144 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 145 "/home/drepper/devel/elfutils/src/ldscript.y"
{ add_versions ((yyvsp[0].version)); }
break;
case 6:
-#line 152 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 153 "/home/drepper/devel/elfutils/src/ldscript.y"
{
if (likely (ld_state.entry == NULL))
ld_state.entry = (yyvsp[-2].str);
@@ -1382,14 +1383,14 @@ yyreduce:
break;
case 7:
-#line 157 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 158 "/home/drepper/devel/elfutils/src/ldscript.y"
{
ld_new_searchdir ((yyvsp[-2].str));
}
break;
case 8:
-#line 161 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 162 "/home/drepper/devel/elfutils/src/ldscript.y"
{
if (likely (ld_state.pagesize == 0))
ld_state.pagesize = (yyvsp[-2].num);
@@ -1397,22 +1398,23 @@ yyreduce:
break;
case 9:
-#line 166 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 167 "/home/drepper/devel/elfutils/src/ldscript.y"
{
- if (likely (ld_state.interp == NULL))
+ if (likely (ld_state.interp == NULL)
+ && ld_state.file_type != dso_file_type)
ld_state.interp = (yyvsp[-2].str);
}
break;
case 10:
-#line 171 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 173 "/home/drepper/devel/elfutils/src/ldscript.y"
{
new_segment ((yyvsp[-3].num), (yyvsp[-1].output_rule));
}
break;
case 11:
-#line 175 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 177 "/home/drepper/devel/elfutils/src/ldscript.y"
{
fputs_unlocked (gettext ("mode for segment invalid\n"),
stderr);
@@ -1421,7 +1423,7 @@ yyreduce:
break;
case 12:
-#line 181 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 183 "/home/drepper/devel/elfutils/src/ldscript.y"
{
/* First little optimization. If there is only one
file in the group don't do anything. */
@@ -1435,27 +1437,27 @@ yyreduce:
break;
case 13:
-#line 192 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 194 "/home/drepper/devel/elfutils/src/ldscript.y"
{ add_inputfiles ((yyvsp[-1].filename_list)); }
break;
case 14:
-#line 194 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 196 "/home/drepper/devel/elfutils/src/ldscript.y"
{ add_inputfiles (mark_as_needed ((yyvsp[-1].filename_list))); }
break;
case 15:
-#line 196 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 198 "/home/drepper/devel/elfutils/src/ldscript.y"
{ add_versions ((yyvsp[-1].version)); }
break;
case 16:
-#line 198 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 200 "/home/drepper/devel/elfutils/src/ldscript.y"
{ /* XXX TODO */ }
break;
case 17:
-#line 202 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 204 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[0].output_rule)->next = (yyvsp[-1].output_rule)->next;
(yyval.output_rule) = (yyvsp[-1].output_rule)->next = (yyvsp[0].output_rule);
@@ -1463,12 +1465,12 @@ yyreduce:
break;
case 18:
-#line 207 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 209 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.output_rule) = (yyvsp[0].output_rule); }
break;
case 19:
-#line 211 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 213 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.output_rule) = new_output_rule (output_assignment);
(yyval.output_rule)->val.assignment = (yyvsp[-1].assignment);
@@ -1476,7 +1478,7 @@ yyreduce:
break;
case 20:
-#line 216 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 218 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.output_rule) = new_output_rule (output_section);
(yyval.output_rule)->val.section.name = (yyvsp[-3].str);
@@ -1491,7 +1493,7 @@ yyreduce:
break;
case 21:
-#line 228 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 230 "/home/drepper/devel/elfutils/src/ldscript.y"
{
/* This is a short cut for "ID { *(ID) }". */
(yyval.output_rule) = new_output_rule (output_section);
@@ -1516,17 +1518,17 @@ yyreduce:
break;
case 22:
-#line 252 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 254 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.assignment) = new_assignment ((yyvsp[-2].str), (yyvsp[0].expr), false); }
break;
case 23:
-#line 254 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 256 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.assignment) = new_assignment ((yyvsp[-3].str), (yyvsp[-1].expr), true); }
break;
case 24:
-#line 258 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 260 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[0].input_rule)->next = (yyvsp[-1].input_rule)->next;
(yyval.input_rule) = (yyvsp[-1].input_rule)->next = (yyvsp[0].input_rule);
@@ -1534,12 +1536,12 @@ yyreduce:
break;
case 25:
-#line 263 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 265 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.input_rule) = (yyvsp[0].input_rule); }
break;
case 26:
-#line 267 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 269 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.input_rule) = new_input_rule (input_section);
(yyval.input_rule)->val.section = (yyvsp[0].filemask_section_name);
@@ -1547,7 +1549,7 @@ yyreduce:
break;
case 27:
-#line 272 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 274 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[-1].filemask_section_name)->keep_flag = true;
@@ -1557,7 +1559,7 @@ yyreduce:
break;
case 28:
-#line 279 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 281 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.input_rule) = new_input_rule (input_assignment);
(yyval.input_rule)->val.assignment = (yyvsp[-1].assignment);
@@ -1565,7 +1567,7 @@ yyreduce:
break;
case 29:
-#line 286 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 288 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.filemask_section_name) = (struct filemask_section_name *)
obstack_alloc (&ld_state.smem, sizeof (*(yyval.filemask_section_name)));
@@ -1577,27 +1579,27 @@ yyreduce:
break;
case 30:
-#line 297 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 299 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.sectionname) = new_input_section_name ((yyvsp[0].str), false); }
break;
case 31:
-#line 299 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 301 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.sectionname) = new_input_section_name ((yyvsp[-1].str), true); }
break;
case 32:
-#line 303 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 305 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.str) = (yyvsp[-1].str); }
break;
case 33:
-#line 305 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 307 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.str) = NULL; }
break;
case 34:
-#line 309 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 311 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_align);
(yyval.expr)->val.child = (yyvsp[-1].expr);
@@ -1605,12 +1607,12 @@ yyreduce:
break;
case 35:
-#line 314 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 316 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.expr) = (yyvsp[-1].expr); }
break;
case 36:
-#line 316 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 318 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_mult);
(yyval.expr)->val.binary.left = (yyvsp[-2].expr);
@@ -1619,7 +1621,7 @@ yyreduce:
break;
case 37:
-#line 322 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 324 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr ((yyvsp[-1].op));
(yyval.expr)->val.binary.left = (yyvsp[-2].expr);
@@ -1628,7 +1630,7 @@ yyreduce:
break;
case 38:
-#line 328 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 330 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr ((yyvsp[-1].op));
(yyval.expr)->val.binary.left = (yyvsp[-2].expr);
@@ -1637,7 +1639,7 @@ yyreduce:
break;
case 39:
-#line 334 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 336 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_and);
(yyval.expr)->val.binary.left = (yyvsp[-2].expr);
@@ -1646,7 +1648,7 @@ yyreduce:
break;
case 40:
-#line 340 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 342 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_or);
(yyval.expr)->val.binary.left = (yyvsp[-2].expr);
@@ -1655,7 +1657,7 @@ yyreduce:
break;
case 41:
-#line 346 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 348 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_num);
(yyval.expr)->val.num = (yyvsp[0].num);
@@ -1663,7 +1665,7 @@ yyreduce:
break;
case 42:
-#line 351 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 353 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyval.expr) = new_expr (exp_id);
(yyval.expr)->val.str = (yyvsp[0].str);
@@ -1671,17 +1673,30 @@ yyreduce:
break;
case 43:
-#line 356 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 358 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.expr) = new_expr (exp_sizeof_headers); }
break;
case 44:
-#line 358 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 360 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.expr) = new_expr (exp_pagesize); }
break;
case 45:
-#line 362 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 364 "/home/drepper/devel/elfutils/src/ldscript.y"
+ {
+ (yyvsp[0].filename_list)->next = (yyvsp[-2].filename_list)->next;
+ (yyval.filename_list) = (yyvsp[-2].filename_list)->next = (yyvsp[0].filename_list);
+ }
+ break;
+
+ case 46:
+#line 369 "/home/drepper/devel/elfutils/src/ldscript.y"
+ { (yyval.filename_list) = (yyvsp[0].filename_list); }
+ break;
+
+ case 49:
+#line 377 "/home/drepper/devel/elfutils/src/ldscript.y"
{
/* First little optimization. If there is only one
file in the group don't do anything. */
@@ -1694,40 +1709,31 @@ yyreduce:
}
break;
- case 46:
-#line 373 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 50:
+#line 388 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.filename_list) = mark_as_needed ((yyvsp[-1].filename_list)); }
break;
- case 47:
-#line 375 "/home/drepper/devel/elfutils/src/ldscript.y"
- {
- struct filename_list *newp = new_filename_listelem ((yyvsp[0].str));
- newp->next = (yyvsp[-2].filename_list)->next;
- (yyval.filename_list) = (yyvsp[-2].filename_list)->next = newp;
- }
- break;
-
- case 48:
-#line 381 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 51:
+#line 390 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.filename_list) = new_filename_listelem ((yyvsp[0].str)); }
break;
- case 51:
-#line 389 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 52:
+#line 395 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[0].version)->next = (yyvsp[-1].version)->next;
(yyval.version) = (yyvsp[-1].version)->next = (yyvsp[0].version);
}
break;
- case 52:
-#line 394 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 53:
+#line 400 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.version) = (yyvsp[0].version); }
break;
- case 53:
-#line 398 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 54:
+#line 404 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[-2].version)->versionname = "";
(yyvsp[-2].version)->parentname = NULL;
@@ -1735,8 +1741,8 @@ yyreduce:
}
break;
- case 54:
-#line 404 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 55:
+#line 410 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[-2].version)->versionname = (yyvsp[-4].str);
(yyvsp[-2].version)->parentname = NULL;
@@ -1744,8 +1750,8 @@ yyreduce:
}
break;
- case 55:
-#line 410 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 56:
+#line 416 "/home/drepper/devel/elfutils/src/ldscript.y"
{
(yyvsp[-3].version)->versionname = (yyvsp[-5].str);
(yyvsp[-3].version)->parentname = (yyvsp[-1].str);
@@ -1753,28 +1759,28 @@ yyreduce:
}
break;
- case 56:
-#line 419 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 57:
+#line 425 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.version) = merge_versions ((yyvsp[-1].version), (yyvsp[0].version)); }
break;
- case 57:
-#line 421 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 58:
+#line 427 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.version) = (yyvsp[0].version); }
break;
- case 58:
-#line 425 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 59:
+#line 431 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.version) = new_version (NULL, (yyvsp[0].id_list)); }
break;
- case 59:
-#line 427 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 60:
+#line 433 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.version) = new_version ((yyvsp[0].id_list), NULL); }
break;
- case 60:
-#line 432 "/home/drepper/devel/elfutils/src/ldscript.y"
+ case 61:
+#line 438 "/home/drepper/devel/elfutils/src/ldscript.y"
{
struct id_list *newp = new_id_listelem ((yyvsp[-1].str));
newp->next = (yyvsp[-2].id_list)->next;
@@ -1782,28 +1788,28 @@ yyreduce:
}
break;
- case 61:
-#line 438 "/home/drepper/devel/elfutils/src/ldscript.y"
- { (yyval.id_list) = new_id_listelem ((yyvsp[-1].str)); }
- break;
-
case 62:
-#line 442 "/home/drepper/devel/elfutils/src/ldscript.y"
- { (yyval.str) = (yyvsp[0].str); }
+#line 444 "/home/drepper/devel/elfutils/src/ldscript.y"
+ { (yyval.id_list) = new_id_listelem ((yyvsp[-1].str)); }
break;
case 63:
-#line 444 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 448 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.str) = (yyvsp[0].str); }
break;
case 64:
-#line 448 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 450 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.str) = (yyvsp[0].str); }
break;
case 65:
-#line 450 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 454 "/home/drepper/devel/elfutils/src/ldscript.y"
+ { (yyval.str) = (yyvsp[0].str); }
+ break;
+
+ case 66:
+#line 456 "/home/drepper/devel/elfutils/src/ldscript.y"
{ (yyval.str) = NULL; }
break;
@@ -1812,7 +1818,7 @@ yyreduce:
}
/* Line 1126 of yacc.c. */
-#line 1816 "ldscript.c"
+#line 1822 "ldscript.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -2080,7 +2086,7 @@ yyreturn:
}
-#line 453 "/home/drepper/devel/elfutils/src/ldscript.y"
+#line 459 "/home/drepper/devel/elfutils/src/ldscript.y"
static void
@@ -2210,11 +2216,12 @@ static struct filename_list *
mark_as_needed (struct filename_list *listp)
{
struct filename_list *runp = listp;
- while (runp != NULL)
+ do
{
runp->as_needed = true;
runp = runp->next;
}
+ while (runp != listp);
return listp;
}
diff --git a/elfutils/src/ldscript.y b/elfutils/src/ldscript.y
index 7311164c..252f9d4b 100644
--- a/elfutils/src/ldscript.y
+++ b/elfutils/src/ldscript.y
@@ -1,6 +1,6 @@
%{
/* Parser for linker scripts.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -128,6 +128,7 @@ extern int yylex (void);
%type <output_rule> outputsections
%type <assignment> assignment
%type <filename_list> filename_id_list
+%type <filename_list> filename_id_listelem
%type <version> versionlist
%type <version> version
%type <version> version_stmt_list
@@ -164,7 +165,8 @@ content: kENTRY '(' kID ')' ';'
}
| kINTERP '(' filename_id ')' ';'
{
- if (likely (ld_state.interp == NULL))
+ if (likely (ld_state.interp == NULL)
+ && ld_state.file_type != dso_file_type)
ld_state.interp = $3;
}
| kSEGMENT kMODE '{' outputsections '}'
@@ -358,7 +360,20 @@ expr: kALIGN '(' expr ')'
{ $$ = new_expr (exp_pagesize); }
;
-filename_id_list: kGROUP '(' filename_id_list ')'
+filename_id_list: filename_id_list comma_opt filename_id_listelem
+ {
+ $3->next = $1->next;
+ $$ = $1->next = $3;
+ }
+ | filename_id_listelem
+ { $$ = $1; }
+ ;
+
+comma_opt: ','
+ |
+ ;
+
+filename_id_listelem: kGROUP '(' filename_id_list ')'
{
/* First little optimization. If there is only one
file in the group don't do anything. */
@@ -371,19 +386,10 @@ filename_id_list: kGROUP '(' filename_id_list ')'
}
| kAS_NEEDED '(' filename_id_list ')'
{ $$ = mark_as_needed ($3); }
- | filename_id_list comma_opt filename_id
- {
- struct filename_list *newp = new_filename_listelem ($3);
- newp->next = $1->next;
- $$ = $1->next = newp;
- }
| filename_id
{ $$ = new_filename_listelem ($1); }
;
-comma_opt: ','
- |
- ;
versionlist: versionlist version
{
@@ -579,11 +585,12 @@ static struct filename_list *
mark_as_needed (struct filename_list *listp)
{
struct filename_list *runp = listp;
- while (runp != NULL)
+ do
{
runp->as_needed = true;
runp = runp->next;
}
+ while (runp != listp);
return listp;
}
diff --git a/elfutils/src/readelf.c b/elfutils/src/readelf.c
index e94a142d..ac313d00 100644
--- a/elfutils/src/readelf.c
+++ b/elfutils/src/readelf.c
@@ -556,7 +556,7 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
: ehdr->e_ident[EI_DATA] == ELFDATA2MSB
? "2's complement, big endian" : "\?\?\?");
- printf (gettext (" Version: %hhd %s\n"),
+ printf (gettext (" Ident Version: %hhd %s\n"),
ehdr->e_ident[EI_VERSION],
ehdr->e_ident[EI_VERSION] == EV_CURRENT ? gettext ("(current)")
: "(\?\?\?)");
@@ -1543,7 +1543,7 @@ handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
(long int) GELF_R_SYM (rel->r_info));
else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION)
printf ("\
- %#0*" PRIx64 " %-15s %#0*" PRIx64 " +%5" PRId64 " %s\n",
+ %#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n",
class == ELFCLASS32 ? 10 : 18, rel->r_offset,
ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
/* Avoid the leading R_ which isn't carrying any
@@ -1575,7 +1575,7 @@ handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
? xndx : sym->st_shndx));
else
printf ("\
- %#0*" PRIx64 " %-15s %#0*" PRIx64 " +%5" PRId64 " %s\n",
+ %#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n",
class == ELFCLASS32 ? 10 : 18, rel->r_offset,
ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
/* Avoid the leading R_ which isn't carrying any
@@ -2320,6 +2320,234 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
}
+static void
+print_hash_info (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx,
+ uint_fast32_t maxlength, Elf32_Word nbucket,
+ uint_fast32_t nsyms, uint32_t *lengths, const char *extrastr)
+{
+ uint32_t *counts = (uint32_t *) xcalloc (maxlength + 1, sizeof (uint32_t));
+
+ for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
+ ++counts[lengths[cnt]];
+
+ GElf_Shdr glink;
+ printf (ngettext ("\
+\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
+ "\
+\nHistogram for bucket list length in section [%2u] '%s' (total of %d buckets):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
+ nbucket),
+ (unsigned int) elf_ndxscn (scn),
+ elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
+ (int) nbucket,
+ gelf_getclass (ebl->elf) == ELFCLASS32 ? 10 : 18,
+ shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
+
+ if (extrastr != NULL)
+ fputs (extrastr, stdout);
+
+ if (nbucket > 0)
+ {
+ uint64_t success = 0;
+
+ fputs_unlocked (gettext ("\
+ Length Number % of total Coverage\n"), stdout);
+ printf (gettext (" 0 %6" PRIu32 " %5.1f%%\n"),
+ counts[0], (counts[0] * 100.0) / nbucket);
+
+ uint64_t nzero_counts = 0;
+ for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt)
+ {
+ nzero_counts += counts[cnt] * cnt;
+ printf (gettext ("\
+%7d %6" PRIu32 " %5.1f%% %5.1f%%\n"),
+ (int) cnt, counts[cnt], (counts[cnt] * 100.0) / nbucket,
+ (nzero_counts * 100.0) / nsyms);
+ }
+
+ Elf32_Word acc = 0;
+ for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt)
+ {
+ acc += cnt;
+ success += counts[cnt] * acc;
+ }
+
+ printf (gettext ("\
+ Average number of tests: successful lookup: %f\n\
+ unsuccessful lookup: %f\n"),
+ (double) success / (double) nzero_counts,
+ (double) nzero_counts / (double) nbucket);
+ }
+
+ free (counts);
+}
+
+
+/* This function handles the traditional System V-style hash table format. */
+static void
+handle_sysv_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx)
+{
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ {
+ error (0, 0, gettext ("cannot get data for section %d: %s"),
+ (int) elf_ndxscn (scn), elf_errmsg (-1));
+ return;
+ }
+
+ Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
+ Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1];
+ Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[2];
+ Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[2 + nbucket];
+
+ uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
+
+ uint_fast32_t maxlength = 0;
+ uint_fast32_t nsyms = 0;
+ for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
+ {
+ Elf32_Word inner = bucket[cnt];
+ while (inner > 0 && inner < nchain)
+ {
+ ++nsyms;
+ if (maxlength < ++lengths[cnt])
+ ++maxlength;
+
+ inner = chain[inner];
+ }
+ }
+
+ print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms,
+ lengths, NULL);
+
+ free (lengths);
+}
+
+
+/* This function handles the incorrect, System V-style hash table
+ format some 64-bit architectures use. */
+static void
+handle_sysv_hash64 (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx)
+{
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ {
+ error (0, 0, gettext ("cannot get data for section %d: %s"),
+ (int) elf_ndxscn (scn), elf_errmsg (-1));
+ return;
+ }
+
+ Elf64_Xword nbucket = ((Elf64_Xword *) data->d_buf)[0];
+ Elf64_Xword nchain = ((Elf64_Xword *) data->d_buf)[1];
+ Elf64_Xword *bucket = &((Elf64_Xword *) data->d_buf)[2];
+ Elf64_Xword *chain = &((Elf64_Xword *) data->d_buf)[2 + nbucket];
+
+ uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
+
+ uint_fast32_t maxlength = 0;
+ uint_fast32_t nsyms = 0;
+ for (Elf64_Xword cnt = 0; cnt < nbucket; ++cnt)
+ {
+ Elf64_Xword inner = bucket[cnt];
+ while (inner > 0 && inner < nchain)
+ {
+ ++nsyms;
+ if (maxlength < ++lengths[cnt])
+ ++maxlength;
+
+ inner = chain[inner];
+ }
+ }
+
+ print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms,
+ lengths, NULL);
+
+ free (lengths);
+}
+
+
+/* This function handles the GNU-style hash table format. */
+static void
+handle_gnu_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx)
+{
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ {
+ error (0, 0, gettext ("cannot get data for section %d: %s"),
+ (int) elf_ndxscn (scn), elf_errmsg (-1));
+ return;
+ }
+
+ Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
+ Elf32_Word symbias = ((Elf32_Word *) data->d_buf)[1];
+
+ /* Next comes the size of the bitmap. It's measured in words for
+ the architecture. It's 32 bits for 32 bit archs, and 64 bits for
+ 64 bit archs. */
+ Elf32_Word bitmask_words = ((Elf32_Word *) data->d_buf)[2];
+ if (gelf_getclass (ebl->elf) == ELFCLASS64)
+ bitmask_words *= 2;
+
+ Elf32_Word shift = ((Elf32_Word *) data->d_buf)[3];
+
+ uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
+
+ Elf32_Word *bitmask = &((Elf32_Word *) data->d_buf)[4];
+ Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[4 + bitmask_words];
+ Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[4 + bitmask_words
+ + nbucket];
+
+ /* Compute distribution of chain lengths. */
+ uint_fast32_t maxlength = 0;
+ uint_fast32_t nsyms = 0;
+ for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
+ if (bucket[cnt] != 0)
+ {
+ Elf32_Word inner = bucket[cnt] - symbias;
+ do
+ {
+ ++nsyms;
+ if (maxlength < ++lengths[cnt])
+ ++maxlength;
+ }
+ while ((chain[inner++] & 1) == 0);
+ }
+
+ /* Count bits in bitmask. */
+ uint_fast32_t nbits = 0;
+ for (Elf32_Word cnt = 0; cnt < bitmask_words; ++cnt)
+ {
+ uint_fast32_t word = bitmask[cnt];
+
+ word = (word & 0x55555555) + ((word >> 1) & 0x55555555);
+ word = (word & 0x33333333) + ((word >> 2) & 0x33333333);
+ word = (word & 0x0f0f0f0f) + ((word >> 4) & 0x0f0f0f0f);
+ word = (word & 0x00ff00ff) + ((word >> 8) & 0x00ff00ff);
+ nbits += (word & 0x0000ffff) + ((word >> 16) & 0x0000ffff);
+ }
+
+ char *str;
+ if (asprintf (&str, gettext ("\
+ Symbol Bias: %u\n\
+ Bitmask Size: %zu bytes %" PRIuFAST32 "%% bits set 2nd hash shift: %u\n"),
+ (unsigned int) symbias, bitmask_words * sizeof (Elf32_Word),
+ ((nbits * 100 + 50)
+ / (uint_fast32_t) (bitmask_words * sizeof (Elf32_Word) * 8)),
+ (unsigned int) shift) == -1)
+ error (EXIT_FAILURE, 0, gettext ("memory exhausted"));
+
+ print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms,
+ lengths, str);
+
+ free (str);
+ free (lengths);
+}
+
+
/* Find the symbol table(s). For this we have to search through the
section table. */
static void
@@ -2338,100 +2566,17 @@ handle_hash (Ebl *ebl)
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
- if (shdr != NULL && shdr->sh_type == SHT_HASH)
+ if (shdr != NULL)
{
- Elf_Data *data = elf_getdata (scn, NULL);
- if (data == NULL)
+ if (shdr->sh_type == SHT_HASH)
{
- error (0, 0, gettext ("cannot get data for section %d: %s"),
- (int) elf_ndxscn (scn), elf_errmsg (-1));
- continue;
- }
-
- Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
- Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1];
- Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[2];
- Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[2 + nbucket];
-
- GElf_Shdr glink;
- printf (ngettext ("\
-\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
- "\
-\nHistogram for bucket list length in section [%2u] '%s' (total of %d buckets):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
- nbucket),
- (unsigned int) elf_ndxscn (scn),
- elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
- (int) nbucket,
- gelf_getclass (ebl->elf) == ELFCLASS32 ? 10 : 18,
- shdr->sh_addr,
- shdr->sh_offset,
- (unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx,
- gelf_getshdr (elf_getscn (ebl->elf,
- shdr->sh_link),
- &glink)->sh_name));
-
- uint32_t *lengths = (uint32_t *) xcalloc (nbucket,
- sizeof (uint32_t));
-
- Elf32_Word maxlength = 0;
- Elf32_Word nsyms = 0;
- for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
- if (bucket[cnt] != 0)
- {
- Elf32_Word inner = bucket[cnt];
- while (inner > 0 && inner < nchain)
- {
- ++nsyms;
- if (maxlength < ++lengths[cnt])
- ++maxlength;
-
- inner = chain[inner];
- }
- }
-
- uint32_t *counts = (uint32_t *) xcalloc (maxlength + 1,
- sizeof (uint32_t));
-
- for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
- ++counts[lengths[cnt]];
-
- if (nbucket > 0)
- {
- uint64_t success = 0;
-
- fputs_unlocked (gettext ("\
- Length Number % of total Coverage\n"), stdout);
- printf (gettext (" 0 %6" PRIu32 " %5.1f%%\n"),
- counts[0], (counts[0] * 100.0) / nbucket);
-
- uint64_t nzero_counts = 0;
- for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt)
- {
- nzero_counts += counts[cnt] * cnt;
- printf (gettext ("\
-%7d %6" PRIu32 " %5.1f%% %5.1f%%\n"),
- (int) cnt,
- counts[cnt], (counts[cnt] * 100.0) / nbucket,
- (nzero_counts * 100.0) / nsyms);
- }
-
- Elf32_Word acc = 0;
- for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt)
- {
- acc += cnt;
- success += counts[cnt] * acc;
- }
-
- printf (gettext ("\
- Average number of tests: successful lookup: %f\n\
- unsuccessful lookup: %f\n"),
- (double) success / (double) nzero_counts,
- (double) nzero_counts / (double) nbucket);
+ if (ebl_sysvhash_entrysize (ebl) == sizeof (Elf64_Xword))
+ handle_sysv_hash64 (ebl, scn, shdr, shstrndx);
+ else
+ handle_sysv_hash (ebl, scn, shdr, shstrndx);
}
-
- free (counts);
- free (lengths);
+ else if (shdr->sh_type == SHT_GNU_HASH)
+ handle_gnu_hash (ebl, scn, shdr, shstrndx);
}
}
}
diff --git a/elfutils/tests/ChangeLog b/elfutils/tests/ChangeLog
index cbb4ac7e..fc795084 100644
--- a/elfutils/tests/ChangeLog
+++ b/elfutils/tests/ChangeLog
@@ -1,3 +1,15 @@
+2006-08-03 Roland McGrath <roland@redhat.com>
+
+ * run-allregs.sh: Add sparc cases.
+ * testfile30.bz2: New data file.
+ * testfile31.bz2: New data file.
+ * Makefile.am (EXTRA_DIST): Add them.
+
+2006-07-21 Roland McGrath <roland@redhat.com>
+
+ * allregs.c (struct reginfo): Increase size of name.
+ (one_register): Assert that it's big enough.
+
2006-04-04 Roland McGrath <roland@redhat.com>
* run-bug1-test.sh: Test a second case, to cover both byte orders.
diff --git a/elfutils/tests/Makefile.am b/elfutils/tests/Makefile.am
index 0ceef1b9..ab17761a 100644
--- a/elfutils/tests/Makefile.am
+++ b/elfutils/tests/Makefile.am
@@ -113,7 +113,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile26.bz2 testfile27.bz2 \
coverage.sh test-subr.sh test-wrapper.sh run-readelf-test1.sh \
run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \
- testfile29.bz2 testfile29.rdwr.bz2
+ testfile29.bz2 testfile29.rdwr.bz2 \
+ testfile30.bz2 testfile31.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
diff --git a/elfutils/tests/Makefile.in b/elfutils/tests/Makefile.in
index 087c2f09..f0910c40 100644
--- a/elfutils/tests/Makefile.in
+++ b/elfutils/tests/Makefile.in
@@ -304,6 +304,8 @@ MUDFLAP_FALSE = @MUDFLAP_FALSE@
MUDFLAP_TRUE = @MUDFLAP_TRUE@
NATIVE_LD_FALSE = @NATIVE_LD_FALSE@
NATIVE_LD_TRUE = @NATIVE_LD_TRUE@
+NEVER_FALSE = @NEVER_FALSE@
+NEVER_TRUE = @NEVER_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -420,7 +422,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile26.bz2 testfile27.bz2 \
coverage.sh test-subr.sh test-wrapper.sh run-readelf-test1.sh \
run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \
- testfile29.bz2 testfile29.rdwr.bz2
+ testfile29.bz2 testfile29.rdwr.bz2 \
+ testfile30.bz2 testfile31.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
diff --git a/elfutils/tests/allregs.c b/elfutils/tests/allregs.c
index bad4c85e..baec94ed 100644
--- a/elfutils/tests/allregs.c
+++ b/elfutils/tests/allregs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Red Hat, Inc.
+/* Copyright (C) 2005, 2006 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -62,7 +62,7 @@ struct reginfo
{
const char *set, *pfx;
int regno;
- char name[8];
+ char name[32];
};
static int
@@ -103,6 +103,7 @@ one_register (void *arg,
state->info[regno].regno = regno;
state->info[regno].set = setname;
state->info[regno].pfx = prefix;
+ assert (strlen (regname) < sizeof state->info[regno].name);
strcpy (state->info[regno].name, regname);
return DWARF_CB_OK;
diff --git a/elfutils/tests/run-allregs.sh b/elfutils/tests/run-allregs.sh
index 480a8029..bdd1ca23 100755
--- a/elfutils/tests/run-allregs.sh
+++ b/elfutils/tests/run-allregs.sh
@@ -1238,4 +1238,174 @@ control registers:
65: %pswa (pswa)
EOF
+regs_test testfile30 <<\EOF
+integer registers:
+ 0: %g0 (g0)
+ 1: %g1 (g1)
+ 2: %g2 (g2)
+ 3: %g3 (g3)
+ 4: %g4 (g4)
+ 5: %g5 (g5)
+ 6: %g6 (g6)
+ 7: %g7 (g7)
+ 8: %o0 (o0)
+ 9: %o1 (o1)
+ 10: %o2 (o2)
+ 11: %o3 (o3)
+ 12: %o4 (o4)
+ 13: %o5 (o5)
+ 14: %o6 (o6)
+ 15: %o7 (o7)
+ 16: %l0 (l0)
+ 17: %l1 (l1)
+ 18: %l2 (l2)
+ 19: %l3 (l3)
+ 20: %l4 (l4)
+ 21: %l5 (l5)
+ 22: %l6 (l6)
+ 23: %l7 (l7)
+ 24: %i0 (i0)
+ 25: %i1 (i1)
+ 26: %i2 (i2)
+ 27: %i3 (i3)
+ 28: %i4 (i4)
+ 29: %i5 (i5)
+ 30: %i6 (i6)
+ 31: %i7 (i7)
+FPU registers:
+ 32: %f0 (f0)
+ 33: %f1 (f1)
+ 34: %f2 (f2)
+ 35: %f3 (f3)
+ 36: %f4 (f4)
+ 37: %f5 (f5)
+ 38: %f6 (f6)
+ 39: %f7 (f7)
+ 40: %f8 (f8)
+ 41: %f9 (f9)
+ 42: %f10 (f10)
+ 43: %f11 (f11)
+ 44: %f12 (f12)
+ 45: %f13 (f13)
+ 46: %f14 (f14)
+ 47: %f15 (f15)
+ 48: %f16 (f16)
+ 49: %f17 (f17)
+ 50: %f18 (f18)
+ 51: %f19 (f19)
+ 52: %f20 (f20)
+ 53: %f21 (f21)
+ 54: %f22 (f22)
+ 55: %f23 (f23)
+ 56: %f24 (f24)
+ 57: %f25 (f25)
+ 58: %f26 (f26)
+ 59: %f27 (f27)
+ 60: %f28 (f28)
+ 61: %f29 (f29)
+ 62: %f30 (f30)
+ 63: %f31 (f31)
+EOF
+
+regs_test testfile31 <<\EOF
+integer registers:
+ 0: %g0 (g0)
+ 1: %g1 (g1)
+ 2: %g2 (g2)
+ 3: %g3 (g3)
+ 4: %g4 (g4)
+ 5: %g5 (g5)
+ 6: %g6 (g6)
+ 7: %g7 (g7)
+ 8: %o0 (o0)
+ 9: %o1 (o1)
+ 10: %o2 (o2)
+ 11: %o3 (o3)
+ 12: %o4 (o4)
+ 13: %o5 (o5)
+ 14: %o6 (o6)
+ 15: %o7 (o7)
+ 16: %l0 (l0)
+ 17: %l1 (l1)
+ 18: %l2 (l2)
+ 19: %l3 (l3)
+ 20: %l4 (l4)
+ 21: %l5 (l5)
+ 22: %l6 (l6)
+ 23: %l7 (l7)
+ 24: %i0 (i0)
+ 25: %i1 (i1)
+ 26: %i2 (i2)
+ 27: %i3 (i3)
+ 28: %i4 (i4)
+ 29: %i5 (i5)
+ 30: %i6 (i6)
+ 31: %i7 (i7)
+FPU registers:
+ 32: %f0 (f0)
+ 33: %f1 (f1)
+ 34: %f2 (f2)
+ 35: %f3 (f3)
+ 36: %f4 (f4)
+ 37: %f5 (f5)
+ 38: %f6 (f6)
+ 39: %f7 (f7)
+ 40: %f8 (f8)
+ 41: %f9 (f9)
+ 42: %f10 (f10)
+ 43: %f11 (f11)
+ 44: %f12 (f12)
+ 45: %f13 (f13)
+ 46: %f14 (f14)
+ 47: %f15 (f15)
+ 48: %f16 (f16)
+ 49: %f17 (f17)
+ 50: %f18 (f18)
+ 51: %f19 (f19)
+ 52: %f20 (f20)
+ 53: %f21 (f21)
+ 54: %f22 (f22)
+ 55: %f23 (f23)
+ 56: %f24 (f24)
+ 57: %f25 (f25)
+ 58: %f26 (f26)
+ 59: %f27 (f27)
+ 60: %f28 (f28)
+ 61: %f29 (f29)
+ 62: %f30 (f30)
+ 63: %f31 (f31)
+ 64: %f32 (f32)
+ 65: %f33 (f33)
+ 66: %f34 (f34)
+ 67: %f35 (f35)
+ 68: %f36 (f36)
+ 69: %f37 (f37)
+ 70: %f38 (f38)
+ 71: %f39 (f39)
+ 72: %f40 (f40)
+ 73: %f41 (f41)
+ 74: %f42 (f42)
+ 75: %f43 (f43)
+ 76: %f44 (f44)
+ 77: %f45 (f45)
+ 78: %f46 (f46)
+ 79: %f47 (f47)
+ 80: %f48 (f48)
+ 81: %f49 (f49)
+ 82: %f50 (f50)
+ 83: %f51 (f51)
+ 84: %f52 (f52)
+ 85: %f53 (f53)
+ 86: %f54 (f54)
+ 87: %f55 (f55)
+ 88: %f56 (f56)
+ 89: %f57 (f57)
+ 90: %f58 (f58)
+ 91: %f59 (f59)
+ 92: %f60 (f60)
+ 93: %f61 (f61)
+ 94: %f62 (f62)
+ 95: %f63 (f63)
+EOF
+
exit 0
diff --git a/elfutils/tests/testfile30.bz2 b/elfutils/tests/testfile30.bz2
new file mode 100644
index 00000000..9ee93c00
--- /dev/null
+++ b/elfutils/tests/testfile30.bz2
Binary files differ
diff --git a/elfutils/tests/testfile31.bz2 b/elfutils/tests/testfile31.bz2
new file mode 100644
index 00000000..73451d22
--- /dev/null
+++ b/elfutils/tests/testfile31.bz2
Binary files differ