Commit: Fix GOLD testsuite failures for 2.35 branch

H.J. Lu hjl.tools@gmail.com
Mon Jul 6 11:56:17 GMT 2020


On Mon, Jul 6, 2020 at 4:24 AM Nick Clifton via Binutils
<binutils@sourceware.org> wrote:
>
> Hi Andreas,
>
> >> +    || strncmp(name, ".gnu.build.attributes", 21) == 0
> >
> > Can you avoid the magic number?
>
> Is this the sort of thing that you had in mind ?
>
> Cheers
>   Nick
>
> diff --git a/gold/target-reloc.h b/gold/target-reloc.h
> index d1d0e13589..376bbd97c1 100644
> --- a/gold/target-reloc.h
> +++ b/gold/target-reloc.h
> @@ -136,7 +136,8 @@ class Default_comdat_behavior
>      if (Layout::is_debug_info_section(name))
>        return CB_PRETEND;
>      if (strcmp(name, ".eh_frame") == 0
> -       || strncmp(name, ".gnu.build.attributes", 21) == 0
> +#define ATTR_SECTION_PREFIX ".gnu.build.attributes"
> +       || strncmp(name, ATTR_SECTION_PREFIX, sizeof ATTR_SECTION_PREFIX) == 0

Shouldn't it be sizeof ATTR_SECTION_PREFIX - 1?

>         || strcmp(name, ".gcc_except_table") == 0)
>        return CB_IGNORE;
>      return CB_ERROR;
>


-- 
H.J.


More information about the Binutils mailing list