samples upd

git-svn-id: svn://kolibrios.org@6460 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl
2016-07-09 19:44:55 +00:00
parent 92054a7816
commit 26c74ab3f2
7 changed files with 175 additions and 17 deletions

View File

@@ -4,5 +4,7 @@
#define TCC_TARGET_I386
#define ONE_SOURCE
//#define TCC_TARGET_COFF
//#define COMMIT_4ad186c5ef61_IS_FIXED
//#define CONFIG_TCC_BCHECK

View File

@@ -2126,6 +2126,12 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv)
int optind = 0;
ParseArgsState *pas = s->parse_args_state;
/*
#ifdef TCC_TARGET_MEOS
// siemargl testing
s->output_format = TCC_OUTPUT_FORMAT_COFF;
#endif
*/
while (optind < argc) {
r = argv[optind++];

View File

@@ -61,7 +61,7 @@ errno.h - in stdio
limits.h
locale.h
setjmp.h
signall.h
signal.h
time.h - can use get_tick_count()/100 from kos32sys1.h
wchar.h
wctype.h
@@ -70,14 +70,6 @@ wctype.h
functions absent list:
math.h
frexp
ldexp
modf
fmod
HUGE_VAL
stdio.h:
remove
rename

View File

@@ -348,6 +348,11 @@ static inline void write64le(unsigned char *p, uint64_t x)
/* -------------------------------------------- */
/* include the target specific definitions */
#ifdef TCC_TARGET_COFF
# include "coff.h"
#endif
#define TARGET_DEFS_ONLY
#ifdef TCC_TARGET_I386
# include "i386-gen.c"
@@ -362,7 +367,6 @@ static inline void write64le(unsigned char *p, uint64_t x)
# include "arm64-gen.c"
#endif
#ifdef TCC_TARGET_C67
# include "coff.h"
# include "c67-gen.c"
#endif
#undef TARGET_DEFS_ONLY

View File

@@ -876,35 +876,35 @@ ST_FUNC int tcc_load_coff(TCCState * s1, int fd)
}
if (fread(&file_hdr, FILHSZ, 1, f) != 1)
tcc_error("error reading .out file for input");
tcc_error("error 1 reading .out file for input");
if (fread(&o_filehdr, sizeof(o_filehdr), 1, f) != 1)
tcc_error("error reading .out file for input");
tcc_error("error 2 reading .out file for input");
// first read the string table
if (fseek(f, file_hdr.f_symptr + file_hdr.f_nsyms * SYMESZ, SEEK_SET))
tcc_error("error reading .out file for input");
tcc_error("error 3 reading .out file for input");
if (fread(&str_size, sizeof(int), 1, f) != 1)
tcc_error("error reading .out file for input");
tcc_error("error 4 reading .out file for input");
Coff_str_table = (char *) tcc_malloc(str_size);
if (fread(Coff_str_table, str_size - 4, 1, f) != 1)
tcc_error("error reading .out file for input");
tcc_error("error 5 reading .out file for input");
// read/process all the symbols
// seek back to symbols
if (fseek(f, file_hdr.f_symptr, SEEK_SET))
tcc_error("error reading .out file for input");
tcc_error("error 6 reading .out file for input");
for (i = 0; i < file_hdr.f_nsyms; i++) {
if (fread(&csym, SYMESZ, 1, f) != 1)
tcc_error("error reading .out file for input");
tcc_error("error 7 reading .out file for input");
if (csym._n._n_n._n_zeroes == 0) {
name = Coff_str_table + csym._n._n_n._n_offset - 4;