re PR target/58218 (-mcmodel=medium cause assembler warning "ignoring incorrect secti...
authorJakub Jelinek <jakub@redhat.com>
Fri, 23 Aug 2013 09:57:44 +0000 (11:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 23 Aug 2013 09:57:44 +0000 (11:57 +0200)
PR target/58218
* config/i386/x86-64.h (TARGET_SECTION_TYPE_FLAGS): Define.
* config/i386/i386.c (x86_64_elf_section_type_flags): New function.

* gcc.target/i386/pr58218.c: New test.

From-SVN: r201938

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/x86-64.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr58218.c [new file with mode: 0644]

index e571e55169de82f371183effc481035f32ed50fa..a6624ede668ecb427ec70d4235e3d30808c0d88c 100644 (file)
@@ -1,3 +1,9 @@
+2013-08-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/58218
+       * config/i386/x86-64.h (TARGET_SECTION_TYPE_FLAGS): Define.
+       * config/i386/i386.c (x86_64_elf_section_type_flags): New function.
+
 2013-08-23  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        * gcc/config/i386/predicates.md (ext_sse_reg_operand): New.
index d05dbf02db05e7809d99f80e7e6bcebecdff6d79..536c35737d46aabef27e0530f82872b39f53d716 100644 (file)
@@ -4912,6 +4912,28 @@ x86_64_elf_select_section (tree decl, int reloc,
   return default_elf_select_section (decl, reloc, align);
 }
 
+/* Select a set of attributes for section NAME based on the properties
+   of DECL and whether or not RELOC indicates that DECL's initializer
+   might contain runtime relocations.  */
+
+static unsigned int ATTRIBUTE_UNUSED
+x86_64_elf_section_type_flags (tree decl, const char *name, int reloc)
+{
+  unsigned int flags = default_section_type_flags (decl, name, reloc);
+
+  if (decl == NULL_TREE
+      && (strcmp (name, ".ldata.rel.ro") == 0
+         || strcmp (name, ".ldata.rel.ro.local") == 0))
+    flags |= SECTION_RELRO;
+
+  if (strcmp (name, ".lbss") == 0
+      || strncmp (name, ".lbss.", 5) == 0
+      || strncmp (name, ".gnu.linkonce.lb.", 16) == 0)
+    flags |= SECTION_BSS;
+
+  return flags;
+}
+
 /* Build up a unique section name, expressed as a
    STRING_CST node, and assign it to DECL_SECTION_NAME (decl).
    RELOC indicates whether the initial value of EXP requires
index 336343927c8ed6577a8867a53947f9d728f6236c..0c62723ae22eea38f6dda1f2f3ee2c5601029317 100644 (file)
@@ -103,3 +103,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #undef TARGET_ASM_UNIQUE_SECTION
 #define TARGET_ASM_UNIQUE_SECTION  x86_64_elf_unique_section
+
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS  x86_64_elf_section_type_flags
index c6e0653ca9efbb9ac1a65abb59bb3b4f4ecde810..db1c984459c1b417a1826e808217bb9cef5ccac1 100644 (file)
@@ -1,5 +1,8 @@
 2013-08-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/58218
+       * gcc.target/i386/pr58218.c: New test.
+
        PR tree-optimization/58209
        * gcc.c-torture/execute/pr58209.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr58218.c b/gcc/testsuite/gcc.target/i386/pr58218.c
new file mode 100644 (file)
index 0000000..4145242
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR target/58218 */
+/* { dg-do assemble { target lp64 } } */
+/* { dg-options "-mcmodel=medium" } */
+
+struct { float x[16385]; } a = { { 0.f, } };