This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: [GOLD][PATCH]Handle script sections in Output_section::get_input_section.


"H.J. Lu" <hjl.tools@gmail.com> writes:

> I checked in the part of the patch to fix PR 11619.


> index ed61c25..c9ecbe7 100644
> --- a/gold/ChangeLog
> +++ b/gold/ChangeLog
> @@ -1,3 +1,9 @@
> +2010-05-21  Doug Kwan  <dougkwan@google.com>
> +
> +	PR gold/11619
> +	* arm.cc (Arm_input_section::do_output_offset): Add a cast to
> +	avoid a compilation error.
> +
>  2010-05-19  Rafael Espindola  <espindola@google.com>
>
>  	* script-sections.cc (Output_section_definition::allocate_to_segment):
> diff --git a/gold/arm.cc b/gold/arm.cc
> index 3dc2f22..31454e9 100644
> --- a/gold/arm.cc
> +++ b/gold/arm.cc
> @@ -1202,7 +1202,7 @@ class Arm_input_section : public Output_relaxed_input_sect
> ion
>      if ((object == this->relobj())
>  	&& (shndx == this->shndx())
>  	&& (offset >= 0)
> -	&& (offset <= this->original_size_))
> +	&& (offset <= static_cast<section_offset_type>(this->original_size_)))
>        {
>  	*poutput = offset;
>  	return true;


That is incorrect.  It will fail if the value of this->original_size_
does not fit in section_offset_type.  It should be something like

	&& (convert_types<uint64_t, section_offset_type>(offset)
	    <= this->original_size_))

Ian


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