Commit: Fix GOLD testsuite failures for 2.35 branch
Andreas Schwab
schwab@linux-m68k.org
Mon Jul 6 11:52:16 GMT 2020
On Jul 06 2020, Nick Clifton 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
You want strlen or sizeof - 1. CONST_STRNEQ would be even better, if
gold wasn't such an alien part of binutils.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
More information about the Binutils
mailing list