aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-02-10 15:02:39 +0100
committerJakub Jelinek <jakub@redhat.com>2020-02-10 15:02:39 +0100
commit36a798fd192ced25eefaeee345507fa1a0c0356e (patch)
treee5ecacb0b27803e57ee8d3b1e50a0470ee4f16e6
parent59dbb04df76da41f26192c2c219584fc3d6017cc (diff)
downloadgcc-36a798fd192ced25eefaeee345507fa1a0c0356e.zip
gcc-36a798fd192ced25eefaeee345507fa1a0c0356e.tar.gz
gcc-36a798fd192ced25eefaeee345507fa1a0c0356e.tar.bz2
i386: Fix strncmp last arguments in x86_64_elf_section_type_flags
Clearly I can't count, so we would consider as SECTION_BSS even sections like .lbssfoo or .gnu.linkonce.lbbar, even when linker only considers as special .lbss or .lbss.baz or .gnu.linkonce.lb.qux. 2020-02-10 Jakub Jelinek <jakub@redhat.com> PR target/58218 PR other/93641 * config/i386/i386.c (x86_64_elf_section_type_flags): Fix up last arguments of strncmp.
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fa3cbb8..b1c3f11 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/58218
+ PR other/93641
+ * config/i386/i386.c (x86_64_elf_section_type_flags): Fix up last
+ arguments of strncmp.
+
2020-02-10 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/93203
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 498cbb5..44bc0e0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -751,8 +751,9 @@ x86_64_elf_section_type_flags (tree decl, const char *name, int reloc)
flags |= SECTION_RELRO;
if (strcmp (name, ".lbss") == 0
- || strncmp (name, ".lbss.", 5) == 0
- || strncmp (name, ".gnu.linkonce.lb.", 16) == 0)
+ || strncmp (name, ".lbss.", sizeof (".lbss.") - 1) == 0
+ || strncmp (name, ".gnu.linkonce.lb.",
+ sizeof (".gnu.linkonce.lb.") - 1) == 0)
flags |= SECTION_BSS;
return flags;