uint32_t idx;
        GElf_Ehdr ehdr;
        GElf_Shdr shdr;
+       GElf_Shdr tshdr;
        Elf_Data *syms, *opddata = NULL;
        GElf_Sym sym;
        Elf_Scn *sec, *sec_strndx;
        sec = syms_ss->symtab;
        shdr = syms_ss->symshdr;
 
+       if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
+               dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
+
        if (runtime_ss->opdsec)
                opddata = elf_rawdata(runtime_ss->opdsec, NULL);
 
         * Handle any relocation of vdso necessary because older kernels
         * attempted to prelink vdso to its virtual address.
         */
-       if (dso__is_vdso(dso)) {
-               GElf_Shdr tshdr;
-
-               if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
-                       map->reloc = map->start - tshdr.sh_addr + tshdr.sh_offset;
-       }
+       if (dso__is_vdso(dso))
+               map->reloc = map->start - dso->text_offset;
 
        dso->adjust_symbols = runtime_ss->adjust_symbols || ref_reloc(kmap);
        /*