This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: I believe the current binutils is broken
On Mon, Nov 25, 2002 at 10:24:25AM +1030, Alan Modra wrote:
> On Sun, Nov 24, 2002 at 12:57:42PM +0100, Jakub Jelinek wrote:
> > On Sat, Nov 23, 2002 at 03:41:30PM -0800, H. J. Lu wrote:
> > > Hi Alan,
> > >
> > > I have many extra gcc 3.3 (cvs) libjava test failures on Linux/x86
> > > with the current binutils. It looks like java exception doesn't work
> > > anymore. After reverting back to 20021012, everyting is fine. I don't
> > > know exactly which changes are the causes. But your eh frame change
> > > looks very suspicious. Could you please take a look?
>
> OK, I get the libjava failures too. I'll see what needs to be done to
> fix them.
Well, turning off the duplicate CIE optimization for ld -r seems to have
cured the java testsuite gij failures. I confess to not understanding
exactly why removing duplicate CIEs caused the failures, but until I
find time to properly figure out what is going on, this will have to do.
Along the way, I found a number of other places that needed attention.
* 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.
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.18
diff -u -p -r1.18 elf-eh-frame.c
--- bfd/elf-eh-frame.c 12 Nov 2002 07:35:26 -0000 1.18
+++ bfd/elf-eh-frame.c 26 Nov 2002 08:08:30 -0000
@@ -295,7 +295,8 @@ _bfd_elf_discard_section_eh_frame (abfd,
#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,
/* 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,
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,
&& 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. */
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.169
diff -u -p -r1.169 elf.c
--- bfd/elf.c 20 Nov 2002 18:17:04 -0000 1.169
+++ bfd/elf.c 26 Nov 2002 08:08:34 -0000
@@ -1391,17 +1391,18 @@ _bfd_elf_link_hash_newfunc (entry, table
/* 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, ab
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;
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.197
diff -u -p -r1.197 elflink.h
--- bfd/elflink.h 21 Nov 2002 18:52:36 -0000 1.197
+++ bfd/elflink.h 26 Nov 2002 08:08:39 -0000
@@ -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
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.25
diff -u -p -r1.25 libbfd.c
--- bfd/libbfd.c 18 Nov 2002 16:37:53 -0000 1.25
+++ bfd/libbfd.c 26 Nov 2002 08:08:39 -0000
@@ -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"),
Index: bfd/po/SRC-POTFILES.in
===================================================================
RCS file: /cvs/src/src/bfd/po/SRC-POTFILES.in,v
retrieving revision 1.22
diff -u -p -r1.22 SRC-POTFILES.in
--- bfd/po/SRC-POTFILES.in 12 Nov 2002 07:35:26 -0000 1.22
+++ bfd/po/SRC-POTFILES.in 26 Nov 2002 08:08:39 -0000
@@ -17,6 +17,8 @@ archive64.c
archures.c
armnetbsd.c
bfd.c
+bfdio.c
+bfdwin.c
binary.c
bout.c
cache.c
--
Alan Modra
IBM OzLabs - Linux Technology Centre