aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtcc.c8
-rw-r--r--libtcc.h7
-rw-r--r--tcc.c1
-rw-r--r--tcc.h9
4 files changed, 24 insertions, 1 deletions
diff --git a/libtcc.c b/libtcc.c
index f0da4de..9cc1b6f 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1038,6 +1038,10 @@ LIBTCCAPI void tcc_delete(TCCState *s1)
dynarray_reset(&s1->sysinclude_paths, &s1->nb_sysinclude_paths);
tcc_free(s1->tcc_lib_path);
+
+ dynarray_reset(&s1->input_files, &s1->nb_input_files);
+ dynarray_reset(&s1->input_libs, &s1->nb_input_libs);
+
#ifdef HAVE_SELINUX
munmap (s1->write_mem, s1->mem_size);
munmap (s1->runtime_mem, s1->mem_size);
@@ -1184,6 +1188,8 @@ the_end:
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename)
{
+ dynarray_add((void ***)&s->input_files, &s->nb_input_files, tcc_strdup(filename));
+
if (s->output_type == TCC_OUTPUT_PREPROCESS)
return tcc_add_file_internal(s, filename, AFF_PRINT_ERROR | AFF_PREPROCESS);
else
@@ -1220,6 +1226,8 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname)
{
char buf[1024];
int i;
+
+ dynarray_add((void ***)&s->input_libs, &s->nb_input_libs, tcc_strdup(libraryname));
/* first we look for the dynamic library if not static linking */
if (!s->static_link) {
diff --git a/libtcc.h b/libtcc.h
index 339dec1..13efcd2 100644
--- a/libtcc.h
+++ b/libtcc.h
@@ -103,6 +103,13 @@ LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name);
/* set CONFIG_TCCDIR at runtime */
LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
+
+/*****************************/
+/* Miscellaneous */
+
+/* Get default target filename for this compilation */
+LIBTCCAPI const char *tcc_default_target(TCCState *s);
+
#ifdef __cplusplus
}
#endif
diff --git a/tcc.c b/tcc.c
index 759151a..f973972 100644
--- a/tcc.c
+++ b/tcc.c
@@ -475,6 +475,7 @@ int main(int argc, char **argv)
}
tcc_set_output_type(s, output_type);
+ s->reloc_output = reloc_output;
/* compile or add each files or library */
for(i = 0; i < nb_files && ret == 0; i++) {
diff --git a/tcc.h b/tcc.h
index 29953a6..8fd4408 100644
--- a/tcc.h
+++ b/tcc.h
@@ -397,7 +397,8 @@ typedef struct ASMOperand {
#endif
struct TCCState {
- int output_type;
+ unsigned output_type : 8;
+ unsigned reloc_output : 1;
BufferedFile **include_stack_ptr;
int *ifdef_stack_ptr;
@@ -518,6 +519,12 @@ struct TCCState {
/* output file for preprocessing */
FILE *outfile;
+ /* input files and libraries for this compilation */
+ char **input_files;
+ int nb_input_files;
+ char **input_libs;
+ int nb_input_libs;
+
/* for tcc_relocate */
int runtime_added;
void *runtime_mem;