Hello! Following patch fixes PR 63538, where the data in the large data section was accessed through 32bit address. The patch unifies places where large data sections are determined and passes all declarations to ix86_in_large_data_p only.
The patch fixes the testcase form the PR. Also, the code from several tests involving various -mlarge-data-threshold= settings looks consistent now. 2014-11-03 Uros Bizjak <ubiz...@gmail.com> PR target/63538 * config/i386/i386.c (ix86_encode_section_info): Do not check TREE_STATIC and DECL_EXTERNAL when setting SYMBOL_FLAG_FAR_ADDR flag. (x86_64_elf_select_section): Do not check ix86_cmodel here. (x86_64_elf_unique_section): Ditto. The patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. However, the -mcmodel testcases are virtually non-existent, this is the reason for the RFC status of the patch. Uros.
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; }