This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
"Zack Weinberg" <zack@codesourcery.com> writes: | Geoff Keating <geoffk@geoffk.org> writes: | > Danny Smith <dannysmith@users.sourceforge.net> writes: | >> The list of undefined external functions are output by | >> winnt.c:i386_pe_file_end. I do not know how these directives are used by | >> GNU as, but they do not seem to be needed. In fact, if I undefine | >> ASM_OUTPUT_EXTERNAL (where the external symbols are saved into a list) | >> in cygming.h, I can still build working executables and dlls (and the | >> pch testsuite failures are resolved). Am I missing something or are | >> these end-of-file directives just for compatability with other | >> assemblers/linkers as suggested by this comment in winnt.c. | ... | > You probably want to fix this by adding appropriate GTY markers in | > winnt.c. I expect that they are needed by some code, otherwise why | > would someone have gone to the effort of writing all that code? Plus, | > it's worth it just so that the testsuite passes. | | I had to fix similar bugs in the ia64 back end. It looks like this | bug would be fixed by adding GTY(()) markers to struct extern_list, | struct export_list, extern_head, and export_head, and using ggc_alloc | instead of xmalloc in i386_pe_record_(external_function|exported_symbol). | You'll also have to do the "when you add GTY(()) markers to a file | that didn't previously have them" dance - see | http://gcc.gnu.org/onlinedocs/gccint/Files.html for instructions. | | zw Hello Zack, Geoff. Thanks for your help. I have followed your suggestions and now all pch testsuite pass! I have also simplified mingw32_gt_pch_use_address, to simply return 0 if called with size == 0. I do not like the idea of changing the pch file to text mode on windows host. Changing asm_out_file to 'b' is a safer option for mingw32, since the MS runtime fseek and ftell are not reliable in text mode (according to MS docs and a lot of mingw bug reports) because of CRLF<->LF translations and the CTRL-Z EOF marker I have added target_gtfiles=winnt.c to cygwin, uwin, and interix as well as mingw32. I haven't tested on those targets. Nor have I tried to use the code in host-mingw32.c as a host-cygwin out_host_hook_obj. It might work, but I would prefer if someone who knows more about cygwin's internal use of virtual memory to test. Revised patch is attached. There is still a bug that I tripped over when testing the libstdc++ pch file. On targets that HAVE_TARGET_EXECUTABLE_SUFFIX the command gcc foo.h -ofoo creates foo.{TARGET_EXEXUTABLE_SUFFIX) not foo. The problem arise in the call to convert_filename in gcc.c. I have worked around it for the momemt when testing libstdc++ pch, by changing the libstdc++ makefile to put a .gch suffix on the files output to the stdc++h.gch directory. Danny 2004-06-01 Danny Smith <dannysmith@users.sourceforge.net> * toplev.c (init_asm_output): Add explicit 'b' to mode when opening asm_out_file. * c-pch.c (c_common_write_pch): Remove unnecessary fflush before reading asm_out_file. Replace fflush after reading asm_out_file with fseek. * hosthooks-def.h (HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY): Define default and add to HOST_HOOKS_INITIALIZER. * hosthooks.h (gt_pch_alloc_granularity): Declare hook function. * gcc-common.c (default_gt_pch_alloc_granularity): New function. (gt_pch_save): Use host_hooks.gt_pch_alloc_granularity to set mmi.offset padding. * config.gcc (i[34567]86-*-mingw32*): Set target_gtfiles to $(srcdir)/config/i386/winnt.c. (i[34567]86-*-pe | i[34567]86-*-cygwin*): Likewise. (i[34567]86-*-uwin*): Likewise. *i[34567]86-*-interix3*): Likewise. * config.host (i[34567]86-*-mingw32*): Set out_host_hook_obj. * config/i386/host-mingw32.c: New file. * config/i386/x-mingw32: Add rule for host-mingw32.o. * config/i386/winnt.c: (struct extern_list) Tag as GTY. (extern_head): Likewise. (struct export_list) Likewise. (export_head): Likewise. (i386_pe_record_external_function): Use ggc_alloc. (i386_pe_record_exported_symbol): Likewise. Include "gt-winnt.h" at end. * doc/hostconfig.texi: Document HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY.
Attachment:
mingw32-pch-2.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |