aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2020-12-09 18:57:32 -0800
committerJim Wilson <jimw@sifive.com>2020-12-11 11:14:22 -0800
commit755cf781f2eb3a6317af90bf3b12206b0fc54a96 (patch)
treef26580128560e2ae086cf874dcb0a9db0e67017e /gcc
parent35af87784e02c8c89f020092d91858fe066788f0 (diff)
downloadgcc-755cf781f2eb3a6317af90bf3b12206b0fc54a96.zip
gcc-755cf781f2eb3a6317af90bf3b12206b0fc54a96.tar.gz
gcc-755cf781f2eb3a6317af90bf3b12206b0fc54a96.tar.bz2
Add missing varasm DECL_P check.
This fixes a riscv64-linux bootstrap failure. get_constant_section calls the select_section target hook, and select_section calls get_named_section which calls get_section. So it is possible to have a constant not a decl in both of these functions. They already call DECL_P checks everywhere except for the new code HJ recently added. This adds the missing DECL_P check. gcc/ * varasm.c (get_section): Add DECL_P check before DECL_PRESERVE_P.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/varasm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 0fac368..5b2e123 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -294,6 +294,7 @@ get_section (const char *name, unsigned int flags, tree decl,
flags |= SECTION_NAMED;
if (HAVE_GAS_SHF_GNU_RETAIN
&& decl != nullptr
+ && DECL_P (decl)
&& DECL_PRESERVE_P (decl))
flags |= SECTION_RETAIN;
if (*slot == NULL)