This is the mail archive of the binutils@sourceware.org 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: elf section type & objcopy


On Thu, Jan 28, 2010 at 9:33 AM, Nathan Sidwell <nathan@codesourcery.com> wrote:
> H.J., Nick,
>
> Back in 2006 H.J. applied this bfd patch:
> 2006-04-26 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?PR binutils/2593
> ? ? ? ?* elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
> ? ? ? ?and flags if its BFD flags have been set.
> ? ? ? ?(_bfd_elf_init_private_section_data): Don't copy the output ELF
> ? ? ? ?section type from input if it has been set to something
> ? ? ? ?different.
>
> The mailing list thread is
> http://sourceware.org/ml/binutils/2006-04/msg00302.html
>
> this breaks the following behaviour of objcopy:
> ?objcopy --add-section .note=some-file in.o out.o
>
> previously, the new .note section would get a section type of NOTES, because
> _bfd_elf_get_sec_type_attr got called and checks for special section names.
> ?The above patch causes that not to happen, as objcopy used
> make_section_with_flags, passing non-zero flags in. ?Yes, it's taken this
> long for someone to notice :)
>
> The attached flag also sets SEC_LINKER_CREATED to force checking the section
> name and restores the original behaviour.
>
> I've not checked whether setting the section type from the name this way is
> documented -- it should be if it is what we want to happen. ?I also need to
> create a testcase for this patch.
>
> I have verified that the attached patch causes no regressions -- HJ's test
> cases still pass, so I guess I've not broken the above fix.
>
> Am I heading in the right direction?
>
> nathan
>
> --
> Nathan Sidwell ? ?:: ? http://www.codesourcery.com ? :: ? ? ? ? CodeSourcery
>
>
> 2010-01-28 ?Nathan Sidwell ?<nathan@codesourcery.com>
>
> ? ? ? ?* objcopy (copy_object): Set SEC_LINKER_CREATED when adding
> ? ? ? ?sections.
>

It looks good to me. You need a testcase patch.

Thanks.


-- 
H.J.


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