diff --git a/programs/develop/ktcc/trunk/kx/doc/en/Features.txt b/programs/develop/ktcc/trunk/kx/doc/en/Features.txt new file mode 100644 index 0000000000..dca0dd2c88 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/doc/en/Features.txt @@ -0,0 +1,21 @@ + ++ Library autoload + Now you don't need to think about having to load dependent libraries. + The most of this work will be done by TCC and Dll.obj + ++ Easy linking using *.def files + All you need to do is connect the files describing the symbols + of the used libraries. This files have plain text format and may + easy created in any text editor. If one or more libraries use the same + symbols you may use name prefix to solve symbols conflicts + No more complicated of creating *.o and/or *.a files + ++ Reduced image size + Since the library loader no longer needs to be placed in every application, + this reduces the size of the image. No more C layer neded, all dependent + libraries loading and also initialized automatically. + The compact format of the import table is also used. + ++ Backward compatible + You don't need change your project. But the features described above will + require reconfiguration. Once you have tried it, you do not want to come back. \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/doc/en/How to use.txt b/programs/develop/ktcc/trunk/kx/doc/en/How to use.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/programs/develop/ktcc/trunk/kx/doc/ru/Features.txt b/programs/develop/ktcc/trunk/kx/doc/ru/Features.txt new file mode 100644 index 0000000000..1d7178eaff --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/doc/ru/Features.txt @@ -0,0 +1,30 @@ + +Версия расширения KX - 0.4.3 + +Обзор новых возможностей + + + Автозагрузка библиотек + Теперь Вам не нужно думать о загрузке зависимых библиотек. + Большая часть этой работы будет сделана TCC и Dll.obj. + + + Простое связывание с использованием *.def файлов + Все, что Вам нужно сделать, это подключить файлы с описанием символов + используемых библиотек. Эти файлы имеют простой текстовый формат и могут + легко создаваться в любом текстовом редакторе. Если одна или несколько + библиотек используют один или более одинаковых символов, Вы можете + использовать префикс имени для разрешения конфликтов символов. + Больше не нужно создавать и подключать сложные *.o и/или *.a файлы + зависимых бибилиотек (исключение - файлы crt0.o и libtcc.a, но они + поставляются в комлекте). + + + Уменьшенный размер образа + Поскольку загрузчик библиотек больше не нужно размещать в каждом + приложении, это уменьшает размер образа. Больше не нужен слой C + (C layer), все зависимые библиотеки загружаются, а также инициализируются + автоматически. Также используется компактный формат таблицы импорта. + + + Обратная совместимость + Если Вы по каким то причинам не хотите, либо пока не готовы использовать + новые возможности, изменять настройки проекта не требуется. Все будет + работать как раньше. Но для использования описанных выше особенностей + требуется несложная перенастройка проекта. \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/doc/ru/History.txt b/programs/develop/ktcc/trunk/kx/doc/ru/History.txt new file mode 100644 index 0000000000..103d0707b9 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/doc/ru/History.txt @@ -0,0 +1,9 @@ + +0.4.4 + + + + , + + +0.4.3 + , + tcc \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/doc/ru/How to use.txt b/programs/develop/ktcc/trunk/kx/doc/ru/How to use.txt new file mode 100644 index 0000000000..fbcb671f07 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/doc/ru/How to use.txt @@ -0,0 +1,98 @@ + + + KX + tcc.conf tcc + + %ktcc_root%\ %ktcc_root%\kx. + + lib + *.def, crt.0 libtcc.a + + + KX + . , + . , + + + -llibc + + tcc : libc.def, liblibc.def, liblibc.a + , + . , + KX + *.def + + tcc (. tcc) + : + -nobss , ( + bss , + + ) + + + KX (*.def). *.def + + . *.def . + + ; + ; + ; LIBRARY + ; c ( 3 ) + LIBRARY libname.obj + + ; EXPORTS + ; prefix + EXPORTS [prefix] + + ; prefix, + ; ( ) + ; . + ; , http.obj http_ + ; http_get get + [libname_]entry1 + [libname_]entry2 + + ; + + KX + , tcc KX: + 1. + tcc -v + , KX + tcc version 0.9.26 (i386 KolibriOS/KX extension) + + 2. + __KX__, + #ifdef __KX__ + // KX + #else + // , KX + #endif + + , , + KX. + , + . + + . + + + , + KX, , + , + . + KX. + + ... + + #ifdef _C_LAYER + // KX + / + if(!kolibri_libimg_init()){ // libimg.obj + notify_show("Libimg.obj not loaded!' -E"); + exit(0); + } + #endif + + ... + \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/lib/box.def b/programs/develop/ktcc/trunk/kx/lib/box.def new file mode 100644 index 0000000000..a2f3cccce5 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/box.def @@ -0,0 +1,98 @@ +LIBRARY box_lib.obj + +EXPORTS +edit_box +edit_box_key +edit_box_mouse +edit_box_set_text +version_ed +init_checkbox2 +check_box_draw2 +check_box_mouse2 +version_ch2 +option_box_draw +option_box_mouse +version_op +scrollbar_v_draw +scrollbar_v_mouse +scrollbar_h_draw +scrollbar_h_mouse +version_scrollbar +dbutton_draw +dbutton_mouse +version_dbutton +menu_bar_draw +menu_bar_mouse +menu_bar_activate +version_menu_bar +FileBrowser_draw +FileBrowser_mouse +FileBrowser_key +version_FileBrowser +tl_data_init +tl_data_clear +tl_info_clear +tl_key +tl_mouse +tl_draw +tl_info_undo +tl_info_redo +tl_node_add +tl_node_set_data +tl_node_get_data +tl_node_delete +tl_cur_beg +tl_cur_next +tl_cur_perv +tl_node_close_open +tl_node_lev_inc +tl_node_lev_dec +tl_node_move_up +tl_node_move_down +tl_node_poi_get_info +tl_node_poi_get_next_info +tl_node_poi_get_data +tl_save_mem +tl_load_mem +tl_get_mem_size +version_tree_list +PathShow_prepare +PathShow_draw +version_PathShow +ted_but_sumb_upper +ted_but_sumb_lover +ted_but_convert_by_table +ted_can_save +ted_clear +ted_delete +ted_draw +ted_init +ted_init_scroll_bars +ted_init_syntax_file +ted_is_select +ted_key +ted_mouse +ted_open_file +ted_save_file +ted_text_add +ted_but_select_word +ted_but_cut +ted_but_copy +ted_but_paste +ted_but_undo +ted_but_redo +ted_but_reverse +ted_but_find +ted_but_replace +ted_text_colored +ted_go_to_position +version_text_edit +frame_draw +version_frame +progressbar_draw +progressbar_progress +tooltip_init +tooltip_delete +tooltip_test_show +tooltip_mouse +get_font_size diff --git a/programs/develop/ktcc/trunk/kx/lib/console.def b/programs/develop/ktcc/trunk/kx/lib/console.def new file mode 100644 index 0000000000..c1de63d2a2 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/console.def @@ -0,0 +1,25 @@ +LIBRARY console.obj + +EXPORTS +;START +con_init +con_write_asciiz +con_write_string +con_printf +con_exit +;version +con_get_flags +con_set_flags +con_kbhit +con_getch +con_getch2 +con_gets +con_gets2 +con_get_font_height +con_get_cursor_height +con_set_cursor_height +con_cls +con_get_cursor_pos +con_set_cursor_pos +con_set_title +con_get_input \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/lib/crt0.o b/programs/develop/ktcc/trunk/kx/lib/crt0.o new file mode 100644 index 0000000000..b857c80565 Binary files /dev/null and b/programs/develop/ktcc/trunk/kx/lib/crt0.o differ diff --git a/programs/develop/ktcc/trunk/kx/lib/dialog.def b/programs/develop/ktcc/trunk/kx/lib/dialog.def new file mode 100644 index 0000000000..eac5819e3a --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/dialog.def @@ -0,0 +1,14 @@ +LIBRARY proc_lib.obj + +EXPORTS +ColorDialog_init +OpenDialog_start +OpenDialog_init +OpenDialog_set_file_ext +OpenDialog_set_file_name +OpenDialog_start +Version_OpenDialog +Version_ColorDialog + +;EXPORTS prefix +;proc_lib_version <<= need local (2x underscores) diff --git a/programs/develop/ktcc/trunk/kx/lib/http.def b/programs/develop/ktcc/trunk/kx/lib/http.def new file mode 100644 index 0000000000..cdb14b8f1e --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/http.def @@ -0,0 +1,9 @@ +LIBRARY http.obj + +EXPORTS prefix +http_get +http_head +http_post +http_receive +http_send +http_free diff --git a/programs/develop/ktcc/trunk/kx/lib/img.def b/programs/develop/ktcc/trunk/kx/lib/img.def new file mode 100644 index 0000000000..857a64cd0f --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/img.def @@ -0,0 +1,20 @@ +LIBRARY libimg.obj + +EXPORTS +img_blend +img_convert +img_count +img_create +img_decode +img_destroy +img_destroy_layer +img_draw +img_encode +img_flip +img_flip_layer +img_resize_data +img_rotate +img_rotate_layer +img_scale +img_to_rgb +img_to_rgb2 \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/lib/libc.def b/programs/develop/ktcc/trunk/kx/lib/libc.def new file mode 100644 index 0000000000..c36e2999fd --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/libc.def @@ -0,0 +1,177 @@ +LIBRARY libc.obj + +EXPORTS +;____STDIO______ +clearerr +debug_printf +fclose +feof +ferror +fflush +fgetc +fgetpos +fgets +fopen +fprintf +fputc +fputs +fread +freopen +fscanf +fseek +fsetpos +ftell +fwrite +getchar +gets +perror +printf +puts +remove +rename +rewind +scanf +setbuf +setvbuf +snprintf +sprintf +sscanf +tmpfile +tmpnam +vfscanf +vprintf +vfscanf +vsprintf +vsnprintf +vsscanf +ungetc +;____STDLIB____ +abs +atoi +atol +atoll +atof +calloc +exit +free +itoa +labs +llabs +malloc +realloc +strtol +srand +rand +qsort +strtod +__assert_fail +;____STRING____ +;memcpy +memchr +memcmp +!memmove +!memset +strncat +strchr +strcat +strcmp +strcoll +strcpy +strcspn +strdup +strerror +strlen +strncat +strncmp +strncpy +strrchr +strrev +strspn +strstr +strtok +strxfrm +_errno +;____SYS____ +closedir +opendir +readdir +rewinddir +seekdir +telldir +getcwd +mkdir +rmdir +setcwd +getcwd +;____SOCKET____ +socket +close +bind +listen +connect +accept +send +recv +setsockopt +socketpair +;____UNISTD____ +;____MATH____ +acosh +asinh +atanh +acosh +frexp +hypot +ldexp +sinh +tanh +acos +asin +atan +atan2 +ceil +cos +exp +fabs +floor +fmod +log +modf +modfl +pow +pow2 +pow10 +;____LONGJMP____ +longjmp +setjmp +;____CTYPE____ +__is +tolower +toupper +;___CONIO___ +con_set_title +con_init +con_init_opt +con_write_asciiz +con_write_string +con_printf +con_exit +con_get_flags +con_set_flags +con_kbhit +con_getch +con_getch2 +con_gets +con_gets2 +con_get_font_height +con_get_cursor_height +con_set_cursor_height +con_cls +con_get_cursor_pos +con_set_cursor_pos +;____TIME____ +mktime +time +localtime +asctime +difftime diff --git a/programs/develop/ktcc/trunk/kx/lib/libck.a b/programs/develop/ktcc/trunk/kx/lib/libck.a new file mode 100644 index 0000000000..96b3ff2ae4 Binary files /dev/null and b/programs/develop/ktcc/trunk/kx/lib/libck.a differ diff --git a/programs/develop/ktcc/trunk/kx/lib/libcryptal.a b/programs/develop/ktcc/trunk/kx/lib/libcryptal.a new file mode 100644 index 0000000000..59467f1660 Binary files /dev/null and b/programs/develop/ktcc/trunk/kx/lib/libcryptal.a differ diff --git a/programs/develop/ktcc/trunk/kx/lib/libtcc.a b/programs/develop/ktcc/trunk/kx/lib/libtcc.a new file mode 100644 index 0000000000..77e05da5e8 Binary files /dev/null and b/programs/develop/ktcc/trunk/kx/lib/libtcc.a differ diff --git a/programs/develop/ktcc/trunk/kx/lib/mbedtls.def b/programs/develop/ktcc/trunk/kx/lib/mbedtls.def new file mode 100644 index 0000000000..a39712c69b --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/mbedtls.def @@ -0,0 +1,751 @@ +LIBRARY mbedtls.obj + +EXPORTS +mbedtls_aes_crypt_cbc +mbedtls_aes_crypt_cfb128 +mbedtls_aes_crypt_cfb8 +mbedtls_aes_crypt_ctr +mbedtls_aes_crypt_ecb +mbedtls_aes_crypt_ofb +mbedtls_aes_crypt_xts +mbedtls_aes_decrypt +mbedtls_aes_encrypt +mbedtls_aes_free +mbedtls_aes_init +mbedtls_aes_self_test +mbedtls_aes_setkey_dec +mbedtls_aes_setkey_enc +mbedtls_aes_xts_free +mbedtls_aes_xts_init +mbedtls_aes_xts_setkey_dec +mbedtls_aes_xts_setkey_enc +mbedtls_arc4_crypt +mbedtls_arc4_free +mbedtls_arc4_init +mbedtls_arc4_self_test +mbedtls_arc4_setup +mbedtls_asn1_find_named_data +mbedtls_asn1_free_named_data +mbedtls_asn1_free_named_data_list +mbedtls_asn1_get_alg +mbedtls_asn1_get_alg_null +mbedtls_asn1_get_bitstring +mbedtls_asn1_get_bitstring_null +mbedtls_asn1_get_bool +mbedtls_asn1_get_int +mbedtls_asn1_get_len +mbedtls_asn1_get_mpi +mbedtls_asn1_get_sequence_of +mbedtls_asn1_get_tag +mbedtls_asn1_store_named_data +mbedtls_asn1_write_algorithm_identifier +mbedtls_asn1_write_bitstring +mbedtls_asn1_write_bool +mbedtls_asn1_write_ia5_string +mbedtls_asn1_write_int +mbedtls_asn1_write_len +mbedtls_asn1_write_mpi +mbedtls_asn1_write_null +mbedtls_asn1_write_octet_string +mbedtls_asn1_write_oid +mbedtls_asn1_write_printable_string +mbedtls_asn1_write_raw_buffer +mbedtls_asn1_write_tag +mbedtls_asn1_write_tagged_string +mbedtls_asn1_write_utf8_string +mbedtls_base64_decode +mbedtls_base64_encode +mbedtls_base64_self_test +mbedtls_blowfish_crypt_cbc +mbedtls_blowfish_crypt_cfb64 +mbedtls_blowfish_crypt_ctr +mbedtls_blowfish_crypt_ecb +mbedtls_blowfish_free +mbedtls_blowfish_init +mbedtls_blowfish_setkey +mbedtls_camellia_crypt_cbc +mbedtls_camellia_crypt_cfb128 +mbedtls_camellia_crypt_ctr +mbedtls_camellia_crypt_ecb +mbedtls_camellia_free +mbedtls_camellia_init +mbedtls_camellia_self_test +mbedtls_camellia_setkey_dec +mbedtls_camellia_setkey_enc +mbedtls_ccm_auth_decrypt +mbedtls_ccm_encrypt_and_tag +mbedtls_ccm_free +mbedtls_ccm_init +mbedtls_ccm_self_test +mbedtls_ccm_setkey +mbedtls_ccm_star_auth_decrypt +mbedtls_ccm_star_encrypt_and_tag +mbedtls_chacha20_crypt +mbedtls_chacha20_free +mbedtls_chacha20_init +mbedtls_chacha20_self_test +mbedtls_chacha20_setkey +mbedtls_chacha20_starts +mbedtls_chacha20_update +mbedtls_chachapoly_auth_decrypt +mbedtls_chachapoly_encrypt_and_tag +mbedtls_chachapoly_finish +mbedtls_chachapoly_free +mbedtls_chachapoly_init +mbedtls_chachapoly_self_test +mbedtls_chachapoly_setkey +mbedtls_chachapoly_starts +mbedtls_chachapoly_update +mbedtls_chachapoly_update_aad +mbedtls_cipher_auth_decrypt +mbedtls_cipher_auth_encrypt +mbedtls_cipher_check_tag +mbedtls_cipher_crypt +mbedtls_cipher_finish +mbedtls_cipher_free +mbedtls_cipher_info_from_string +mbedtls_cipher_info_from_type +mbedtls_cipher_info_from_values +mbedtls_cipher_init +mbedtls_cipher_list +mbedtls_cipher_reset +mbedtls_cipher_set_iv +mbedtls_cipher_setkey +mbedtls_cipher_set_padding_mode +mbedtls_cipher_setup +mbedtls_cipher_update +mbedtls_cipher_update_ad +mbedtls_cipher_write_tag +mbedtls_ctr_drbg_free +mbedtls_ctr_drbg_init +mbedtls_ctr_drbg_random +mbedtls_ctr_drbg_random_with_add +mbedtls_ctr_drbg_reseed +mbedtls_ctr_drbg_seed +mbedtls_ctr_drbg_seed_entropy_len +mbedtls_ctr_drbg_self_test +mbedtls_ctr_drbg_set_entropy_len +mbedtls_ctr_drbg_set_prediction_resistance +mbedtls_ctr_drbg_set_reseed_interval +mbedtls_ctr_drbg_update +mbedtls_ctr_drbg_update_ret +mbedtls_debug_print_buf +mbedtls_debug_print_crt +mbedtls_debug_print_ecp +mbedtls_debug_printf_ecdh +mbedtls_debug_print_mpi +mbedtls_debug_print_msg +mbedtls_debug_print_ret +mbedtls_debug_set_threshold +mbedtls_des3_crypt_cbc +mbedtls_des3_crypt_ecb +mbedtls_des3_free +mbedtls_des3_init +mbedtls_des3_set2key_dec +mbedtls_des3_set2key_enc +mbedtls_des3_set3key_dec +mbedtls_des3_set3key_enc +mbedtls_des_crypt_cbc +mbedtls_des_crypt_ecb +mbedtls_des_free +mbedtls_des_init +mbedtls_des_key_check_key_parity +mbedtls_des_key_check_weak +mbedtls_des_key_set_parity +mbedtls_des_self_test +mbedtls_des_setkey +mbedtls_des_setkey_dec +mbedtls_des_setkey_enc +mbedtls_dhm_calc_secret +mbedtls_dhm_free +mbedtls_dhm_init +mbedtls_dhm_make_params +mbedtls_dhm_make_public +mbedtls_dhm_parse_dhm +mbedtls_dhm_read_params +mbedtls_dhm_read_public +mbedtls_dhm_self_test +mbedtls_dhm_set_group +mbedtls_ecdh_calc_secret +mbedtls_ecdh_compute_shared +mbedtls_ecdh_free +mbedtls_ecdh_gen_public +mbedtls_ecdh_get_params +mbedtls_ecdh_init +mbedtls_ecdh_make_params +mbedtls_ecdh_make_public +mbedtls_ecdh_read_params +mbedtls_ecdh_read_public +mbedtls_ecdh_setup +mbedtls_ecdsa_free +mbedtls_ecdsa_from_keypair +mbedtls_ecdsa_genkey +mbedtls_ecdsa_init +mbedtls_ecdsa_read_signature +mbedtls_ecdsa_read_signature_restartable +mbedtls_ecdsa_sign +mbedtls_ecdsa_sign_det +mbedtls_ecdsa_sign_det_ext +mbedtls_ecdsa_verify +mbedtls_ecdsa_write_signature +mbedtls_ecdsa_write_signature_det +mbedtls_ecdsa_write_signature_restartable +mbedtls_ecp_check_privkey +mbedtls_ecp_check_pubkey +mbedtls_ecp_check_pub_priv +mbedtls_ecp_copy +mbedtls_ecp_curve_info_from_grp_id +mbedtls_ecp_curve_info_from_name +mbedtls_ecp_curve_info_from_tls_id +mbedtls_ecp_curve_list +mbedtls_ecp_gen_key +mbedtls_ecp_gen_keypair +mbedtls_ecp_gen_keypair_base +mbedtls_ecp_gen_privkey +mbedtls_ecp_group_copy +mbedtls_ecp_group_free +mbedtls_ecp_group_init +mbedtls_ecp_group_load +mbedtls_ecp_grp_id_list +mbedtls_ecp_is_zero +mbedtls_ecp_keypair_free +mbedtls_ecp_keypair_init +mbedtls_ecp_mul +mbedtls_ecp_muladd +mbedtls_ecp_muladd_restartable +mbedtls_ecp_mul_restartable +mbedtls_ecp_point_cmp +mbedtls_ecp_point_free +mbedtls_ecp_point_init +mbedtls_ecp_point_read_binary +mbedtls_ecp_point_read_string +mbedtls_ecp_point_write_binary +mbedtls_ecp_self_test +mbedtls_ecp_set_zero +mbedtls_ecp_tls_read_group +mbedtls_ecp_tls_read_group_id +mbedtls_ecp_tls_read_point +mbedtls_ecp_tls_write_group +mbedtls_ecp_tls_write_point +mbedtls_entropy_add_source +mbedtls_entropy_free +mbedtls_entropy_func +mbedtls_entropy_gather +mbedtls_entropy_init +mbedtls_entropy_self_test +mbedtls_entropy_update_manual +mbedtls_gcm_auth_decrypt +mbedtls_gcm_crypt_and_tag +mbedtls_gcm_finish +mbedtls_gcm_free +mbedtls_gcm_init +mbedtls_gcm_self_test +mbedtls_gcm_setkey +mbedtls_gcm_starts +mbedtls_gcm_update +mbedtls_hkdf +mbedtls_hkdf_expand +mbedtls_hkdf_extract +mbedtls_hmac_drbg_free +mbedtls_hmac_drbg_init +mbedtls_hmac_drbg_random +mbedtls_hmac_drbg_random_with_add +mbedtls_hmac_drbg_reseed +mbedtls_hmac_drbg_seed +mbedtls_hmac_drbg_seed_buf +mbedtls_hmac_drbg_self_test +mbedtls_hmac_drbg_set_entropy_len +mbedtls_hmac_drbg_set_prediction_resistance +mbedtls_hmac_drbg_set_reseed_interval +mbedtls_hmac_drbg_update +mbedtls_hmac_drbg_update_ret +mbedtls_init +mbedtls_internal_aes_decrypt +mbedtls_internal_aes_encrypt +mbedtls_internal_md5_process +mbedtls_internal_ripemd160_process +mbedtls_internal_sha1_process +mbedtls_internal_sha256_process +mbedtls_internal_sha512_process +mbedtls_md +mbedtls_md5 +mbedtls_md5_clone +mbedtls_md5_finish +mbedtls_md5_finish_ret +mbedtls_md5_free +mbedtls_md5_init +mbedtls_md5_process +mbedtls_md5_ret +mbedtls_md5_self_test +mbedtls_md5_starts +mbedtls_md5_starts_ret +mbedtls_md5_update +mbedtls_md5_update_ret +mbedtls_md_clone +mbedtls_md_finish +mbedtls_md_free +mbedtls_md_get_name +mbedtls_md_get_size +mbedtls_md_get_type +mbedtls_md_hmac +mbedtls_md_hmac_finish +mbedtls_md_hmac_reset +mbedtls_md_hmac_starts +mbedtls_md_hmac_update +mbedtls_md_info_from_string +mbedtls_md_info_from_type +mbedtls_md_init +mbedtls_md_init_ctx +mbedtls_md_list +mbedtls_md_process +mbedtls_md_setup +mbedtls_md_starts +mbedtls_md_update +mbedtls_mpi_add_abs +mbedtls_mpi_add_int +mbedtls_mpi_add_mpi +mbedtls_mpi_bitlen +mbedtls_mpi_cmp_abs +mbedtls_mpi_cmp_int +mbedtls_mpi_cmp_mpi +mbedtls_mpi_copy +mbedtls_mpi_div_int +mbedtls_mpi_div_mpi +mbedtls_mpi_exp_mod +mbedtls_mpi_fill_random +mbedtls_mpi_free +mbedtls_mpi_gcd +mbedtls_mpi_gen_prime +mbedtls_mpi_get_bit +mbedtls_mpi_grow +mbedtls_mpi_init +mbedtls_mpi_inv_mod +mbedtls_mpi_is_prime +mbedtls_mpi_is_prime_ext +mbedtls_mpi_lsb +mbedtls_mpi_lset +mbedtls_mpi_lt_mpi_ct +mbedtls_mpi_mod_int +mbedtls_mpi_mod_mpi +mbedtls_mpi_mul_int +mbedtls_mpi_mul_mpi +mbedtls_mpi_read_binary +mbedtls_mpi_read_string +mbedtls_mpi_safe_cond_assign +mbedtls_mpi_safe_cond_swap +mbedtls_mpi_self_test +mbedtls_mpi_set_bit +mbedtls_mpi_shift_l +mbedtls_mpi_shift_r +mbedtls_mpi_shrink +mbedtls_mpi_size +mbedtls_mpi_sub_abs +mbedtls_mpi_sub_int +mbedtls_mpi_sub_mpi +mbedtls_mpi_swap +mbedtls_mpi_write_binary +mbedtls_mpi_write_string +mbedtls_net_connect +mbedtls_net_free +mbedtls_net_init +mbedtls_net_recv +mbedtls_net_send +mbedtls_oid_get_attr_short_name +mbedtls_oid_get_cipher_alg +mbedtls_oid_get_ec_grp +mbedtls_oid_get_extended_key_usage +mbedtls_oid_get_md_alg +mbedtls_oid_get_md_hmac +mbedtls_oid_get_numeric_string +mbedtls_oid_get_oid_by_ec_grp +mbedtls_oid_get_oid_by_md +mbedtls_oid_get_oid_by_pk_alg +mbedtls_oid_get_oid_by_sig_alg +mbedtls_oid_get_pk_alg +mbedtls_oid_get_pkcs12_pbe_alg +mbedtls_oid_get_sig_alg +mbedtls_oid_get_sig_alg_desc +mbedtls_oid_get_x509_ext_type +mbedtls_padlock_has_support +mbedtls_padlock_xcryptcbc +mbedtls_padlock_xcryptecb +mbedtls_pem_free +mbedtls_pem_init +mbedtls_pem_read_buffer +mbedtls_pem_write_buffer +mbedtls_pk_can_do +mbedtls_pk_check_pair +mbedtls_pkcs12_derivation +mbedtls_pkcs12_pbe +mbedtls_pkcs12_pbe_sha1_rc4_128 +mbedtls_pkcs5_pbes2 +mbedtls_pkcs5_pbkdf2_hmac +mbedtls_pkcs5_self_test +mbedtls_pk_debug +mbedtls_pk_decrypt +mbedtls_pk_encrypt +mbedtls_pk_free +mbedtls_pk_get_bitlen +mbedtls_pk_get_name +mbedtls_pk_get_type +mbedtls_pk_info_from_type +mbedtls_pk_init +mbedtls_pk_parse_key +mbedtls_pk_parse_public_key +mbedtls_pk_parse_subpubkey +mbedtls_pk_setup +mbedtls_pk_setup_rsa_alt +mbedtls_pk_sign +mbedtls_pk_sign_restartable +mbedtls_pk_verify +mbedtls_pk_verify_ext +mbedtls_pk_verify_restartable +mbedtls_pk_write_key_der +mbedtls_pk_write_key_pem +mbedtls_pk_write_pubkey +mbedtls_pk_write_pubkey_der +mbedtls_pk_write_pubkey_pem +mbedtls_platform_gmtime_r +mbedtls_platform_setup +mbedtls_platform_teardown +mbedtls_platform_zeroize +mbedtls_poly1305_finish +mbedtls_poly1305_free +mbedtls_poly1305_init +mbedtls_poly1305_mac +mbedtls_poly1305_self_test +mbedtls_poly1305_starts +mbedtls_poly1305_update +mbedtls_ripemd160 +mbedtls_ripemd160_clone +mbedtls_ripemd160_finish +mbedtls_ripemd160_finish_ret +mbedtls_ripemd160_free +mbedtls_ripemd160_init +mbedtls_ripemd160_process +mbedtls_ripemd160_ret +mbedtls_ripemd160_self_test +mbedtls_ripemd160_starts +mbedtls_ripemd160_starts_ret +mbedtls_ripemd160_update +mbedtls_ripemd160_update_ret +mbedtls_rsa_check_privkey +mbedtls_rsa_check_pubkey +mbedtls_rsa_check_pub_priv +mbedtls_rsa_complete +mbedtls_rsa_copy +mbedtls_rsa_deduce_crt +mbedtls_rsa_deduce_primes +mbedtls_rsa_deduce_private_exponent +mbedtls_rsa_export +mbedtls_rsa_export_crt +mbedtls_rsa_export_raw +mbedtls_rsa_free +mbedtls_rsa_gen_key +mbedtls_rsa_get_len +mbedtls_rsa_import +mbedtls_rsa_import_raw +mbedtls_rsa_init +mbedtls_rsa_pkcs1_decrypt +mbedtls_rsa_pkcs1_encrypt +mbedtls_rsa_pkcs1_sign +mbedtls_rsa_pkcs1_verify +mbedtls_rsa_private +mbedtls_rsa_public +mbedtls_rsa_rsaes_oaep_decrypt +mbedtls_rsa_rsaes_oaep_encrypt +mbedtls_rsa_rsaes_pkcs1_v15_decrypt +mbedtls_rsa_rsaes_pkcs1_v15_encrypt +mbedtls_rsa_rsassa_pkcs1_v15_sign +mbedtls_rsa_rsassa_pkcs1_v15_verify +mbedtls_rsa_rsassa_pss_sign +mbedtls_rsa_rsassa_pss_verify +mbedtls_rsa_rsassa_pss_verify_ext +mbedtls_rsa_self_test +mbedtls_rsa_set_padding +mbedtls_rsa_validate_crt +mbedtls_rsa_validate_params +mbedtls_sha1 +mbedtls_sha1_clone +mbedtls_sha1_finish +mbedtls_sha1_finish_ret +mbedtls_sha1_free +mbedtls_sha1_init +mbedtls_sha1_process +mbedtls_sha1_ret +mbedtls_sha1_self_test +mbedtls_sha1_starts +mbedtls_sha1_starts_ret +mbedtls_sha1_update +mbedtls_sha1_update_ret +mbedtls_sha256 +mbedtls_sha256_clone +mbedtls_sha256_finish +mbedtls_sha256_finish_ret +mbedtls_sha256_free +mbedtls_sha256_init +mbedtls_sha256_process +mbedtls_sha256_ret +mbedtls_sha256_self_test +mbedtls_sha256_starts +mbedtls_sha256_starts_ret +mbedtls_sha256_update +mbedtls_sha256_update_ret +mbedtls_sha512 +mbedtls_sha512_clone +mbedtls_sha512_finish +mbedtls_sha512_finish_ret +mbedtls_sha512_free +mbedtls_sha512_init +mbedtls_sha512_process +mbedtls_sha512_ret +mbedtls_sha512_self_test +mbedtls_sha512_starts +mbedtls_sha512_starts_ret +mbedtls_sha512_update +mbedtls_sha512_update_ret +mbedtls_ssl_cache_free +mbedtls_ssl_cache_get +mbedtls_ssl_cache_init +mbedtls_ssl_cache_set +mbedtls_ssl_cache_set_max_entries +mbedtls_ssl_cache_set_timeout +mbedtls_ssl_check_cert_usage +mbedtls_ssl_check_curve +mbedtls_ssl_check_pending +mbedtls_ssl_check_sig_hash +mbedtls_ssl_ciphersuite_from_id +mbedtls_ssl_ciphersuite_from_string +mbedtls_ssl_ciphersuite_uses_ec +mbedtls_ssl_ciphersuite_uses_psk +mbedtls_ssl_close_notify +mbedtls_ssl_conf_alpn_protocols +mbedtls_ssl_conf_arc4_support +mbedtls_ssl_conf_authmode +mbedtls_ssl_conf_ca_chain +mbedtls_ssl_conf_cbc_record_splitting +mbedtls_ssl_conf_cert_profile +mbedtls_ssl_conf_cert_req_ca_list +mbedtls_ssl_conf_ciphersuites +mbedtls_ssl_conf_ciphersuites_for_version +mbedtls_ssl_conf_curves +mbedtls_ssl_conf_dbg +mbedtls_ssl_conf_dhm_min_bitlen +mbedtls_ssl_conf_dh_param +mbedtls_ssl_conf_dh_param_bin +mbedtls_ssl_conf_dh_param_ctx +mbedtls_ssl_conf_dtls_anti_replay +mbedtls_ssl_conf_dtls_badmac_limit +mbedtls_ssl_conf_dtls_cookies +mbedtls_ssl_conf_encrypt_then_mac +mbedtls_ssl_conf_endpoint +mbedtls_ssl_conf_export_keys_cb +mbedtls_ssl_conf_extended_master_secret +mbedtls_ssl_conf_fallback +mbedtls_ssl_conf_handshake_timeout +mbedtls_ssl_config_defaults +mbedtls_ssl_config_free +mbedtls_ssl_config_init +mbedtls_ssl_conf_legacy_renegotiation +mbedtls_ssl_conf_max_frag_len +mbedtls_ssl_conf_max_version +mbedtls_ssl_conf_min_version +mbedtls_ssl_conf_own_cert +mbedtls_ssl_conf_psk +mbedtls_ssl_conf_psk_cb +mbedtls_ssl_conf_read_timeout +mbedtls_ssl_conf_renegotiation +mbedtls_ssl_conf_renegotiation_enforced +mbedtls_ssl_conf_renegotiation_period +mbedtls_ssl_conf_rng +mbedtls_ssl_conf_session_cache +mbedtls_ssl_conf_session_tickets +mbedtls_ssl_conf_session_tickets_cb +mbedtls_ssl_conf_sig_hashes +mbedtls_ssl_conf_sni +mbedtls_ssl_conf_transport +mbedtls_ssl_conf_truncated_hmac +mbedtls_ssl_conf_verify +mbedtls_ssl_cookie_check +mbedtls_ssl_cookie_free +mbedtls_ssl_cookie_init +mbedtls_ssl_cookie_set_timeout +mbedtls_ssl_cookie_setup +mbedtls_ssl_cookie_write +mbedtls_ssl_derive_keys +mbedtls_ssl_dtls_replay_check +mbedtls_ssl_dtls_replay_update +mbedtls_ssl_fetch_input +mbedtls_ssl_flight_transmit +mbedtls_ssl_flush_output +mbedtls_ssl_free +mbedtls_ssl_get_alpn_protocol +mbedtls_ssl_get_bytes_avail +mbedtls_ssl_get_ciphersuite +mbedtls_ssl_get_ciphersuite_id +mbedtls_ssl_get_ciphersuite_name +mbedtls_ssl_get_ciphersuite_sig_alg +mbedtls_ssl_get_ciphersuite_sig_pk_alg +mbedtls_ssl_get_key_exchange_md_ssl_tls +mbedtls_ssl_get_key_exchange_md_tls1_2 +mbedtls_ssl_get_max_frag_len +mbedtls_ssl_get_max_out_record_payload +mbedtls_ssl_get_peer_cert +mbedtls_ssl_get_record_expansion +mbedtls_ssl_get_session +mbedtls_ssl_get_verify_result +mbedtls_ssl_get_version +mbedtls_ssl_handle_message_type +mbedtls_ssl_handshake +mbedtls_ssl_handshake_client_step +mbedtls_ssl_handshake_free +mbedtls_ssl_handshake_server_step +mbedtls_ssl_handshake_step +mbedtls_ssl_handshake_wrapup +mbedtls_ssl_hash_from_md_alg +mbedtls_ssl_init +mbedtls_ssl_list_ciphersuites +mbedtls_ssl_md_alg_from_hash +mbedtls_ssl_optimize_checksum +mbedtls_ssl_parse_certificate +mbedtls_ssl_parse_change_cipher_spec +mbedtls_ssl_parse_finished +mbedtls_ssl_pk_alg_from_sig +mbedtls_ssl_prepare_handshake_record +mbedtls_ssl_psk_derive_premaster +mbedtls_ssl_read +mbedtls_ssl_read_record +mbedtls_ssl_read_version +mbedtls_ssl_recv_flight_completed +mbedtls_ssl_renegotiate +mbedtls_ssl_resend +mbedtls_ssl_reset_checksum +mbedtls_ssl_send_alert_message +mbedtls_ssl_send_fatal_handshake_failure +mbedtls_ssl_send_flight_completed +mbedtls_ssl_session_free +mbedtls_ssl_session_init +mbedtls_ssl_session_reset +mbedtls_ssl_set_bio +mbedtls_ssl_set_calc_verify_md +mbedtls_ssl_set_client_transport_id +mbedtls_ssl_set_datagram_packing +mbedtls_ssl_set_hostname +mbedtls_ssl_set_hs_authmode +mbedtls_ssl_set_hs_ca_chain +mbedtls_ssl_set_hs_own_cert +mbedtls_ssl_set_hs_psk +mbedtls_ssl_set_mtu +mbedtls_ssl_set_session +mbedtls_ssl_set_timer_cb +mbedtls_ssl_setup +mbedtls_ssl_sig_from_pk +mbedtls_ssl_sig_from_pk_alg +mbedtls_ssl_sig_hash_set_add +mbedtls_ssl_sig_hash_set_const_hash +mbedtls_ssl_sig_hash_set_find +mbedtls_ssl_ticket_free +mbedtls_ssl_ticket_init +mbedtls_ssl_ticket_parse +mbedtls_ssl_ticket_setup +mbedtls_ssl_ticket_write +mbedtls_ssl_transform_free +mbedtls_ssl_update_handshake_status +mbedtls_ssl_write +mbedtls_ssl_write_certificate +mbedtls_ssl_write_change_cipher_spec +mbedtls_ssl_write_finished +mbedtls_ssl_write_handshake_msg +mbedtls_ssl_write_record +mbedtls_ssl_write_version +mbedtls_strerror +mbedtls_sysfn_14_poll +mbedtls_sysfn_18_4_poll +mbedtls_sysfn_26_9_poll +mbedtls_sysfn_37_0_poll +mbedtls_sysfn_3_poll +mbedtls_sysfn_66_3_poll +mbedtls_sysfn_68_0_poll +mbedtls_version_check_feature +mbedtls_version_get_number +mbedtls_version_get_string +mbedtls_version_get_string_full +mbedtls_x509_crl_free +mbedtls_x509_crl_info +mbedtls_x509_crl_init +mbedtls_x509_crl_parse +mbedtls_x509_crl_parse_der +mbedtls_x509_crt_check_extended_key_usage +mbedtls_x509_crt_check_key_usage +mbedtls_x509_crt_free +mbedtls_x509_crt_info +mbedtls_x509_crt_init +mbedtls_x509_crt_is_revoked +mbedtls_x509_crt_parse +mbedtls_x509_crt_parse_der +mbedtls_x509_crt_verify +mbedtls_x509_crt_verify_info +mbedtls_x509_crt_verify_restartable +mbedtls_x509_crt_verify_with_profile +mbedtls_x509_csr_free +mbedtls_x509_csr_info +mbedtls_x509_csr_init +mbedtls_x509_csr_parse +mbedtls_x509_csr_parse_der +mbedtls_x509_dn_gets +mbedtls_x509_get_alg +mbedtls_x509_get_alg_null +mbedtls_x509_get_ext +mbedtls_x509_get_name +mbedtls_x509_get_rsassa_pss_params +mbedtls_x509_get_serial +mbedtls_x509_get_sig +mbedtls_x509_get_sig_alg +mbedtls_x509_get_time +mbedtls_x509_key_size_helper +mbedtls_x509_self_test +mbedtls_x509_serial_gets +mbedtls_x509_set_extension +mbedtls_x509_sig_alg_gets +mbedtls_x509_string_to_names +mbedtls_x509_time_is_future +mbedtls_x509_time_is_past +mbedtls_x509write_crt_der +mbedtls_x509write_crt_free +mbedtls_x509write_crt_init +mbedtls_x509write_crt_pem +mbedtls_x509write_crt_set_authority_key_identifier +mbedtls_x509write_crt_set_basic_constraints +mbedtls_x509write_crt_set_extension +mbedtls_x509write_crt_set_issuer_key +mbedtls_x509write_crt_set_issuer_name +mbedtls_x509write_crt_set_key_usage +mbedtls_x509write_crt_set_md_alg +mbedtls_x509write_crt_set_ns_cert_type +mbedtls_x509write_crt_set_serial +mbedtls_x509write_crt_set_subject_key +mbedtls_x509write_crt_set_subject_key_identifier +mbedtls_x509write_crt_set_subject_name +mbedtls_x509write_crt_set_validity +mbedtls_x509write_crt_set_version +mbedtls_x509write_csr_der +mbedtls_x509write_csr_free +mbedtls_x509write_csr_init +mbedtls_x509write_csr_pem +mbedtls_x509write_csr_set_extension +mbedtls_x509write_csr_set_key +mbedtls_x509write_csr_set_key_usage +mbedtls_x509write_csr_set_md_alg +mbedtls_x509write_csr_set_ns_cert_type +mbedtls_x509write_csr_set_subject_name +mbedtls_x509_write_extensions +mbedtls_x509_write_names +mbedtls_x509_write_sig +mbedtls_xtea_crypt_cbc +mbedtls_xtea_crypt_ecb +mbedtls_xtea_free +mbedtls_xtea_init +mbedtls_xtea_self_test +mbedtls_xtea_setup +mbedtls_test_cas_pem +mbedtls_test_cas_pem_len diff --git a/programs/develop/ktcc/trunk/kx/lib/network.def b/programs/develop/ktcc/trunk/kx/lib/network.def new file mode 100644 index 0000000000..01cbab8264 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/lib/network.def @@ -0,0 +1,7 @@ +LIBRARY network.obj + +EXPORTS +inet_addr +inet_ntoa +getaddrinfo +freeaddrinfo \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/src/tests/kxtest.c b/programs/develop/ktcc/trunk/kx/src/tests/kxtest.c new file mode 100644 index 0000000000..f53e59a567 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/src/tests/kxtest.c @@ -0,0 +1,18 @@ +// +// This sample show that KX extension supported or not + +#include + +int main(){ + + char* kx_ext = +#ifndef __KX__ + "not " +#endif + "supported" + ; + + printf("KX extension %s", kx_ext); + + return 0; +} \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/kx/src/tests/kxtest.sh b/programs/develop/ktcc/trunk/kx/src/tests/kxtest.sh new file mode 100644 index 0000000000..94fb434702 --- /dev/null +++ b/programs/develop/ktcc/trunk/kx/src/tests/kxtest.sh @@ -0,0 +1,3 @@ +#SHS +../../../tcc ../src/tests/kxtest.c -o kxtest -I../../include -llibc +exit \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/source/libtcc.c b/programs/develop/ktcc/trunk/source/libtcc.c index 23a3ff3846..6577cf2e41 100644 --- a/programs/develop/ktcc/trunk/source/libtcc.c +++ b/programs/develop/ktcc/trunk/source/libtcc.c @@ -113,12 +113,17 @@ static void tcc_set_lib_path_w32(TCCState *s) { char path[1024], *p; GetModuleFileNameA(tcc_module, path, sizeof path); +#ifdef TCC_TARGET_KX + kx_fix_root_directory(path, sizeof path); + normalize_slashes(strlwr(path)); +#else p = tcc_basename(normalize_slashes(strlwr(path))); if (p - 5 > path && 0 == strncmp(p - 5, "/bin/", 5)) p -= 5; else if (p > path) p--; *p = 0; +#endif tcc_set_lib_path(s, path); } @@ -154,9 +159,13 @@ static void tcc_set_lib_path_kos(TCCState *s) char** argv0 = (char**)0x20; // path in kolibri header char path[1024], *p; strncpy(path, *argv0, sizeof path); +#ifdef TCC_TARGET_KX + kx_fix_root_directory(path, sizeof path); +#else p = tcc_basename(path); if (p > path) p--; *p = 0; +#endif tcc_set_lib_path(s, path); } @@ -165,7 +174,12 @@ static void tcc_set_lib_path_linux(TCCState *s) { char buff[4096+1]; readlink("/proc/self/exe", buff, 4096); +#ifdef TCC_TARGET_KX + kx_fix_root_directory(buff, sizeof buff); + const char *path = buff; +#else const char *path = dirname(buff); +#endif tcc_set_lib_path(s, path); } diff --git a/programs/develop/ktcc/trunk/source/tcc.h b/programs/develop/ktcc/trunk/source/tcc.h index 6f30943e82..16ef960787 100644 --- a/programs/develop/ktcc/trunk/source/tcc.h +++ b/programs/develop/ktcc/trunk/source/tcc.h @@ -47,6 +47,7 @@ #ifndef TCC_TARGET_MEOS #define TCC_TARGET_MEOS #endif +void kx_fix_root_directory(char *buf, size_t size); #endif #ifndef _WIN32 diff --git a/programs/develop/ktcc/trunk/source/tcckx.c b/programs/develop/ktcc/trunk/source/tcckx.c index d64841d4f7..86bb813973 100644 --- a/programs/develop/ktcc/trunk/source/tcckx.c +++ b/programs/develop/ktcc/trunk/source/tcckx.c @@ -34,7 +34,7 @@ typedef struct { /*union ImportEntry { uint32_t ImportStr; uint32_t ImportPrt; - };*/ +};*/ //static char __kx_import_table_sym[] = "__i_ptr__"; @@ -43,19 +43,21 @@ typedef struct { ElfW(Sym) *sym; int sym_index, sym_end; sym_end = symtab_section->data_offset / sizeof(ElfW(Sym)); + DLLReference **dllref = me->s1->loaded_dlls; CString *str_arr, *len_arr, *sym_arr; - char dll_len; + char dll_len; + int dll_loaded = me->s1->nb_loaded_dlls; int nlib = 0; int i; if (me->header.version != 2) return; - str_arr = tcc_malloc(sizeof(CString) * me->s1->nb_loaded_dlls); + str_arr = tcc_malloc(sizeof(CString) * dll_loaded); - len_arr = tcc_malloc(sizeof(CString)* me->s1->nb_loaded_dlls); - - sym_arr = tcc_malloc(sizeof(CString)* me->s1->nb_loaded_dlls); + len_arr = tcc_malloc(sizeof(CString)* dll_loaded); + + sym_arr = tcc_malloc(sizeof(CString)* dll_loaded); for (sym_index = 1; sym_index < sym_end; ++sym_index) { sym = (ElfW(Sym) *)symtab_section->data + sym_index; @@ -66,18 +68,13 @@ typedef struct { if (dynsym_index == 0) { //if (strcmp(name, __kx_import_table_sym) != 0) { tcc_error/*_noabort*/("undefined symbol '%s'", name); - //continue; // FIXME: stop compile! - //} - - //continue; } // KOS support 32 bit only Elf32_Sym* dyn_sym = &((ElfW(Sym) *)me->s1->dynsymtab_section->data)[dynsym_index]; - DLLReference **dllref = me->s1->loaded_dlls; - char* dll_name; - i = dyn_sym->st_size - 1; + char* dll_name; // TCC store dll index in dyn_sym->st_size field + i = dyn_sym->st_size - 1; if (dllref[i]->level != -1) { dll_name = dllref[i]->name; dll_len = strlen(dll_name) + 1; @@ -86,15 +83,15 @@ typedef struct { cstr_new(&str_arr[i]); cstr_new(&len_arr[i]); - cstr_new(&sym_arr[i]); + cstr_new(&sym_arr[i]); cstr_ccat(&len_arr[i], dll_len); cstr_cat(&str_arr[i], dll_name, dll_len); //Mark dll as already used dllref[i]->level = -1; } - - cstr_wccat(&sym_arr[i], (int)name); + + cstr_wccat(&sym_arr[i], (int)name); // Export defined with prefix? if (dyn_sym->st_value == -1){ @@ -114,6 +111,46 @@ typedef struct { //tcc_error(""); return; }*/ + + // Fixed BUG#15 (possible access to uninitialized due unused library) + // Exclude unused librarys + if (nlib < dll_loaded) { + i = 0; int j, n = 0; + do { + + // Find unused library + if (dllref[i]->level == 0) { + j = i + 1; + + while (j < dll_loaded) { + // Find first used library + if (dllref[j]->level == -1) { + // Found, copy i from j + str_arr[i] = str_arr[j]; + len_arr[i] = len_arr[j]; + sym_arr[i] = sym_arr[j]; + // Mark j as unused + dllref[j]->level = 0; + + if (++n == nlib) + goto __done; + + break; + } + + j++; + + } + + } + + i++; + + } while (i < dll_loaded); + + } + + __done: // Zero terminate of ptr (was BUG#3) i = 0; @@ -128,7 +165,7 @@ typedef struct { kx_import_table* imp_sect; imp_sect = tcc_mallocz(sizeof(kx_import_table)); - imp_sect->data = tcc_mallocz(1024); // FIXME!!! + imp_sect->data = tcc_mallocz(4096); // FIXME!!! I increased it to 4Kb, but steel need dynamicaly size imp_sect->data_size = 0; //imp_sect->sh_addr = me->header.image_size;// +1; @@ -147,6 +184,7 @@ typedef struct { // Align pad (check algorithm!) int align = 4 - (me->header.image_size + imp_sect->data_size) % 4; + align = align < 4 ? align : 0; imp_data += align; imp_sect->data_size += align; @@ -187,7 +225,7 @@ typedef struct { imp_sect->data_size += sizeof(LibraryEntry) + 4; const char *sym_name; - char name_len; + char name_len; long len_sum; len_sum = me->header.image_size; @@ -230,7 +268,7 @@ typedef struct { tcc_free(str_arr); tcc_free(len_arr); - tcc_free(sym_arr); + tcc_free(sym_arr); } @@ -246,11 +284,9 @@ typedef struct { break; } if ((sym_index < sym_end) && - // ... and user attached at last one *.def + // ... and user attached at least one *.def (me->s1->nb_loaded_dlls)) me->header.version = 2; - - //tcc_add_crt(me->s1, "start1.o"); } long kx_get_header_length(me_info* me) { @@ -277,4 +313,58 @@ typedef struct { tcc_free(imp->data); tcc_free(imp); } + } + +#if /*!*/defined(_DEBUG)// && !defined(_WIN32) + #define kx_debug_output printf +#else + #define kx_debug_output(s,p) ((void)0) +#endif + +/* + Calling once from tcc_set_lib_path_xxx + This function correct tcc_root if tcc_root/kx is a run directory, + otherwise do trim filename +*/ + void kx_fix_root_directory(char *buf, size_t size) { + + int defult = 1; + char* tcc_conf = tcc_malloc(strlen(buf)+5); + strcpy(tcc_conf, buf); + char* base = tcc_basename(tcc_conf); + *base = 0; + base = tcc_basename(buf); + strcat(tcc_conf, "tcc.conf"); + FILE* f = fopen(tcc_conf,"r"); + if (f) { + char line[100]; + while (fgets(line, sizeof line, f)){ + switch (*line) + case '#': + case '\n': + continue; + if ((strspn(line, "tcc_root") == 8) && line[8] == ' ') { + + if (strcmp(line + 9, "kx") == 0) { + strcpy(base, line + 9); + defult = 0; + } + else + { + // Disallow change tcc_root with arbitrary path + continue; + } + + } + } + + fclose(f); + } + if (defult) { + + *--base = 0; + } + + tcc_free(tcc_conf); + //kx_debug_output("tcc root = %s\n", buf); } \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/tcc.conf b/programs/develop/ktcc/trunk/tcc.conf new file mode 100644 index 0000000000..d2521e89cb --- /dev/null +++ b/programs/develop/ktcc/trunk/tcc.conf @@ -0,0 +1,5 @@ +# This configuration file for TCC behaviour +# (actually was added for on/off KX extension) + +# Change %ktcc_root%\ to %ktcc_root%\kx +tcc_root kx \ No newline at end of file