[gold][patch] Set the target in make_sized_incremental_binary

Ian Lance Taylor iant@google.com
Wed Dec 2 23:13:00 GMT 2009


Rafael Espindola <espindola@google.com> writes:

>> 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
>>
>>        * incremental.cc (make_sized_incremental_binary): Set the target.
>
> diff --git a/gold/incremental.cc b/gold/incremental.cc
> index 4af4ef3..6bcc657 100644
> --- a/gold/incremental.cc
> +++ b/gold/incremental.cc
> @@ -326,6 +326,10 @@ make_sized_incremental_binary(Output_file* file,
>    Target* target = select_target(ehdr.get_e_machine(), size, big_endian,
>                                   ehdr.get_e_ident()[elfcpp::EI_OSABI],
>                                   ehdr.get_e_ident()[elfcpp::EI_ABIVERSION]);
> +
> +  if (!parameters->target_valid())
> +    set_parameters_target(target);
> +
>    if (target == NULL)
>      {
>        explain_no_incremental(_("unsupported ELF machine number %d"),


You have to call set_parameters_target after the check for whether
target == NULL.

For safety, it should also check the existing target as in object.cc:

  if (!parameters->target_valid())
    set_parameters_target(target);
  else if (target != &parameters->target())
    gold_error(_("%s: incompatible target"), this->output_name_);

Ian



More information about the Binutils mailing list