https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246561
--- Comment #4 from John Baldwin <j...@freebsd.org> --- GDB doesn't use the special field for MIPS (it ignores it). GDB also uses the structure embedded in the rtld itself, it does not call dlinfo(). GDB does seem to expect l_addr + offset of ".dynamic" in the binary == l_ld. I think what we have now only works because all of our shared libraries are linked at a virtual address of 0. If we did "pre-linking" to set preferred addresses for shared libraries GDB would stop working. Here's stepping through the function (gdb/solib-svr4.c:lm_addr_check()) that finds the base address of a shared library (libutil.so in this case): (top-gdb) p *li $10 = {<lm_info_base> = {<No data fields>}, l_addr = 0x0, l_addr_inferior = 0x800250000, l_addr_p = false, lm_addr = 0x800232638, l_ld = 0x800263360, l_next = 0x800232a38, l_prev = 0x800232238, l_name = 0x800230260} (top-gdb) n 225 l_addr = li->l_addr_inferior; (top-gdb) n 227 if (! abfd || ! has_lm_dynamic_from_link_map ()) (top-gdb) 230 l_dynaddr = li->l_ld; (top-gdb) 232 dyninfo_sect = bfd_get_section_by_name (abfd, ".dynamic"); (top-gdb) 233 if (dyninfo_sect == NULL) (top-gdb) 236 dynaddr = bfd_section_vma (abfd, dyninfo_sect); (top-gdb) 238 if (dynaddr + l_addr != l_dynaddr) (top-gdb) p dynaddr $11 = 0x13360 (top-gdb) p l_addr $12 = 0x800250000 (top-gdb) p l_dynaddr $13 = 0x800263360 li->l_addr_inferior is the value of 'l_addr' from the linkmap, li->l_ld is 'l_ld'. readelf -t libutil.so: [20] .dynamic DYNAMIC 0000000000013360 0000000000013360 6 0000000000000160 0000000000000010 0 8 [0000000000000003]: WRITE, ALLOC readelf -l shows first PT_LOAD with an offset of 0: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040 0x00000000000001f8 0x00000000000001f8 R 0x8 LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x00000000000075cc 0x00000000000075cc R 0x1000 LOAD 0x0000000000008000 0x0000000000008000 0x0000000000008000 0x000000000000a5d0 0x000000000000a5d0 R E 0x1000 -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"