mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
Simplify and fix GOT32 + PLT32 reloc commit
Introduce a new attribute to check the existence of a PLT entry for a
given symbol has the presence of an entry for that symbol in the dynsym
section is not proof that a PLT entry exists.
This fixes commit dc8ea93b13
.
This commit is contained in:
parent
bed865275d
commit
aa561d7011
1
tcc.h
1
tcc.h
@ -522,6 +522,7 @@ typedef struct ASMOperand {
|
|||||||
|
|
||||||
struct sym_attr {
|
struct sym_attr {
|
||||||
unsigned long got_offset;
|
unsigned long got_offset;
|
||||||
|
unsigned char has_plt_entry:1;
|
||||||
#ifdef TCC_TARGET_ARM
|
#ifdef TCC_TARGET_ARM
|
||||||
unsigned char plt_thumb_stub:1;
|
unsigned char plt_thumb_stub:1;
|
||||||
#endif
|
#endif
|
||||||
|
5
tccelf.c
5
tccelf.c
@ -1042,10 +1042,9 @@ static void put_got_entry(TCCState *s1,
|
|||||||
if (s1->dynsym) {
|
if (s1->dynsym) {
|
||||||
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
||||||
name = (char *) symtab_section->link->data + sym->st_name;
|
name = (char *) symtab_section->link->data + sym->st_name;
|
||||||
if (!find_elf_sym(s1->dynsym, name))
|
if (s1->sym_attrs[sym_index].has_plt_entry)
|
||||||
need_plt_entry = 1;
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
s1->sym_attrs[sym_index].has_plt_entry = 1;
|
||||||
offset = sym->st_value;
|
offset = sym->st_value;
|
||||||
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
|
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
|
||||||
if (need_plt_entry) {
|
if (need_plt_entry) {
|
||||||
|
Loading…
Reference in New Issue
Block a user