Please take a look at the flow I summarized bellow:
main()
..............................................
=>
tcc_new() --> tcc_parse_args() --> tcc_set_environment(s) -->
[exec_other_tcc(s, argv, s->option_m) ("-m" option not in help,
and some other options in "TCCOption tcc_options[]" not in help) -->]
tcc_set_output_type() (if "print-search-dirs" is set, return)-->
/* compile or add each files or library */
tcc_add_library() (for each "-l") or tcc_add_file() (for other files) -->
tcc_print_stats() (if "bench") -->
tcc_run() (if "-run") or ( tcc_output_file() (normal) [-->
gen_makedeps()] )
-->|tcc_delete(s)
..............................................
=>
(tccelf.c) tcc_output_file() --> elf_output_file() (NOT target PE) or
(tccpe.c) pe_output_file() --> pe_add_runtime() (unicode_mode and
pe->type) --reset-by--> s1->pe_subsystem
..............................................
=>
(tccpe.c) pe_add_runtime (Here assign ENTRY) --->
(libtcc.c) tcc_add_library ---> tcc_add_library_internal --->
tcc_add_file_internal --->
(tccelf.c) [tcc_load_archive --->] tcc_load_object_file --->| add_elf_sym
..............................................
And where "tcc_state->unicode_entry" is used in "gen_function()",
it should be in 'tcc_add_library() (for each "-l") or
tcc_add_file() (for other files)'.
So, this is you mean before "pe_add_runtime (Here assign ENTRY)".
Am I at the point?
If so, the patch should be more simple. Just keep a local
flag "unicode_entry" in "pe_add_runtime()" for PE platform only,
and delete the global one in "tcc.h" and it's operation in "libtcc.c"
and "tccgen.c".
Or it will be much more complicated, just to bench one special
function's generation.
I prefer the former. :p
Attach the new patch.
BTW:
Something else I have doubt, but let's keep to the subject.
------------------------------------------------------------
tcc.c:269:
if (s->print_search_dirs || (s->verbose == 2 && optind == 1)) {
tcc_set_output_type(s, TCC_OUTPUT_MEMORY); <--- ?
display_info(s, 1);
return 0;
}
tcc.c:303: tcc_set_output_type(s, s->output_type);
Doesn't it try to do "tcc_add_sysinclude_path()",
"tcc_add_library_path()", "tcc_add_systemdir()/tcc_add_crt()"
and 'benching and debugging' preparation?
So, the function name is not meaningful, isn't it?
Here 'tcc_add_crt(s, "crti.o")' is found.
------------------------------------------------------------
CMakeList.txt and Makefile not touched, and will work as before.
Regards,
YX
------------------------------------------------------------------------
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel