Unified · Split
| @@ -791,7 +791,8 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) · 790 unmodified lines | ||
| 791 | 791 | { |
| 792 | 792 | int x, is_thumb, is_call, h, blx_avail, is_bl, th_ko; |
| 793 | 793 | x = (*(int *) ptr) & 0xffffff; |
| 794 | − if (sym->st_shndx == SHN_UNDEF) | |
| 794 | + if (sym->st_shndx == SHN_UNDEF | |
| 795 | + || s1->output_type == TCC_OUTPUT_MEMORY) | |
| 795 | 796 | val = s1->plt->sh_addr; |
| 796 | 797 | #ifdef DEBUG_RELOC |
| 797 | 798 | printf ("reloc %d: x=0x%x val=0x%x ", type, x, val); |
| @@ -1541,7 +1542,8 @@ ST_FUNC void build_got_entries(TCCState *s1) · 743 unmodified lines | ||
| 1541 | 1542 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 1542 | 1543 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| 1543 | 1544 | if (type != R_ARM_GOTOFF && type != R_ARM_GOTPC |
| 1544 | − && sym->st_shndx == SHN_UNDEF) { | |
| 1545 | + && (sym->st_shndx == SHN_UNDEF | |
| 1546 | + || s1->output_type == TCC_OUTPUT_MEMORY)) { | |
| 1545 | 1547 | unsigned long ofs; |
| 1546 | 1548 | /* look at the symbol got offset. If none, then add one */ |
| 1547 | 1549 | if (type == R_ARM_GOT32) |