diff options
| author | Thomas Preud'homme <thomas.preudhomme@celest.fr> | 2010-06-24 20:53:42 +0200 |
|---|---|---|
| committer | Thomas Preud'homme <thomas.preudhomme@celest.fr> | 2010-08-09 20:20:09 +0200 |
| commit | bcc9137a1004682ac58914c7445427cb23ceba88 (patch) | |
| tree | e54446541208b15307119629e34ee6b6da696e5b /tccelf.c | |
| parent | 82c5edb31cd0bb2ee699992c45557006f1681e0e (diff) | |
| download | tinycc-bcc9137a1004682ac58914c7445427cb23ceba88.tar.gz tinycc-bcc9137a1004682ac58914c7445427cb23ceba88.tar.bz2 | |
Add support for indirect functions as externals.
Add link support to use indirect functions defined in external modules
Diffstat (limited to 'tccelf.c')
| -rw-r--r-- | tccelf.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1514,9 +1514,10 @@ static int elf_output_file(TCCState *s1, const char *filename) build_got(s1); /* scan for undefined symbols and see if they are in the - dynamic symbols. If a symbol STT_FUNC is found, then we - add it in the PLT. If a symbol STT_OBJECT is found, we - add it in the .bss section with a suitable relocation */ + dynamic symbols. If a symbol STT_FUNC or STT_GNU_IFUNC + is found, then we add it in the PLT. If a symbol + STT_OBJECT is found, we add it in the .bss section with + a suitable relocation */ sym_end = (ElfW(Sym) *)(symtab_section->data + symtab_section->data_offset); if (file_type == TCC_OUTPUT_EXE) { @@ -1529,7 +1530,7 @@ static int elf_output_file(TCCState *s1, const char *filename) if (sym_index) { esym = &((ElfW(Sym) *)s1->dynsymtab_section->data)[sym_index]; type = ELFW(ST_TYPE)(esym->st_info); - if (type == STT_FUNC) { + if ((type == STT_FUNC) || (type == STT_GNU_IFUNC)) { put_got_entry(s1, R_JMP_SLOT, esym->st_size, esym->st_info, sym - (ElfW(Sym) *)symtab_section->data); @@ -1626,8 +1627,9 @@ static int elf_output_file(TCCState *s1, const char *filename) sym++) { if (ELFW(ST_BIND)(sym->st_info) != STB_LOCAL) { #if defined(TCC_OUTPUT_DLL_WITH_PLT) - if (ELFW(ST_TYPE)(sym->st_info) == STT_FUNC && - sym->st_shndx == SHN_UNDEF) { + if ((ELFW(ST_TYPE)(sym->st_info) == STT_FUNC || + ELFW(ST_TYPE)(sym->st_info) == STT_GNU_IFUNC) + && sym->st_shndx == SHN_UNDEF) { put_got_entry(s1, R_JMP_SLOT, sym->st_size, sym->st_info, sym - (ElfW(Sym) *)symtab_section->data); |
