diff options
| author | Michael Matz <matz@suse.de> | 2014-04-14 04:58:05 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2014-04-14 04:58:05 +0200 |
| commit | e69c5066172eeab2f5c12227ff7f8f894839697b (patch) | |
| tree | cc767fbc7702ec829d9eb7f07fdc7d85ef139068 /tccelf.c | |
| parent | a9fda392a0d03d62f0bef0acd42ec82b29216ab3 (diff) | |
| download | tinycc-e69c5066172eeab2f5c12227ff7f8f894839697b.tar.gz tinycc-e69c5066172eeab2f5c12227ff7f8f894839697b.tar.bz2 | |
x86_64: Handle PLT relocs to hidden symbols
For calls to hidden symbols we don't need a PLT slot, rewrite
the reloc into PC32.
Diffstat (limited to 'tccelf.c')
| -rw-r--r-- | tccelf.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1292,13 +1292,20 @@ ST_FUNC void build_got_entries(TCCState *s1) case R_X86_64_GOTTPOFF: case R_X86_64_GOTPCREL: case R_X86_64_PLT32: + sym_index = ELFW(R_SYM)(rel->r_info); + sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; + if (type == R_X86_64_PLT32 && + ELFW(ST_VISIBILITY)(sym->st_other) != STV_DEFAULT) + { + rel->r_info = ELFW(R_INFO)(sym_index, R_X86_64_PC32); + break; + } + if (!s1->got) build_got(s1); if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL || type == R_X86_64_PLT32) { unsigned long ofs; - sym_index = ELFW(R_SYM)(rel->r_info); - sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; /* look at the symbol got offset. If none, then add one */ if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL) reloc_type = R_X86_64_GLOB_DAT; |
