From 12ae9b26238af6671f8a33619810e36646c83caa Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Tue, 10 Jun 2008 13:14:15 +0000 Subject: [PATCH] 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 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/utils.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 29a20718ee8..e41daae22e7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2008-06-10 Olivier Hainque + + * 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 * decl.c (components_to_record): Adjust the packedness for the diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index ef49d10b9f1..d9a0e3aa618 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); -- 2.30.2