public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] morello: Make dw2 indirect constants TREE_CONSTANT
@ 2022-02-28 12:08 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-02-28 12:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:94b4d02eab8b399e71a488a9848c493cb1895359

commit 94b4d02eab8b399e71a488a9848c493cb1895359
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Date:   Tue Jan 18 11:06:15 2022 +0000

    morello: Make dw2 indirect constants TREE_CONSTANT
    
    During development work on the Morello branch it was observed that DWARF2
    debug symbols referring to a code address (e.g. symbols like
    DW.ref.__gcc_persoality_v0 for the exception handling personality
    function) were being placed in the read-write .data section.
    
    We think that these can also be placed in the relocatable read-only
    section (rel.ro.). This patch marks TREE_CONSTANT as `1` for these
    cases, which later in `categorize_decl_for_section` blocks them from
    going down the `SECCAT_DATA_REL*` code paths and allows them to down
    into the `SECCAT_DATA_REL_RO_*` code paths, instead.

Diff:
---
 gcc/dwarf2asm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 56a8f373eac..fe65c4e1386 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -970,6 +970,10 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
   DECL_INITIAL (decl) = build_fold_addr_expr (decl);
   TREE_READONLY (decl) = 1;
   TREE_STATIC (decl) = 1;
+  /* Setting the constant flags here makes sure these get put into RO sections
+     later on in `categorize_decl_for_section`.  */
+  TREE_CONSTANT (decl) = 1;
+  TREE_CONSTANT (DECL_INITIAL (decl)) = 1;
 
   if (TREE_PUBLIC (id))
     {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-28 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 12:08 [gcc(refs/vendors/ARM/heads/morello)] morello: Make dw2 indirect constants TREE_CONSTANT Matthew Malcomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).