re PR target/63538 ([X86_64] With -mcmodel=medium .lrodata accesses do not use 64...
authorUros Bizjak <uros@gcc.gnu.org>
Wed, 5 Nov 2014 21:00:07 +0000 (22:00 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 5 Nov 2014 21:00:07 +0000 (22:00 +0100)
PR target/63538
* config/i386/i386.c (in_large_data_p): Reject automatic variables.
(ix86_encode_section_info): Do not check for non-automatic varibles
when setting SYMBOL_FLAG_FAR_ADDR flag.
(x86_64_elf_select_section): Do not check ix86_cmodel here.
(x86_64_elf_unique_section): Ditto.
(x86_elf_aligned_common): Emit tab before .largecomm.

testsuite/ChangeLog:

PR target/63538
* gcc.target/i386/pr63538.c: New test.

From-SVN: r217156

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr63538.c [new file with mode: 0644]

index 778ce1f..ead29c3 100644 (file)
@@ -1,3 +1,13 @@
+2014-11-05  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/63538
+       * config/i386/i386.c (in_large_data_p): Reject automatic variables.
+       (ix86_encode_section_info): Do not check for non-automatic varibles
+       when setting SYMBOL_FLAG_FAR_ADDR flag.
+       (x86_64_elf_select_section): Do not check ix86_cmodel here.
+       (x86_64_elf_unique_section): Ditto.
+       (x86_elf_aligned_common): Emit tab before .largecomm.
+
 2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
 
        PR driver/36312
index 0a4c13b..085eb54 100644 (file)
@@ -5090,6 +5090,10 @@ ix86_in_large_data_p (tree exp)
   if (TREE_CODE (exp) == FUNCTION_DECL)
     return false;
 
+  /* Automatic variables are never large data.  */
+  if (TREE_CODE (exp) == VAR_DECL && !is_global_var (exp))
+    return false;
+
   if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
     {
       const char *section = DECL_SECTION_NAME (exp);
@@ -5123,8 +5127,7 @@ ATTRIBUTE_UNUSED static section *
 x86_64_elf_select_section (tree decl, int reloc,
                           unsigned HOST_WIDE_INT align)
 {
-  if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
-      && ix86_in_large_data_p (decl))
+  if (ix86_in_large_data_p (decl))
     {
       const char *sname = NULL;
       unsigned int flags = SECTION_WRITE;
@@ -5210,8 +5213,7 @@ x86_64_elf_section_type_flags (tree decl, const char *name, int reloc)
 static void ATTRIBUTE_UNUSED
 x86_64_elf_unique_section (tree decl, int reloc)
 {
-  if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
-      && ix86_in_large_data_p (decl))
+  if (ix86_in_large_data_p (decl))
     {
       const char *prefix = NULL;
       /* We only need to use .gnu.linkonce if we don't have COMDAT groups.  */
@@ -5280,7 +5282,7 @@ x86_elf_aligned_common (FILE *file,
 {
   if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
       && size > (unsigned int)ix86_section_threshold)
-    fputs (".largecomm\t", file);
+    fputs ("\t.largecomm\t", file);
   else
     fputs (COMMON_ASM_OP, file);
   assemble_name (file, name);
@@ -45178,9 +45180,7 @@ ix86_encode_section_info (tree decl, rtx rtl, int first)
 {
   default_encode_section_info (decl, rtl, first);
 
-  if (TREE_CODE (decl) == VAR_DECL
-      && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
-      && ix86_in_large_data_p (decl))
+  if (ix86_in_large_data_p (decl))
     SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_FAR_ADDR;
 }
 
index c699ce3..4e64c97 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-05  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/63538
+       * gcc.target/i386/pr63538.c: New test.
+
 2014-11-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/discr42.adb: New test.
@@ -21,7 +26,7 @@
        * gnat.dg/inline5.adb: New test.
        * gnat.dg/inline5_pkg.ad[sb]: New helper.
        * gnat.dg/inline6.adb: New test.
-       * gnat.dg/inline6_pkg.ad[sb]: New helper.       
+       * gnat.dg/inline6_pkg.ad[sb]: New helper.
        * gnat.dg/inline7.adb: New test.
        * gnat.dg/inline7_pkg1.ad[sb]: New helper.
        * gnat.dg/inline7_pkg2.ad[sb]: Likewise.
diff --git a/gcc/testsuite/gcc.target/i386/pr63538.c b/gcc/testsuite/gcc.target/i386/pr63538.c
new file mode 100644 (file)
index 0000000..7b979c3
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/63538 */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mcmodel=medium -mlarge-data-threshold=0" } */
+
+static char *str = "Hello World";
+
+char *foo ()
+{
+  return str;
+}
+
+/* { dg-final { scan-assembler "movabs" } } */