aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-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);