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
1292 case R_X86_64_GOTTPOFF:1292 case R_X86_64_GOTTPOFF:
1293 case R_X86_64_GOTPCREL:1293 case R_X86_64_GOTPCREL:
1294 case R_X86_64_PLT32:1294 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
1295 if (!s1->got)1304 if (!s1->got)
1296 build_got(s1);1305 build_got(s1);
1297 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL ||1306 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL ||
1298 type == R_X86_64_PLT32) {1307 type == R_X86_64_PLT32) {
1299 unsigned long ofs;1308 unsigned long ofs;
1300 sym_index = ELFW(R_SYM)(rel->r_info);
1301 sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
1302 /* look at the symbol got offset. If none, then add one */1309 /* look at the symbol got offset. If none, then add one */
1303 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL)1310 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL)
1304 reloc_type = R_X86_64_GLOB_DAT;1311 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