aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2019-12-13 09:05:03 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-13 09:05:03 +0000
commit48f05f09e6791abe2080466f968c2cc27c401028 (patch)
tree0cb2da27ea32156ffd43142ff5ba42ccacb16a82 /gcc
parentde12d07e93ca47cacbbeda1107e7cc3b6af9ad63 (diff)
downloadgcc-48f05f09e6791abe2080466f968c2cc27c401028.zip
gcc-48f05f09e6791abe2080466f968c2cc27c401028.tar.gz
gcc-48f05f09e6791abe2080466f968c2cc27c401028.tar.bz2
[Ada] Pragma Linker_Section in subprogram instantiations in CCG
2019-12-13 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Pragma): Propagate the Linker_Section_Attribute to the ultimate alias of the subprogram to facilitate the C backend processing this attribute. From-SVN: r279360
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_prag.adb20
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3ec76a2..d135da8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-13 Javier Miranda <miranda@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): Propagate the
+ Linker_Section_Attribute to the ultimate alias of the subprogram
+ to facilitate the C backend processing this attribute.
+
2019-12-13 Yannick Moy <moy@adacore.com>
* sem_util.adb (Original_Aspect_Pragma_Name): Go through
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index d1d4747..db4b1b4 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -19188,6 +19188,17 @@ package body Sem_Prag is
Set_Linker_Section_Pragma
(Entity (Corresponding_Aspect (N)), N);
+ -- Propagate it to its ultimate aliased entity to
+ -- facilitate the backend processing this attribute
+ -- in instantiations of generic subprograms.
+
+ if Present (Alias (Entity (Corresponding_Aspect (N))))
+ then
+ Set_Linker_Section_Pragma
+ (Ultimate_Alias
+ (Entity (Corresponding_Aspect (N))), N);
+ end if;
+
-- Pragma case, we must climb the homonym chain, but skip
-- any for which the linker section is already set.
@@ -19196,6 +19207,15 @@ package body Sem_Prag is
if No (Linker_Section_Pragma (Ent)) then
Set_Linker_Section_Pragma (Ent, N);
+ -- Propagate it to its ultimate aliased entity to
+ -- facilitate the backend processing this attribute
+ -- in instantiations of generic subprograms.
+
+ if Present (Alias (Ent)) then
+ Set_Linker_Section_Pragma
+ (Ultimate_Alias (Ent), N);
+ end if;
+
-- A pragma that applies to a Ghost entity becomes
-- Ghost for the purposes of legality checks and
-- removal of ignored Ghost code.