This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: binutils is broken on ELF/mips (Re: binutils is broken on Linux/alpha)
On Thu, Oct 04, 2001 at 11:23:47AM -0700, H . J . Lu wrote:
> On Thu, Oct 04, 2001 at 10:36:24AM -0700, H . J . Lu wrote:
> > On Thu, Oct 04, 2001 at 10:29:21AM -0700, H . J . Lu wrote:
> > > On Thu, Oct 04, 2001 at 10:28:01AM -0700, H . J . Lu wrote:
> > > >
> > > > That is it. The ELF/mips tries to perform relocation in a linkonce
> > > > section which has been removed. I will take a look.
> > > >
> > > >
> > >
> > > I am not sure if ELF/mips is the only target which does this.
> > >
> > >
> >
> > The relocation in .eh_frame against data in the removed linkonce
> > section. I am not so sure if it is ELF/mips specific. I didn't see the
> > elf.sc change mentioned in
> >
> > http://sources.redhat.com/ml/binutils/2001-06/msg00530.html
> >
> > I have a feeling that the current binutils is broken on all ELF targets
> > if not all targets.
> >
>
> I think I found the problem. Around line 6316 in bfd/elf32-mips.c,
> there are
>
> case R_MIPS_32:
> case R_MIPS_REL32:
> case R_MIPS_64:
> if ((info->shared
> || (elf_hash_table (info)->dynamic_sections_created
> && h != NULL
> && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
> != 0)))
> && (input_section->flags & SEC_ALLOC) != 0)
> {
> /* If we're creating a shared library, or this relocation is
> against a symbol in a shared library, then we can't know
> where the symbol will end up. So, we create a relocation
> record in the output, and leave the job up to the dynamic
> linker. */
> value = addend;
> ....
>
> The problem is `symbol' can be NULL if the linkonce section is removed.
> Then the ELF/mips linker crashes in mips_elf_create_dynamic_relocation.
> How do we fix it? What are other targets also affected by this?
>
Correct me if I am wrong. From elf_link_input_bfd, when
ELF_ST_TYPE (sym->st_info) == STT_SECTION
sym->st_value == 0
(bfd_get_section_flags (input_bfd, sec) & SEC_LINK_ONCE) != 0
bfd_is_abs_section (sec->output_section) == true
we know the symbol is in the removed linkonce section. Should we put
a macro in elf-bfd.h so that it can be used by all ELF targets? I
am thinking something like
#define is_removed_linkonce_symbol(sym,abfd,sec)
or
#define is_removed_linkonce_symbol(sym,sec)
H.J.