X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Flinker.c;h=082eea0715b0bd62820140bda518f690a6f9f63e;hb=a2bea3245ecf4ff67f923c85adf57aa78423eb45;hp=dec6d1d0ace372ebdb04662139ee16c6a09d4e49;hpb=ce875075f9c8acc57bb0ec516ae3ba50064e52b7;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/linker.c b/bfd/linker.c index dec6d1d0ac..082eea0715 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1,5 +1,5 @@ /* linker.c -- BFD linker routines - Copyright (C) 1993-2015 Free Software Foundation, Inc. + Copyright (C) 1993-2016 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support This file is part of BFD, the Binary File Descriptor library. @@ -1475,7 +1475,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, else if (bfd_is_com_section (section)) { row = COMMON_ROW; - if (strcmp (name, "__gnu_lto_slim") == 0) + if (!bfd_link_relocatable (info) + && strcmp (name, "__gnu_lto_slim") == 0) (*_bfd_error_handler) (_("%s: plugin needed to handle lto object"), bfd_get_filename (abfd)); @@ -1906,7 +1907,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info) if (! generic_add_output_symbol (abfd, &outsymalloc, NULL)) return FALSE; - if (info->relocatable) + if (bfd_link_relocatable (info)) { /* Allocate space for the output relocs for each section. */ for (o = abfd->sections; o != NULL; o = o->next) @@ -2210,7 +2211,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, break; case discard_sec_merge: output = TRUE; - if (info->relocatable + if (bfd_link_relocatable (info) || ! (sym->section->flags & SEC_MERGE)) break; /* FALLTHROUGH */ @@ -2380,7 +2381,7 @@ _bfd_generic_reloc_link_order (bfd *abfd, { arelent *r; - if (! info->relocatable) + if (! bfd_link_relocatable (info)) abort (); if (sec->orelocation == NULL) abort (); @@ -2611,7 +2612,7 @@ default_indirect_link_order (bfd *output_bfd, BFD_ASSERT (input_section->output_offset == link_order->offset); BFD_ASSERT (input_section->size == link_order->size); - if (info->relocatable + if (bfd_link_relocatable (info) && input_section->reloc_count > 0 && output_section->orelocation == NULL) { @@ -2705,7 +2706,7 @@ default_indirect_link_order (bfd *output_bfd, goto error_return; new_contents = (bfd_get_relocated_section_contents (output_bfd, info, link_order, contents, - info->relocatable, + bfd_link_relocatable (info), _bfd_generic_link_get_symbols (input_bfd))); if (!new_contents) goto error_return; @@ -3303,3 +3304,46 @@ bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs, bfd_find_version_for_sym (verdefs, sym_name, &hidden); return hidden; } + +/* +FUNCTION + bfd_link_check_relocs + +SYNOPSIS + bfd_boolean bfd_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + +DESCRIPTION + Checks the relocs in ABFD for validity. + Does not execute the relocs. + Return TRUE if everything is OK, FALSE otherwise. + This is the external entry point to this code. +*/ + +bfd_boolean +bfd_link_check_relocs (bfd *abfd, struct bfd_link_info *info) +{ + return BFD_SEND (abfd, _bfd_link_check_relocs, (abfd, info)); +} + +/* +FUNCTION + _bfd_generic_link_check_relocs + +SYNOPSIS + bfd_boolean _bfd_generic_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + +DESCRIPTION + Stub function for targets that do not implement reloc checking. + Return TRUE. + This is an internal function. It should not be called from + outside the BFD library. +*/ + +bfd_boolean +_bfd_generic_link_check_relocs (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + return TRUE; +}