Hi all!
With the help of a lot of mail between Nick Cremelie (the submitter of the original bug report) and me the bug has been finally found. At least things look very promising currently. It's very likely that this patch fixes the IRIX bug Frank mentioned, too.
There are 2 main components in the attached patch: - the RS6000 no longer needs the GNU Pascal vs GNU PASCAL hack - for some platforms (COFF based without GNU ld) the static constructors were never called. This was the only real GNU Pascal bug. Refer to gpc-lang.c (finish_file) if you want to know what was missing.
The first change is pretty obvious. The second change seems to work, but it hasn't been thoroughly checked yet. I'm not 100% sure that the place I put the calls to finish_file() is really correct. I just don't know enough about the Pascal frontend. Peter, please cross-check this.
The attached patch has to be applied in the p subdirectory.
Suggested ChangeLog entry for GNU Pascal:
Tue 14 Jul 1998 13:01 Klaus Espenlaub kespenla@student.informatik.uni-ulm.de * parse.y: remove Pascal vs PASCAL hack for rs6000. pascal_program: Added call to finish_file(), writing out the static constructor/destructor calling code. * gpc-lang.h: add prototype for finish_file().
Note that this patch isn't enough to get a working GPC on at least some rs6000 based machines (e.g. ibm-aix4.1). This is because the RS6000 machine description contains a stupid bug. No static constructors were called. I wonder if really no one has tested this for GNU C (no, this didn't affect GNU C++). For those who ask: yes, it is possible to define constructors in GNU C. I'll submit a patch for this bug to the GCC developer mailing list.
For those rs6000 users who cannot wait for the next GPC release, here's the patch for config/rs6000/rs6000.h in "human diff" format: search for ASM_OUTPUT_CONSTRUCTOR in config/rs6000/rs6000.h and delete the first matching line and the five lines below.
Klaus
diff -c parse.y~ parse.y *** parse.y~ Mon May 11 20:04:13 1998 --- parse.y Tue Jul 14 13:16:22 1998 *************** *** 112,132 ****
/* Since parsers are distinct for each language, put the language string * definition here. - * - * rs6000.c calls abort() if this is "GNU Pascal" :-) - * - * I have modified rs6000.c. Since "Pascal" is a person's name - * like "Ada" it has the right to be written in the same manner. :-) - * - PG - * - * Sigh, I don't want to change rs6000.c; I will inform Kenner to change - * it in the next release. */ - #ifdef _IBMR2 - char *language_string = "GNU PASCAL"; - #else char *language_string = "GNU Pascal"; - #endif /* Sigh */
tree main_program_name = NULL_TREE;
--- 112,119 ---- *************** *** 723,730 ****
pascal_program: /* empty */ ! { warning ("empty input file"); } | program_component_list ;
/* Allow multiple modules in input file. --- 710,721 ----
pascal_program: /* empty */ ! { ! warning ("empty input file"); ! finish_file(); ! } | program_component_list + { finish_file(); } ;
/* Allow multiple modules in input file. diff -c gpc-lang.h~ gpc-lang.h *** gpc-lang.h~ Sat Sep 13 15:42:40 1997 --- gpc-lang.h Tue Jul 14 13:01:42 1998 *************** *** 49,51 **** --- 49,57 ---- union tree_node *directive; union tree_node *parms; }; + + /* + * GPC Specific prototypes for functions in gpc-lang.c + */ + + extern void finish_file PROTO ((void));