OSDN Git Service

PR target/25254
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Dec 2005 11:00:50 +0000 (11:00 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Dec 2005 11:00:50 +0000 (11:00 +0000)
PR target/24188
* config/i386/i386.c (x86_64_elf_select_section): If DECL is not
DECL_P, call get_section rather than get_named_section.  Supply
section flags to it.

* gcc.target/i386/pr25254.c: New test.
* gfortran.dg/PR24188.f: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108506 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr25254.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/PR24188.f [new file with mode: 0644]

index 417d69f..a58022f 100644 (file)
@@ -1,3 +1,11 @@
+2005-12-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/25254
+       PR target/24188
+       * config/i386/i386.c (x86_64_elf_select_section): If DECL is not
+       DECL_P, call get_section rather than get_named_section.  Supply
+       section flags to it.
+
 2005-12-14  Ben Elliston  <bje@au.ibm.com>
 
        * c-common.c (c_common_truthvalue_conversion): Generalise warning
index 079ead8..33b9c6f 100644 (file)
@@ -1703,6 +1703,7 @@ x86_64_elf_select_section (tree decl, int reloc,
       && ix86_in_large_data_p (decl))
     {
       const char *sname = NULL;
+      unsigned int flags = SECTION_WRITE;
       switch (categorize_decl_for_section (decl, reloc, flag_pic))
        {
        case SECCAT_DATA:
@@ -1722,12 +1723,14 @@ x86_64_elf_select_section (tree decl, int reloc,
          break;
        case SECCAT_BSS:
          sname = ".lbss";
+         flags |= SECTION_BSS;
          break;
        case SECCAT_RODATA:
        case SECCAT_RODATA_MERGE_STR:
        case SECCAT_RODATA_MERGE_STR_INIT:
        case SECCAT_RODATA_MERGE_CONST:
          sname = ".lrodata";
+         flags = 0;
          break;
        case SECCAT_SRODATA:
        case SECCAT_SDATA:
@@ -1741,7 +1744,14 @@ x86_64_elf_select_section (tree decl, int reloc,
          break;
        }
       if (sname)
-       return get_named_section (decl, sname, reloc);
+       {
+         /* We might get called with string constants, but get_named_section
+            doesn't like them as they are not DECLs.  Also, we need to set
+            flags in that case.  */
+         if (!DECL_P (decl))
+           return get_section (sname, flags, NULL);
+         return get_named_section (decl, sname, reloc);
+       }
     }
   return default_elf_select_section (decl, reloc, align);
 }
index 6d53230..1045181 100644 (file)
@@ -1,3 +1,10 @@
+2005-12-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/25254
+       PR target/24188
+       * gcc.target/i386/pr25254.c: New test.
+       * gfortran.dg/PR24188.f: New test.
+
 2005-12-14  David Billinghurst  (David.Billinghurst@riotinto.com)
 
        * lib/fortran-torture.exp:  Catch remaining uses of 
diff --git a/gcc/testsuite/gcc.target/i386/pr25254.c b/gcc/testsuite/gcc.target/i386/pr25254.c
new file mode 100644 (file)
index 0000000..b1eff6e
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/25254 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-mcmodel=medium -mlarge-data-threshold=1" } */
+
+const struct { int i; int j; } c = { 2, 6 };
+
+const char *
+foo (void)
+{
+  return "OK";
+}
diff --git a/gcc/testsuite/gfortran.dg/PR24188.f b/gcc/testsuite/gfortran.dg/PR24188.f
new file mode 100644 (file)
index 0000000..a33141f
--- /dev/null
@@ -0,0 +1,7 @@
+C PR target/24188
+C { dg-do compile }
+C { dg-options "-O2" }
+C { dg-options "-O2 -mcmodel=medium" { target { x86_64-*-* && lp64 } } }
+C { dg-options "-O2 -mcmodel=medium" { target { i?86-*-* && lp64 } } }
+      WRITE(6,*) ''
+      END