History

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.

Michael Matz committed 12 years ago

Commit e69c5061 parent a9fda391 file · +9 −2Browse files

Unified · Split

tccelf.c+9−2
@@ -1292,13 +1292,20 @@ ST_FUNC void build_got_entries(TCCState *s1) · 1291 unmodified lines
12921292 case R_X86_64_GOTTPOFF:
12931293 case R_X86_64_GOTPCREL:
12941294 case R_X86_64_PLT32:
1295+ sym_index = ELFW(R_SYM)(rel->r_info);
1296+ sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
1297+ if (type == R_X86_64_PLT32 &&
1298+ ELFW(ST_VISIBILITY)(sym->st_other) != STV_DEFAULT)
1299+ {
1300+ rel->r_info = ELFW(R_INFO)(sym_index, R_X86_64_PC32);
1301+ break;
1302+ }
1303+
12951304 if (!s1->got)
12961305 build_got(s1);
12971306 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL ||
12981307 type == R_X86_64_PLT32) {
12991308 unsigned long ofs;
1300− sym_index = ELFW(R_SYM)(rel->r_info);
1301− sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
13021309 /* look at the symbol got offset. If none, then add one */
13031310 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL)
13041311 reloc_type = R_X86_64_GLOB_DAT;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t