[Issue 14663] shared library test - link_linkdep - segfaults on FreeBSD 10

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 26 09:24:55 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #4 from Martin Nowak <code at dawg.eu> ---
It dies in the runtime linker itself before _start and before library
initialization. It's hard to find out b/c the runtime linker neither has
symbols nor debug information. From a ktrace/utrace dump it seems that it
happens shortly after relocation the symbols in liblinkdep.so
https://github.com/freebsd/freebsd/blob/d16fdde7e16c8c6a2133a2385b83ce0955e576b1/libexec/rtld-elf/rtld.c#L2622.

Seems there is something wrong with linking segments.

When linked with clang it's:

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x00000000000006ec 0x00000000000006ec  R E    200000
  LOAD           0x00000000000006f0 0x00000000002006f0 0x00000000002006f0
                 0x00000000000002a8 0x00000000000002a8  RW     200000
  DYNAMIC        0x0000000000000760 0x0000000000200760 0x0000000000200760
                 0x00000000000001d0 0x00000000000001d0  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn
.rela.plt .init .plt .text .fini .eh_frame 
   01     .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .minfo 
   02     .dynamic 
   03   

When linked with gcc it becomes:

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000200aa8 0x0000000000200ac0  RWE    200000
  DYNAMIC        0x0000000000200830 0x0000000000200830 0x0000000000200830
                 0x0000000000000210 0x0000000000000210  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     10

 Section to Segment mapping:
  Segment Sections...
   00     .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt
.init .plt .text .fini .eh_frame .init_array .fini_array .ctors .dtors .jcr
.data.rel.ro .dynamic .got .got.plt .data .minfo .bss 
   01     .dynamic 
   02    

For some reason the readonly segment get's merged with the writeable segment.
We had something similar already as issue 13117.

--


More information about the Digitalmars-d-bugs mailing list