aboutsummaryrefslogtreecommitdiff
path: root/tccasm.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-02-20 18:58:08 +0100
committergrischka <grischka>2017-02-20 18:58:08 +0100
commit5f33d313c8a2455ff9036cd7f7028339bdbde622 (patch)
treee620f3c5a67e0f785046ee188ffbd00e593c2212 /tccasm.c
parent399237850d87be8ef1179d2592ade660152aaabc (diff)
downloadtinycc-5f33d313c8a2455ff9036cd7f7028339bdbde622.tar.gz
tinycc-5f33d313c8a2455ff9036cd7f7028339bdbde622.tar.bz2
tcc: re-enable correct option -r support
Forgot about it. It allows to compile several sources (and other .o's) to one single .o file; tcc -r -o all.o f1.c f2.c f3.S o4.o ... Also: - option -fold-struct-init-code removed, no effect anymore - (tcc_)set_environment() moved to tcc.c - win32/lib/(win)crt1 minor fix & add dependency - debug line output for asm (tcc -c -g xxx.S) enabled - configure/Makefiles: x86-64 -> x86_64 changes - README: cleanup
Diffstat (limited to 'tccasm.c')
-rw-r--r--tccasm.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/tccasm.c b/tccasm.c
index 0999a03..b833408 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -926,10 +926,13 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global)
set_idnum('.', IS_ID);
if (do_preprocess)
parse_flags |= PARSE_FLAG_PREPROCESS;
- next();
for(;;) {
+ next();
if (tok == TOK_EOF)
break;
+ /* generate line number info */
+ if (global && s1->do_debug)
+ tcc_debug_line(s1);
parse_flags |= PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
redo:
if (tok == '#') {
@@ -981,15 +984,12 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global)
}
}
/* end of line */
- if (tok != ';' && tok != TOK_LINEFEED){
+ if (tok != ';' && tok != TOK_LINEFEED)
expect("end of line");
- }
parse_flags &= ~PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
- next();
}
asm_free_labels(s1);
-
return 0;
}
@@ -1001,24 +1001,19 @@ ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess)
define_start = define_stack;
preprocess_start(s1);
+ tcc_debug_start(s1);
/* default section is text */
cur_text_section = text_section;
ind = cur_text_section->data_offset;
nocode_wanted = 0;
- /* an elf symbol of type STT_FILE must be put so that STB_LOCAL
- symbols can be safely used */
- put_elf_sym(symtab_section, 0, 0,
- ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0,
- SHN_ABS, file->filename);
-
ret = tcc_assemble_internal(s1, do_preprocess, 1);
cur_text_section->data_offset = ind;
+ tcc_debug_end(s1);
free_defines(define_start);
-
return ret;
}