arm: Fix relocate_section with TCC_OUTPUT_MEMORY
This commit is contained in:
parent
4af25aed92
commit
47fd807f9b
1 changed files with 4 additions and 2 deletions
6
tccelf.c
6
tccelf.c
|
@ -791,7 +791,8 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s)
|
||||||
{
|
{
|
||||||
int x, is_thumb, is_call, h, blx_avail, is_bl, th_ko;
|
int x, is_thumb, is_call, h, blx_avail, is_bl, th_ko;
|
||||||
x = (*(int *) ptr) & 0xffffff;
|
x = (*(int *) ptr) & 0xffffff;
|
||||||
if (sym->st_shndx == SHN_UNDEF)
|
if (sym->st_shndx == SHN_UNDEF
|
||||||
|
|| s1->output_type == TCC_OUTPUT_MEMORY)
|
||||||
val = s1->plt->sh_addr;
|
val = s1->plt->sh_addr;
|
||||||
#ifdef DEBUG_RELOC
|
#ifdef DEBUG_RELOC
|
||||||
printf ("reloc %d: x=0x%x val=0x%x ", type, x, val);
|
printf ("reloc %d: x=0x%x val=0x%x ", type, x, val);
|
||||||
|
@ -1541,7 +1542,8 @@ ST_FUNC void build_got_entries(TCCState *s1)
|
||||||
sym_index = ELFW(R_SYM)(rel->r_info);
|
sym_index = ELFW(R_SYM)(rel->r_info);
|
||||||
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
||||||
if (type != R_ARM_GOTOFF && type != R_ARM_GOTPC
|
if (type != R_ARM_GOTOFF && type != R_ARM_GOTPC
|
||||||
&& sym->st_shndx == SHN_UNDEF) {
|
&& (sym->st_shndx == SHN_UNDEF
|
||||||
|
|| s1->output_type == TCC_OUTPUT_MEMORY)) {
|
||||||
unsigned long ofs;
|
unsigned long ofs;
|
||||||
/* look at the symbol got offset. If none, then add one */
|
/* look at the symbol got offset. If none, then add one */
|
||||||
if (type == R_ARM_GOT32)
|
if (type == R_ARM_GOT32)
|
||||||
|
|
Loading…
Add table
Reference in a new issue