This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, arm] Support for Thumb init/fini entry points


Nick,

> > 	* elflink.h (elf_bfd_final_link): Allow numbers in
> > 	link_info.{init,fini}_function.
> 
> I am not sure about this part of the patch.  Why should we allow
> addresses to provided instead of symbol names ?

So that the second part of the patch would make sense :) .  Since I
rely on this new feature there.

> I know that it can be done for the entry point, but I think that
> that was a bad idea as well, so I would not like to see it
> propagated.

OK, understood.

> > 	* emultempl/armelf.em: Include elf-bfd.h and elf/arm.h.
> > 	(arm_elf_finish): Set the last bit of DT_INIT and DT_FINI
> > 	depending on the type of the function.
> 
> This part of the patch is OK and I have applied it.  I made one change
> - I took the common bit of code from the creation of the three symbols
> and moved it into a seperate function.

This does not work without the first part of the patch (arm-elf):

  $ cat s.c
  _init () {}
  _fini () {}
  f () {}
  
  $ ./xgcc -B./ -mthumb -nostdlib s.c -Wl,-shared
  $ ../binutils/objdump -p a.out | grep INI
    INIT        0x0
    FINI        0x0


One other solution that I can think of could be to use
elf32_arm_finish_dynamic_sections to override the fini/init values.
It is called right before .dynamic gets emitted in elf_bfd_final_link.
We could override the values that were previously computed by
elf_bfd_final_link in case of Thumb symbol.

What do you think?

Adam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]