aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorbellard <bellard>2003-05-24 15:46:29 +0000
committerbellard <bellard>2003-05-24 15:46:29 +0000
commit98713a6be395ff75d93772722b8144e69990104f (patch)
treef37d888b506ff8fae07ff07a2942f5d2089768a4 /tccelf.c
parentfe3b68b087934c7cee531f1ea6bf072fa94594fa (diff)
downloadtinycc-98713a6be395ff75d93772722b8144e69990104f.tar.gz
tinycc-98713a6be395ff75d93772722b8144e69990104f.tar.bz2
added -rdynamic support
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tccelf.c b/tccelf.c
index d282877..a259818 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -779,7 +779,7 @@ static void tcc_add_runtime(TCCState *s1)
Section *s;
if (!s1->nostdlib) {
- snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.o");
+ snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.a");
tcc_add_file(s1, buf);
}
#ifdef CONFIG_TCC_BCHECK
@@ -967,7 +967,7 @@ int tcc_output_file(TCCState *s1, const char *filename)
unsigned long offset;
offset = bss_section->data_offset;
/* XXX: which alignment ? */
- offset = (offset + 8 - 1) & -8;
+ offset = (offset + 16 - 1) & -16;
index = put_elf_sym(s1->dynsym, offset, esym->st_size,
esym->st_info, 0,
bss_section->sh_num, name);
@@ -986,6 +986,14 @@ int tcc_output_file(TCCState *s1, const char *filename)
error_noabort("undefined symbol '%s'", name);
}
}
+ } else if (s1->rdynamic &&
+ ELF32_ST_BIND(sym->st_info) != STB_LOCAL) {
+ /* if -rdynamic option, then export all non
+ local symbols */
+ name = symtab_section->link->data + sym->st_name;
+ put_elf_sym(s1->dynsym, sym->st_value, sym->st_size,
+ sym->st_info, 0,
+ sym->st_shndx, name);
}
}
@@ -1003,6 +1011,8 @@ int tcc_output_file(TCCState *s1, const char *filename)
name = s1->dynsymtab_section->link->data + esym->st_name;
sym_index = find_elf_sym(symtab_section, name);
if (sym_index) {
+ /* XXX: avoid adding a symbol if already
+ present because of -rdynamic ? */
sym = &((Elf32_Sym *)symtab_section->data)[sym_index];
put_elf_sym(s1->dynsym, sym->st_value, sym->st_size,
sym->st_info, 0,