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]

Re: [patch] Conditionally emit relocations during a final link


On Tue, Jun 12, 2001 at 01:01:30PM -0700, Catherine Moore wrote:
> - --- 4273,4282 ----
>     dynamic = elf_hash_table (info)->dynamic_sections_created;
>     dynobj = elf_hash_table (info)->dynobj;
>   
> +   emit_relocs = info->relocateable
> +     || info->emitrelocations
> +     || bed->elf_backend_emit_relocs;
> + 
Usual formatting convention here seems to be to surround the expression
with parentheses.  Same thing again later in your patch.

>     finfo.info = info;
>     finfo.output_bfd = abfd;
>     finfo.symstrtab = elf_stringtab_init ();
> *************** elf_bfd_final_link (abfd, info)
> *** 4331,4336 ****
> - --- 4342,4358 ----
>   
>   	      if (info->relocateable || info->emitrelocations)
>   		o->reloc_count += sec->reloc_count;
> +               else if (bed->elf_backend_count_relocs)
> + 		{
> + 		  Elf_Internal_Rela * relocs;
> + 
> + 		  relocs = (NAME(_bfd_elf,link_read_relocs)
> + 			    (abfd, sec, (PTR) NULL,
> + 			     (Elf_Internal_Rela *) NULL, true));
> + 
> + 		  o->reloc_count += (*bed->elf_backend_count_relocs)
> + 		    (sec, relocs);

Parens again to move function args to the right.  You probably should be
honouring info->keep_memory here.  ie. pass it in to the read_relocs
func, and free the relocs once you're done if keep_memory is false.

> +               if (bed->elf_backend_emit_relocs
> +                   && ! (finfo->info->relocateable || finfo->info->emitrelocations))
> +                 reloc_emitter = bed->elf_backend_emit_relocs;
> +               else
> +                 reloc_emitter = elf_link_output_relocs;
> + 
>   	      input_rel_hdr = &elf_section_data (o)->rel_hdr;
> !               reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs);

(*reloc_emitter) for K&R compatibility, and same thing a little later.

Other than that, the patch looks OK to me.

Alan


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