https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63538

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-03
                 CC|                            |ubizjak at gmail dot com
     Ever confirmed|0                           |1

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Can you please try following patch:

--cut here--
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c    (revision 217050)
+++ config/i386/i386.c    (working copy)
@@ -5099,8 +5099,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;
@@ -5186,8 +5185,7 @@ x86_64_elf_section_type_flags (tree decl, const ch
 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.  */
@@ -44230,9 +44228,7 @@ ix86_encode_section_info (tree decl, rtx rtl, int
 {
   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;
 }

--cut here--

The most important change is in the last part: leave ix86_in_large_data_p to
decide if the declaration goes to large section, as is the case in other
places.

Patch fixes the testcase and survives bootstrap+regtest for x86_64-linux-gnu,
but the testsuite that involves -mcmodel=medium is virtually nonexistent.

Confirmed.

Reply via email to