Jump to page: 1 2
Thread overview
[Issue 14663] shared library test - link_linkdep - segfaults on FreeBSD 10
Jul 06, 2015
Jonathan M Davis
Jul 26, 2015
Martin Nowak
Jul 26, 2015
Martin Nowak
Jul 26, 2015
Martin Nowak
Jul 26, 2015
Martin Nowak
Jul 26, 2015
Jonathan M Davis
Jul 28, 2015
Martin Nowak
Aug 23, 2015
Jonathan M Davis
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D2

--
July 06, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
issue# 14776 is likely related to this one, but I don't know if they're the same bug or not. issue# 14776 is only triggered without -release and stops the unit tests before they get to the link_linkdep test which this bug report is for.

--
July 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu

--- Comment #2 from Martin Nowak <code@dawg.eu> ---
Can't reproduce the issue using dmd/druntime master and FBSD 10.

--
July 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #3 from Martin Nowak <code@dawg.eu> ---
Oh wait, it happens only when using gcc, both in debug and release builds.

--
July 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #4 from Martin Nowak <code@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.

--
July 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Martin Nowak <code@dawg.eu> ---
https://github.com/D-Programming-Language/dmd/pull/4838

--
July 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #6 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
(In reply to Martin Nowak from comment #3)
> Oh wait, it happens only when using gcc, both in debug and release builds.

I wasn't aware that you could use anything other than gcc. dmd spits out errors if gcc isn't available for it to use.

--
July 28, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #7 from Martin Nowak <code@dawg.eu> ---
(In reply to Jonathan M Davis from comment #6)
> I wasn't aware that you could use anything other than gcc. dmd spits out errors if gcc isn't available for it to use.

I just fixed dmd's makefile, simply set CC. https://github.com/D-Programming-Language/dmd/pull/4837

--
August 19, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

--- Comment #8 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c011a559128e0c069140df4f7b3afd670403b081 fix Issue 14663  - shared library test - link_linkdep - segfaults on FreeBSD 10

- the .ctors.d_dso_ctor and .dtors.d_dso_dtor sections
  are merged into .ctors/.dtors or .init_array/.fini_array
  depending on the linker script

- those sections need to be writeable b/c they can contain
  relocations (in PIC code)

- merging readonly with writeable sections cause the gcc49 linker
  on FBSD10 to collapse the readonly and writeable segments

https://github.com/D-Programming-Language/dmd/commit/8dad102881c0183256b9440d348a71b387c4b378 Merge pull request #4838 from MartinNowak/fix14776

fix Issue 14663  - shared library test - link_linkdep - segfaults on FreeBSD 10

--
August 19, 2015
https://issues.dlang.org/show_bug.cgi?id=14663

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
« First   ‹ Prev
1 2