This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[commit] Fix a testsuite FAIL for bfin ld
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 23 Sep 2009 16:21:12 +0800
- Subject: [commit] Fix a testsuite FAIL for bfin ld
This patch fixes
FAIL: Weak symbols in dynamic objects 1 (main test)
for bfin-linux-uclibc-ld.
It removes empty .rel.plt, .plt and .dynbss sections. The code to remove
those empty sections is there but only when dynamic_sections_created.
Those sections might also be created in _bfin_create_got_section without
setting dynamic_sections_created. So I just move the code out of guard
of dynamic_sections_created. I also found there are two pieces of code
to remove empty .rel.plt section. I just remove one of them with this patch.
Committed on HEAD and binutils-2_20-branch.
Jie
* elf32-bfin.c (_bfinfdpic_size_got_plt): Make sure empty
.rel.plt and .plt sections are removed.
(elf32_bfinfdpic_size_dynamic_sections): Remove empty .dynbss
section. Remove the duplicated removing of empty .rel.plt
section.
Index: elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.43
diff -u -p -r1.43 elf32-bfin.c
--- elf32-bfin.c 11 Sep 2009 03:20:34 -0000 1.43
+++ elf32-bfin.c 11 Sep 2009 15:08:44 -0000
@@ -4166,19 +4166,17 @@ _bfinfdpic_size_got_plt (bfd *output_bfd
}
if (elf_hash_table (info)->dynamic_sections_created)
+ bfinfdpic_pltrel_section (info)->size =
+ gpinfop->g.lzplt / LZPLT_NORMAL_SIZE * get_elf_backend_data (output_bfd)->s->sizeof_rel;
+ if (bfinfdpic_pltrel_section (info)->size == 0)
+ bfinfdpic_pltrel_section (info)->flags |= SEC_EXCLUDE;
+ else
{
- bfinfdpic_pltrel_section (info)->size =
- gpinfop->g.lzplt / LZPLT_NORMAL_SIZE * get_elf_backend_data (output_bfd)->s->sizeof_rel;
- if (bfinfdpic_pltrel_section (info)->size == 0)
- bfinfdpic_pltrel_section (info)->flags |= SEC_EXCLUDE;
- else
- {
- bfinfdpic_pltrel_section (info)->contents =
- (bfd_byte *) bfd_zalloc (dynobj,
- bfinfdpic_pltrel_section (info)->size);
- if (bfinfdpic_pltrel_section (info)->contents == NULL)
- return FALSE;
- }
+ bfinfdpic_pltrel_section (info)->contents =
+ (bfd_byte *) bfd_zalloc (dynobj,
+ bfinfdpic_pltrel_section (info)->size);
+ if (bfinfdpic_pltrel_section (info)->contents == NULL)
+ return FALSE;
}
/* Add 4 bytes for every block of at most 65535 lazy PLT entries,
@@ -4215,18 +4213,15 @@ _bfinfdpic_size_got_plt (bfd *output_bfd
/* Allocate the PLT section contents only after
_bfinfdpic_assign_plt_entries has a chance to add the size of the
non-lazy PLT entries. */
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (bfinfdpic_plt_section (info)->size == 0)
+ bfinfdpic_plt_section (info)->flags |= SEC_EXCLUDE;
+ else
{
- if (bfinfdpic_plt_section (info)->size == 0)
- bfinfdpic_plt_section (info)->flags |= SEC_EXCLUDE;
- else
- {
- bfinfdpic_plt_section (info)->contents =
- (bfd_byte *) bfd_zalloc (dynobj,
- bfinfdpic_plt_section (info)->size);
- if (bfinfdpic_plt_section (info)->contents == NULL)
- return FALSE;
- }
+ bfinfdpic_plt_section (info)->contents =
+ (bfd_byte *) bfd_zalloc (dynobj,
+ bfinfdpic_plt_section (info)->size);
+ if (bfinfdpic_plt_section (info)->contents == NULL)
+ return FALSE;
}
return TRUE;
@@ -4302,12 +4297,11 @@ elf32_bfinfdpic_size_dynamic_sections (b
return FALSE;
}
-
- s = bfd_get_section_by_name (dynobj, ".rela.bss");
+ s = bfd_get_section_by_name (dynobj, ".dynbss");
if (s && s->size == 0)
s->flags |= SEC_EXCLUDE;
- s = bfd_get_section_by_name (dynobj, ".rel.plt");
+ s = bfd_get_section_by_name (dynobj, ".rela.bss");
if (s && s->size == 0)
s->flags |= SEC_EXCLUDE;