aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog15
-rw-r--r--bfd/elf-eh-frame.c18
-rw-r--r--bfd/elf.c18
-rw-r--r--bfd/elflink.h19
-rw-r--r--bfd/libbfd.c2
-rw-r--r--bfd/po/SRC-POTFILES.in2
6 files changed, 54 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d3c7ac8..1823e3a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,18 @@
+2002-11-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (ENSURE_NO_RELOCS): Disregard R_*_NONE relocs.
+ (_bfd_elf_discard_section_eh_frame): Don't discard duplicate CIEs
+ on a relocatable link. Comment typos.
+ * elf.c (_bfd_elf_link_hash_newfunc): Assign elements of structure
+ in the order they are declared. Clear elf_hash_value too.
+ (_bfd_elf_link_hash_table_init): Likewise assign in order. Clear
+ eh_info and tls_segment.
+ * elflink.h (elf_link_input_bfd <emit_relocs>): Keep reloc offsets
+ sorted when discarding relocs by turning them into R_*_NONE.
+
+ * libbfd.c (warn_deprecated): Comment spelling.
+ * po/SRC-POTFILES.in: Regenerate.
+
2002-11-21 Richard Henderson <rth@redhat.com>
* elflink.h (elf_link_add_object_symbols): Don't overwrite the
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index fa152ab..8938ecf 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -295,7 +295,8 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
#define ENSURE_NO_RELOCS(buf) \
if (cookie->rel < cookie->relend \
&& (cookie->rel->r_offset \
- < (bfd_size_type) ((buf) - ehbuf))) \
+ < (bfd_size_type) ((buf) - ehbuf)) \
+ && cookie->rel->r_info != 0) \
goto free_no_table
#define SKIP_RELOCS(buf) \
@@ -378,11 +379,12 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
/* CIE */
if (last_cie != NULL)
{
- /* Now check if this CIE is identical to last CIE, in which case
- we can remove it, provided we adjust all FDEs.
- Also, it can be removed if we have removed all FDEs using
- that. */
- if (cie_compare (&cie, &hdr_info->last_cie) == 0
+ /* Now check if this CIE is identical to the last CIE,
+ in which case we can remove it provided we adjust
+ all FDEs. Also, it can be removed if we have removed
+ all FDEs using it. */
+ if ((!info->relocateable
+ && cie_compare (&cie, &hdr_info->last_cie) == 0)
|| cie_usage_count == 0)
{
new_size -= cie.hdr.length + 4;
@@ -560,7 +562,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
goto free_no_table;
if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
{
- /* This is a FDE against discarded section, it should
+ /* This is a FDE against a discarded section. It should
be deleted. */
new_size -= hdr.length + 4;
sec_info->entry[sec_info->count].removed = 1;
@@ -572,7 +574,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
&& cie.make_relative == 0)
|| (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned))
{
- /* If shared library uses absolute pointers
+ /* If a shared library uses absolute pointers
which we cannot turn into PC relative,
don't create the binary search table,
since it is affected by runtime relocations. */
diff --git a/bfd/elf.c b/bfd/elf.c
index 4ddc99d..46c2c9e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1391,17 +1391,18 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
/* Set local fields. */
ret->indx = -1;
- ret->size = 0;
ret->dynindx = -1;
ret->dynstr_index = 0;
+ ret->elf_hash_value = 0;
ret->weakdef = NULL;
- ret->got.refcount = htab->init_refcount;
- ret->plt.refcount = htab->init_refcount;
ret->linker_section_pointer = NULL;
ret->verinfo.verdef = NULL;
- ret->vtable_entries_used = NULL;
ret->vtable_entries_size = 0;
+ ret->vtable_entries_used = NULL;
ret->vtable_parent = NULL;
+ ret->got.refcount = htab->init_refcount;
+ ret->plt.refcount = htab->init_refcount;
+ ret->size = 0;
ret->type = STT_NOTYPE;
ret->other = 0;
/* Assume that we have been called by a non-ELF symbol reader.
@@ -1512,13 +1513,16 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc)
table->dynstr = NULL;
table->bucketcount = 0;
table->needed = NULL;
- table->runpath = NULL;
- table->loaded = NULL;
table->hgot = NULL;
table->stab_info = NULL;
table->merge_info = NULL;
+ memset (&table->eh_info, 0, sizeof (table->eh_info));
table->dynlocal = NULL;
- ret = _bfd_link_hash_table_init (& table->root, abfd, newfunc);
+ table->runpath = NULL;
+ table->tls_segment = NULL;
+ table->loaded = NULL;
+
+ ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc);
table->root.type = bfd_link_elf_hash_table;
return ret;
diff --git a/bfd/elflink.h b/bfd/elflink.h
index f784002..c945194 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -6946,6 +6946,7 @@ elf_link_input_bfd (finfo, input_bfd)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
+ bfd_vma last_offset;
struct elf_link_hash_entry **rel_hash;
Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
unsigned int next_erel;
@@ -6966,6 +6967,9 @@ elf_link_input_bfd (finfo, input_bfd)
rel_hash = (elf_section_data (o->output_section)->rel_hashes
+ elf_section_data (o->output_section)->rel_count
+ elf_section_data (o->output_section)->rel_count2);
+ last_offset = o->output_offset;
+ if (!finfo->info->relocateable)
+ last_offset += o->output_section->vma;
for (next_erel = 0; irela < irelaend; irela++, next_erel++)
{
unsigned long r_symndx;
@@ -6983,8 +6987,14 @@ elf_link_input_bfd (finfo, input_bfd)
irela->r_offset);
if (irela->r_offset >= (bfd_vma) -2)
{
- /* This is a reloc for a deleted entry or somesuch. */
- memset (irela, 0, sizeof (*irela));
+ /* This is a reloc for a deleted entry or somesuch.
+ Turn it into an R_*_NONE reloc, at the same
+ offset as the last reloc. elf_eh_frame.c and
+ elf_bfd_discard_info rely on reloc offsets
+ being ordered. */
+ irela->r_offset = last_offset;
+ irela->r_info = 0;
+ irela->r_addend = 0;
continue;
}
@@ -6994,9 +7004,10 @@ elf_link_input_bfd (finfo, input_bfd)
if (!finfo->info->relocateable)
irela->r_offset += o->output_section->vma;
- r_symndx = ELF_R_SYM (irela->r_info);
+ last_offset = irela->r_offset;
- if (r_symndx == 0)
+ r_symndx = ELF_R_SYM (irela->r_info);
+ if (r_symndx == STN_UNDEF)
continue;
if (r_symndx >= locsymcount
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 8783def..a264f28 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -912,7 +912,7 @@ warn_deprecated (what, file, line, func)
if (~(size_t) func & ~mask)
{
- /* Note: seperate sentances in order to allow
+ /* Note: separate sentences in order to allow
for translation into other languages. */
if (func)
fprintf (stderr, _("Deprecated %s called at %s line %d in %s\n"),
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index e11e314..54a0c25 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -17,6 +17,8 @@ archive64.c
archures.c
armnetbsd.c
bfd.c
+bfdio.c
+bfdwin.c
binary.c
bout.c
cache.c