tcc能够运行,但是失败

This commit is contained in:
zhangzheng
2023-12-05 23:41:02 +08:00
parent f69119897d
commit 435707cc06
7 changed files with 54 additions and 52 deletions

View File

@@ -10,7 +10,7 @@
#include <assert.h>
static pthread_spinlock_t lock;
extern void *app_start_addr;
static umword_t mm_bitemp[32 /*TODO:自动分配,或者静态划分*/];
static umword_t mm_bitemp[256/*TODO:自动分配,或者静态划分*/];
static void *mm_page_alloc(int page_nr)
{
int cnt = 0;

View File

@@ -6,6 +6,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_STDPERIPH_DRIVER=1 -DTCC_TARGET_ARM \
file(GLOB deps
heap_stack.c
arm-asm.c
# arm-gen.c
arm-link.c

View File

@@ -1,5 +1,5 @@
#define HEAP_SIZE 1024*32
#define HEAP_SIZE 1024*1024*4
#define STACK_SIZE 4096
#if defined(__CC_ARM)

View File

@@ -257,55 +257,56 @@ redo:
s = tcc_new();
opt = tcc_parse_args(s, &argc, &argv, 1);
if ((n | t) == 0) {
if (opt == OPT_HELP)
return printf(help), 1;
if (opt == OPT_HELP2)
return printf(help2), 1;
if (opt == OPT_M32 || opt == OPT_M64)
tcc_tool_cross(s, argv, opt); /* never returns */
if (s->verbose)
printf(version);
if (opt == OPT_AR)
return tcc_tool_ar(s, argc, argv);
#ifdef TCC_TARGET_PE
if (opt == OPT_IMPDEF)
return tcc_tool_impdef(s, argc, argv);
#endif
if (opt == OPT_V)
return 0;
if (opt == OPT_PRINT_DIRS) {
/* initialize search dirs */
set_environment(s);
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
print_search_dirs(s);
return 0;
}
// if ((n | t) == 0) {
// if (opt == OPT_HELP)
// return printf(help), 1;
// if (opt == OPT_HELP2)
// return printf(help2), 1;
// if (opt == OPT_M32 || opt == OPT_M64)
// tcc_tool_cross(s, argv, opt); /* never returns */
// if (s->verbose)
// printf(version);
// if (opt == OPT_AR)
// return tcc_tool_ar(s, argc, argv);
// #ifdef TCC_TARGET_PE
// if (opt == OPT_IMPDEF)
// return tcc_tool_impdef(s, argc, argv);
// #endif
// if (opt == OPT_V)
// return 0;
// if (opt == OPT_PRINT_DIRS) {
// /* initialize search dirs */
// set_environment(s);
// tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
// print_search_dirs(s);
// return 0;
// }
n = s->nb_files;
if (n == 0)
tcc_error("no input files\n");
// n = s->nb_files;
// if (n == 0)
// tcc_error("no input files\n");
if (s->output_type == TCC_OUTPUT_PREPROCESS) {
if (s->outfile) {
ppfp = fopen(s->outfile, "w");
if (!ppfp)
tcc_error("could not write '%s'", s->outfile);
}
} else if (s->output_type == TCC_OUTPUT_OBJ && !s->option_r) {
if (s->nb_libraries)
tcc_error("cannot specify libraries with -c");
if (n > 1 && s->outfile)
tcc_error("cannot specify output file with -c many files");
} else {
if (s->option_pthread)
tcc_set_options(s, "-lpthread");
}
if (s->do_bench)
start_time = getclock_ms();
}
// if (s->output_type == TCC_OUTPUT_PREPROCESS) {
// if (s->outfile) {
// ppfp = fopen(s->outfile, "w");
// if (!ppfp)
// tcc_error("could not write '%s'", s->outfile);
// }
// } else if (s->output_type == TCC_OUTPUT_OBJ && !s->option_r) {
// if (s->nb_libraries)
// tcc_error("cannot specify libraries with -c");
// if (n > 1 && s->outfile)
// tcc_error("cannot specify output file with -c many files");
// } else {
// if (s->option_pthread)
// tcc_set_options(s, "-lpthread");
// }
// if (s->do_bench)
// start_time = getclock_ms();
// }
s->output_type = TCC_OUTPUT_OBJ;
args_parser_add_file(s, "/mnt/1.txt", AFF_TYPE_C);
set_environment(s);
if (s->output_type == 0)
s->output_type = TCC_OUTPUT_EXE;
@@ -329,7 +330,7 @@ redo:
printf("-> %s\n", f->name);
if (!first_file)
first_file = f->name;
if (tcc_add_file(s, f->name) < 0)
if (tcc_add_file(s, "/mnt/1.txt") < 0)
ret = 1;
}
s->filetype = 0;