summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-05 21:00:07 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-05 21:00:07 +0000
commit788bd1708aa33197eb06957af45fc18fca4d6edd (patch)
treeba1ca4bc338247654252816f9d8010fab9f068f8
parentfa1a3f3370259e5323549b8f7b23095a0fe460d3 (diff)
downloadgcc-788bd1708aa33197eb06957af45fc18fca4d6edd.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217156 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/i386/i386.c16
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63538.c13
4 files changed, 37 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 778ce1fd64f..ead29c3897e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0a4c13bed44..085eb547621 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c699ce31b4f..4e64c97a4b5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..7b979c35d81
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63538.c
@@ -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" } } */