This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR gcc/68256 Defining TARGET_USE_CONSTANT_BLOCKS_P causes go bootstrap failure on aarch64.
- From: vladimir dot mezentsev at oracle dot com
- To: gcc-patches at gcc dot gnu dot org
- Cc: vladimir dot mezentsev at oracle dot com
- Date: Fri, 16 Feb 2018 09:18:26 -0800
- Subject: [PATCH] PR gcc/68256 Defining TARGET_USE_CONSTANT_BLOCKS_P causes go bootstrap failure on aarch64.
- Authentication-results: sourceware.org; auth=none
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Ramana Radhakrishnan made a workaround in gcc/config/aarch64/aarch64.c to resolve
bootstrap comparison failure (2015-11-10, commit bc443a71dafa2e707bae4b2fa74f83b05dea37ab).
The real bug is in gcc/varasm.c.
hash_section() returns an unstable value.
As result, two blocks are created in get_block_for_section() for one unnamed section.
A list of objects in these blocks depends on the -gtoggle option.
I removed Ramana's workaround in gcc/config/aarch64/aarch64.c and
I fixed hash_section() in gcc/varasm.c
Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
Testing finished ok.
ChangeLog:
2018-02-15 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gcc/68256
* varasm.c (hash_section): Return an unchangeble hash value
* config/aarch64/aarch64.c (aarch64_use_blocks_for_constant_p):
Return !aarch64_can_use_per_function_literal_pools_p ();
---
gcc/config/aarch64/aarch64.c | 8 +++-----
gcc/varasm.c | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 174310c..a0a495d 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7596,11 +7596,9 @@ aarch64_can_use_per_function_literal_pools_p (void)
static bool
aarch64_use_blocks_for_constant_p (machine_mode, const_rtx)
{
- /* Fixme:: In an ideal world this would work similar
- to the logic in aarch64_select_rtx_section but this
- breaks bootstrap in gcc go. For now we workaround
- this by returning false here. */
- return false;
+ /* We can't use blocks for constants when we're using a per-function
+ constant pool. */
+ return !aarch64_can_use_per_function_literal_pools_p ();
}
/* Select appropriate section for constants depending
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b045efa..5aae5b4 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -225,7 +225,7 @@ hash_section (section *sect)
{
if (sect->common.flags & SECTION_NAMED)
return htab_hash_string (sect->named.name);
- return sect->common.flags;
+ return sect->common.flags & ~SECTION_DECLARED;
}
/* Helper routines for maintaining object_block_htab. */
--
1.8.3.1