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] Fix PR gold/12220 where linker script causes internal error with compressed debug sections


Cary Coutant <ccoutant@google.com> writes:

>         PR gold/12220
>         * layout.cc (Layout::choose_output_section): Transform names of
>         compressed sections even when using a script with a SECTIONS clause.
>         * output.cc (Output_section::add_input_section): Use uncompressed
>         section size when tracking input sections.

> +  // Compressed debug sections should be mapped to the corresponding
> +  // uncompressed section.
> +  if (is_compressed_debug_section(name))
> +    {
> +      char* uncompressed_name = new char[len];
> +      uncompressed_name[0] = '.';
> +      gold_assert(name[0] == '.' && name[1] == 'z');
> +      strncpy(&uncompressed_name[1], &name[2], len - 2);
> +      uncompressed_name[len - 1] = '\0';
> +      len -= 1;
> +      name = uncompressed_name;
> +    }

If the code takes this path, it should free the allocated memory after
the call to this->namepool_.add_with_length.

Also now please remove the handling of is_compressed_debug_section in
Layout::output_section_name.

This is OK with those changes.

Thanks.

Ian


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