Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/gcc/dist/gcc A const declaration with explicit...
details: https://anonhg.NetBSD.org/src/rev/1f0fdd59b920
branches: trunk
changeset: 355184:1f0fdd59b920
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Jul 17 19:53:10 2017 +0000
description:
A const declaration with explicit section attribute should create a
read-only section, whether it is initialized or not.
diffstat:
external/gpl3/gcc/dist/gcc/varasm.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r 45f27fa7af77 -r 1f0fdd59b920 external/gpl3/gcc/dist/gcc/varasm.c
--- a/external/gpl3/gcc/dist/gcc/varasm.c Mon Jul 17 19:50:23 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/varasm.c Mon Jul 17 19:53:10 2017 +0000
@@ -978,11 +978,17 @@
}
-/* Return true if DECL's initializer is suitable for a BSS section. */
+/*
+ * Return true if DECL's initializer is suitable for a BSS section.
+ * If there is an explicit section name attribute, assume that it is not
+ * for a BSS section, independent of the name.
+ */
bool
bss_initializer_p (const_tree decl)
{
+ if (DECL_SECTION_NAME (decl) != NULL)
+ return false;
return (DECL_INITIAL (decl) == NULL
/* In LTO we have no errors in program; error_mark_node is used
to mark offlined constructors. */
@@ -6402,7 +6408,7 @@
ret = SECCAT_BSS;
else if (! TREE_READONLY (decl)
|| TREE_SIDE_EFFECTS (decl)
- || ! TREE_CONSTANT (DECL_INITIAL (decl)))
+ || (DECL_INITIAL(decl) != NULL && ! TREE_CONSTANT (DECL_INITIAL (decl))))
{
/* Here the reloc_rw_mask is not testing whether the section should
be read-only or not, but whether the dynamic link will have to
@@ -6446,6 +6452,7 @@
no concept of a read-only thread-local-data section. */
if (ret == SECCAT_BSS
|| (flag_zero_initialized_in_bss
+ && DECL_INITIAL(decl) != NULL
&& initializer_zerop (DECL_INITIAL (decl))))
ret = SECCAT_TBSS;
else
Home |
Main Index |
Thread Index |
Old Index