PATCH: ld/2462: -Wl,-s always output unused bytes at the end
H. J. Lu
hjl@lucon.org
Fri Mar 17 14:18:00 GMT 2006
More information about the Binutils mailing list
Fri Mar 17 14:18:00 GMT 2006
- Previous message (by thread): PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- Next message (by thread): PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Mar 17, 2006 at 06:02:52AM -0800, H. J. Lu wrote: > This is a regression caused by > > http://sourceware.org/ml/binutils/2005-05/msg00170.html > > If Paul has no problems with vxworks, I'd like to check it as an > obvious fix. > Small optimizaton. We don't need to pass finfo to elf_emit_relocs. H.J. ---- 2006-03-17 H.J. Lu <hongjiu.lu@intel.com> PR ld/2462 * elflink.c (elf_emit_relocs): New. (elf_link_input_bfd): Emit relocations only when needed. Call elf_emit_relocs instead of bed->elf_backend_emit_relocs. * elfxx-target.h (elf_backend_emit_relocs): Default to NULL. --- bfd/elflink.c.reloc 2006-03-16 21:44:49.000000000 -0800 +++ bfd/elflink.c 2006-03-17 06:12:15.000000000 -0800 @@ -6809,6 +6809,26 @@ _bfd_elf_check_kept_section (asection *s return kept; } +static bfd_boolean +elf_emit_relocs (bfd *output_bfd, + asection *input_section, + Elf_Internal_Shdr *input_rel_hdr, + Elf_Internal_Rela *internal_relocs, + struct elf_link_hash_entry **rel_hash) +{ + const struct elf_backend_data *bed; + + bed = get_elf_backend_data (output_bfd); + if (bed->elf_backend_emit_relocs) + return bed->elf_backend_emit_relocs (output_bfd, input_section, + input_rel_hdr, + internal_relocs, rel_hash); + else + return _bfd_elf_link_output_relocs (output_bfd, input_section, + input_rel_hdr, internal_relocs, + rel_hash); +} + /* Link an input file into the linker output file. This function handles all the sections and relocations of the input file at once. This is so that we only have to read the local symbols once, and @@ -6845,7 +6865,8 @@ elf_link_input_bfd (struct elf_final_lin return TRUE; emit_relocs = (finfo->info->relocatable - || finfo->info->emitrelocations); + || finfo->info->emitrelocations + || bed->elf_backend_emit_relocs); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (elf_bad_symtab (input_bfd)) @@ -7416,10 +7437,8 @@ elf_link_input_bfd (struct elf_final_lin /* Swap out the relocs. */ if (input_rel_hdr->sh_size != 0 - && !bed->elf_backend_emit_relocs (output_bfd, o, - input_rel_hdr, - internal_relocs, - rel_hash_list)) + && !elf_emit_relocs (output_bfd, o, input_rel_hdr, + internal_relocs, rel_hash_list)) return FALSE; input_rel_hdr2 = elf_section_data (o)->rel_hdr2; @@ -7428,10 +7447,9 @@ elf_link_input_bfd (struct elf_final_lin internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) * bed->s->int_rels_per_ext_rel); rel_hash_list += NUM_SHDR_ENTRIES (input_rel_hdr); - if (!bed->elf_backend_emit_relocs (output_bfd, o, - input_rel_hdr2, - internal_relocs, - rel_hash_list)) + if (!elf_emit_relocs (output_bfd, o, input_rel_hdr2, + internal_relocs, + rel_hash_list)) return FALSE; } } --- bfd/elfxx-target.h.reloc 2006-02-27 15:50:54.000000000 -0800 +++ bfd/elfxx-target.h 2006-03-17 05:27:36.000000000 -0800 @@ -430,7 +430,7 @@ #define elf_backend_ignore_undef_symbol NULL #endif #ifndef elf_backend_emit_relocs -#define elf_backend_emit_relocs _bfd_elf_link_output_relocs +#define elf_backend_emit_relocs NULL #endif #ifndef elf_backend_count_relocs #define elf_backend_count_relocs NULL
- Previous message (by thread): PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- Next message (by thread): PATCH: ld/2462: -Wl,-s always output unused bytes at the end
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list