This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: PR 233: Check non-debug local references to discarded sections
On Tue, Jun 29, 2004 at 09:39:09PM -0700, H. J. Lu wrote:
> On Wed, Jun 30, 2004 at 01:25:07PM +0930, Alan Modra wrote:
> >
> > Huh? Why wasn't sec->sec_info_type == ELF_INFO_TYPE_EH_FRAME?
>
> Because some ld tests have some bogus .eh_frame sections which won't
> have it set.
Hmm, I see. We want to ignore relocs against discarded section in
.eh_frame regardless of whether .eh_frame itself is going to be edited
by the linker. I guess the same goes for .stabs, where flags like
info->traditional_format will result in ELF_INFO_TYPE_STABS never
being set for stabs. In other words, sec_info_type really isn't the
right thing to test in elf_section_ignore_discarded_relocs.
The rest of the patch is OK. I'll commit the following.
* elflink.c (elf_section_ignore_discarded_relocs): Don't test
sec_info_type, test section name instead.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.75
diff -u -p -r1.75 elflink.c
--- bfd/elflink.c 28 Jun 2004 13:57:59 -0000 1.75
+++ bfd/elflink.c 30 Jun 2004 12:50:11 -0000
@@ -6263,14 +6263,13 @@ elf_section_ignore_discarded_relocs (ase
{
const struct elf_backend_data *bed;
- switch (sec->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- case ELF_INFO_TYPE_EH_FRAME:
- return TRUE;
- default:
- break;
- }
+ if (strncmp (".stab", sec->name, 5) == 0
+ && (!sec->name[5] ||
+ (sec->name[5] == '.' && ISDIGIT (sec->name[6]))))
+ return TRUE;
+
+ if (strcmp (".eh_frame", sec->name) == 0)
+ return TRUE;
bed = get_elf_backend_data (sec->owner);
if (bed->elf_backend_ignore_discarded_relocs != NULL
--
Alan Modra
IBM OzLabs - Linux Technology Centre