This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Set the target in make_sized_incremental_binary
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 != ¶meters->target())
gold_error(_("%s: incompatible target"), this->output_name_);
Ian