tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Win: Add Unicode support for _tmain and _tWinMain


From: YX Hao
Subject: Re: [Tinycc-devel] Win: Add Unicode support for _tmain and _tWinMain
Date: Sat, 16 Aug 2014 14:27:09 +0800

From: "grischka" <address@hidden>


YX Hao wrote:
- "s->unicode_entry" is used (in compilation) before it is set
  (in the link phase).

It passed. Can you explain what do you mean?

I mean it is like

   x = 0;
   if (x == 17)
       do_something();
   if (foo)
       x = 17;

It does ... nothing.

OK. I didn't know very well for tcc's every details. 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

Attachment: commit-Unicode-suport-lite.pathc
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]