This is the mail archive of the 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: Adding ELF sections with bfd

On Tue, Jun 25, 2013 at 12:43:33AM +0000, Jack Carter wrote:
> Hi,
> This is a bit embarrassing, but I am having trouble generating a section, in this case .iplt.
> I instigate the creation with a call to bfd_make_section_anyway_with_flags:
>       s = bfd_make_section_anyway_with_flags(dynobj, ".iplt",
>           flags | SEC_READONLY | SEC_CODE);
>       if (s == NULL
>           || !bfd_set_section_alignment(dynobj, s, bed->plt_alignment))
>         return FALSE;
>       htab->root.iplt = s;
>       htab->siplt = s;
>       htab->iplt_entry_size = 4 * ARRAY_SIZE (mips_exec_iplt_entry);
> but later when I want to reference the address of the output section in mips_elf_calculate_relocation(), it doesn't seem to be there. This during bfd_elf_final_link() so I would assume that all the output sections have been allocated by this time.
> What is the magic to having a new section get an  output_section allocated to it.

How are you trying to find the output section?  By looking up .iplt in
the output bfd?  That might fail due to a linker script mapping .iplt
to some other section.

Also, at what stage of linking are you creating your dynobj .iplt?
You need to do so before ldlang.c:map_input_to_output_sections() for
it to be given an output section (strictly speaking last chance is

Alan Modra
Australia Development Lab, IBM

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