aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrischka <grischka>2009-12-19 19:12:33 +0100
committergrischka <grischka>2009-12-19 22:16:18 +0100
commitb5e22384836d5c09602d5cf6fe990485299dfbf0 (patch)
tree051658683f429a7ffb6adad0b3ad8e84c1308bda
parentab4a4ab25e474dca8a84a8c43f923ba750b0b9c9 (diff)
downloadtinycc-b5e22384836d5c09602d5cf6fe990485299dfbf0.tar.gz
tinycc-b5e22384836d5c09602d5cf6fe990485299dfbf0.tar.bz2
tccasm: make VT_VOID symbols ST_NOTYPE, elf-wise
This was confusing objdump such that it did not print disassembly with -d. Also, put filename as with C compilation
-rw-r--r--libtcc.c2
-rw-r--r--tccasm.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/libtcc.c b/libtcc.c
index 54184e2..9a04a9e 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -780,6 +780,8 @@ static void put_extern_sym2(Sym *sym, Section *section,
if (FUNC_CALL(attr) == FUNC_STDCALL)
other |= 2;
#endif
+ } else if ((sym->type.t & VT_BTYPE) == VT_VOID) {
+ sym_type = STT_NOTYPE;
} else {
sym_type = STT_OBJECT;
}
diff --git a/tccasm.c b/tccasm.c
index 6862ef5..56bf6cd 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -712,6 +712,12 @@ static int tcc_assemble(TCCState *s1, int do_preprocess)
define_start = define_stack;
+ /* 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);
cur_text_section->data_offset = ind;