aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2008-06-10 13:14:15 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2008-06-10 13:14:15 +0000
commit12ae9b26238af6671f8a33619810e36646c83caa (patch)
treee3feb4e532cb41ca8d74b60b569f12984746a465
parentc24aadf3fac43ff63e9f309b0ead43881be9548e (diff)
downloadgcc-12ae9b26238af6671f8a33619810e36646c83caa.zip
gcc-12ae9b26238af6671f8a33619810e36646c83caa.tar.gz
gcc-12ae9b26238af6671f8a33619810e36646c83caa.tar.bz2
utils.c (create_subprog_decl): If this is for the 'main' entry point according to the asm name...
* utils.c (create_subprog_decl): If this is for the 'main' entry point according to the asm name, redirect main_identifier_node. From-SVN: r136619
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/utils.c13
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 29a2071..e41daae 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-10 Olivier Hainque <hainque@adacore.com>
+
+ * utils.c (create_subprog_decl): If this is for the 'main' entry
+ point according to the asm name, redirect main_identifier_node.
+
2008-06-09 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (components_to_record): Adjust the packedness for the
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index ef49d10..d9a0e3a 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -1989,7 +1989,18 @@ create_subprog_decl (tree subprog_name, tree asm_name,
DECL_DECLARED_INLINE_P (subprog_decl) = 1;
if (asm_name)
- SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
+ {
+ SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
+
+ /* The expand_main_function circuitry expects "main_identifier_node" to
+ designate the DECL_NAME of the 'main' entry point, in turn expected
+ to be declared as the "main" function literally by default. Ada
+ program entry points are typically declared with a different name
+ within the binder generated file, exported as 'main' to satisfy the
+ system expectations. Redirect main_identifier_node in this case. */
+ if (asm_name == main_identifier_node)
+ main_identifier_node = DECL_NAME (subprog_decl);
+ }
process_attributes (subprog_decl, attr_list);