Commit: Fix GOLD testsuite failures for 2.35 branch

Nick Clifton nickc@redhat.com
Mon Jul 6 11:22:58 GMT 2020


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
 	|| strcmp(name, ".gcc_except_table") == 0)
       return CB_IGNORE;
     return CB_ERROR;



More information about the Binutils mailing list