Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated binaries fail with SIGILL using splitbuild and Vibe.d (amd64) #2280

Open
ximion opened this issue Aug 18, 2017 · 22 comments
Open

Generated binaries fail with SIGILL using splitbuild and Vibe.d (amd64) #2280

ximion opened this issue Aug 18, 2017 · 22 comments

Comments

@ximion
Copy link
Contributor

ximion commented Aug 18, 2017

Hey! Another weird issue :-)

I want to build Vibe with Meson for Debian packaging. The Meson buildsystem does split-builds by default.
The build finishes successfully, but the generated binaries fail with SIGILL:
9495 Illegal instruction (core dumped) ./core/vibe-test_core
The full build log can be found at: https://travis-ci.org/ximion/vibe.d/jobs/266145926
(for LDC 1.3.0, a (working) dub build happens before).

Interestingly, this only happens on Travis with the prebuilt binaries. When I try to reproduce this locally with my LDC from the Debian repositories, I get working binaries:

ldc2 --version
LDC - the LLVM D compiler (1.2.0):
  based on DMD v2.072.2 and LLVM 3.9.1
  built with LDC - the LLVM D compiler (0.17.4)
  Default target: x86_64-pc-linux-gnu
  Host CPU: haswell
  http://dlang.org - http://wiki.dlang.org/LDC

Reference PR for updated Meson in Vibe: vibe-d/vibe.d#1894

So, I guess something went wrong in LLVM (the Travis packages are built with 4.0), or the Travis binaries have some other issue.
All builds happened on amd64.

@ximion ximion changed the title Generated binaries fail with SIGILL using Meson splitbuild and Vibe Generated binaries fail with SIGILL using splitbuild and Vibe.d (amd64) Aug 18, 2017
@ximion
Copy link
Contributor Author

ximion commented Aug 18, 2017

I made it generate a - probably not incredibly useful - backtrace:

gdb -batch -ex run -ex 'bt full' ./core/vibe-test_core
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x00007ffff7b203d4 in _d_dso_registry () from /home/travis/build/ximion/vibe.d/build/utils/libvibe-utils.so.0
#0  0x00007ffff7b203d4 in _d_dso_registry () from /home/travis/build/ximion/vibe.d/build/utils/libvibe-utils.so.0
No symbol table info available.
#1  0x00007ffff76b5a12 in ldc.register_dso () from /home/travis/build/ximion/vibe.d/build/data/libvibe-data.so.0
No symbol table info available.
#2  0x00007ffff76b5a32 in ldc.dso_ctor.4vibe4data4bson () from /home/travis/build/ximion/vibe.d/build/data/libvibe-data.so.0
No symbol table info available.
#3  0x00007ffff7dea2da in ?? () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
#4  0x00007ffff7dea3c3 in ?? () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
#5  0x00007ffff7ddb29a in ?? () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
#6  0x0000000000000001 in ?? ()
No symbol table info available.
#7  0x00007fffffffde34 in ?? ()
No symbol table info available.
#8  0x0000000000000000 in ?? ()
No symbol table info available.

@dnadlinger
Copy link
Member

Could you have a look at the failing instruction (disas in GDB, look at the little error or search for the address from the backtrace)? Is it actually illegal/unsupported?

@ximion
Copy link
Contributor Author

ximion commented Aug 19, 2017

I fetched the binary from Travis, and it runs fine here - so I guess the problem is that LDC is generating code from some more recent CPU architecture than available on Travis...
I'll see whether I can get a disassembly somehow...

@dnadlinger
Copy link
Member

Interesting - we've had issues where too aggressive defaults were used even without -mcpu=host in the past, but as far as I'm aware, all of them have been fixed.

@dnadlinger
Copy link
Member

What is the exact command line issued by Meson? We've had issues with SSE 2 (or AVX) being used in the initialization code before, but SSE 2 should be supported on all x86_64 CPUs and AVX needs to be enabled explicitly.

@ximion
Copy link
Contributor Author

ximion commented Aug 19, 2017

Which command-line? ;-) There are multiple.
I am currently running the build in verbose mode: https://travis-ci.org/ximion/vibe.d/jobs/266382991

Interestingly, one binary, vibe-test_utils, which is the only binary that doesn't link to shared libraries, does not crash with SIGILL. So, the illegal instructions aren't added unconditionally.

General flags passed to LDC for compiling in this case are -enable-color -wi -g -O0 -d-version=VibeLibeventDriver -d-version=Have_openssl -relocation-model=pic -c

@ximion
Copy link
Contributor Author

ximion commented Aug 19, 2017

Okay, sorry, I forgot that the error was in the library, not the binary... I now have a pair of library/binary which allows me to reproduce the issue on my machine here as well:

Program received signal SIGILL, Illegal instruction.
0x00007f287825c3d4 in _d_dso_registry () from /tmp/test/libvibe-utils.so.0
(gdb) disass 0x00007f287825c3d0,0x00007f287825c3ff
Dump of assembler code from 0x7f287825c3d0 to 0x7f287825c3ff:
   0x00007f287825c3d0 <_d_dso_registry+1104>:   pop    %rdi
   0x00007f287825c3d1 <_d_dso_registry+1105>:   retq   
   0x00007f287825c3d2 <_d_dso_registry+1106>:   ud2    
=> 0x00007f287825c3d4 <_d_dso_registry+1108>:   ud2    
   0x00007f287825c3d6:  nopw   %cs:0x0(%rax,%rax,1)
   0x00007f287825c3e0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb+0>:     cmpq   $0x0,0x8(%rdi)
   0x00007f287825c3e5 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb+5>:     sete   %al
   0x00007f287825c3e8 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb+8>:     retq   
   0x00007f287825c3e9:  nopl   0x0(%rax)
   0x00007f287825c3f0 <_D2rt19sections_elf_shared9initLocksFZv+0>:      retq   
   0x00007f287825c3f1:  nopw   %cs:0x0(%rax,%rax,1)
   0x00007f287825c3fb:  nopl   0x0(%rax,%rax,1)
End of assembler dump.
(gdb) 

@ximion
Copy link
Contributor Author

ximion commented Aug 19, 2017

Here are the binaries to play around with (no debuginfo, sorry)
vibe-sigill-test.zip

@kinke
Copy link
Member

kinke commented Aug 19, 2017

Well I guess you're hitting one of the assert(0) in https://github.com/ldc-developers/druntime/blob/ldc/src/rt/sections_elf_shared.d#L425.

@ximion
Copy link
Contributor Author

ximion commented Aug 19, 2017

That's a weird error for an assert... The very same compilation works with all DMD versions, so I wonder what's wrong here... It also works on my machine here without problems (LDC 1.2, LLVM 3.9).

@kinke
Copy link
Member

kinke commented Aug 19, 2017

[IIRC, assert(0) is special and, at least in combination with -release, compiled to a special op, so that they are checked for release builds as well.]

@dnadlinger
Copy link
Member

Yep, ud2 is what a trap (assert(0) in release mode) compiles down to on LLVM. ud2 is a "defined-undefined" opcode that will always trap on x86. If you single-step through the function or use reverse debugging (or create a -link-debuglib build), you should be able to see which function it is that fails.

I suspect the linker version to play at least a part in this.

s-ludwig pushed a commit to vibe-d/vibe.d that referenced this issue Aug 21, 2017
* Modularize Meson build definition from 0.7.x branch
* ci: Test building with Meson
* ci: Do not test versions
    This needs an update, as the suffix (~rc, etc.) isn't allowed for
    library versioning, so we need to deal with that separately.
* meson: Skip tests when compiling with broken LDC/DMD
    This works around LDC bug
    ldc-developers/ldc#2280 for now,
    and skips compilation with a broken DMD version.
@tchaloupka
Copy link

tchaloupka commented Sep 25, 2017

I've met the same problem with this simple benchmark vibe test: https://github.com/nuald/simple-web-benchmark/tree/master/d

Compiled with dub -b release --compiler=ldc2 leads to the same problem.
Compiling in debug mode is ok.

dub build emmits these flags: ldc2 -flto=thin -release -enable-inlining -Hkeep-all-bodies -O3 -w -oq -vcolumns

Tried with:

DUB version 1.5.0

LDC - the LLVM D compiler (1.4.0):
  based on DMD v2.074.1 and LLVM 4.0.1
  built with LDC - the LLVM D compiler (1.4.0)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: sandybridge
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_be - AArch64 (big endian)
    arm        - ARM
    arm64      - ARM64 (little endian)
    armeb      - ARM (big endian)
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

disass output from the gdb:

Dump of assembler code for function _d_dso_registry:
   0x00000000004efa40 <+0>:	push   %r15
   0x00000000004efa42 <+2>:	push   %r14
   0x00000000004efa44 <+4>:	push   %r12
   0x00000000004efa46 <+6>:	push   %rbx
   0x00000000004efa47 <+7>:	sub    $0xa8,%rsp
   0x00000000004efa4e <+14>:	mov    %rdi,%r14
   0x00000000004efa51 <+17>:	cmpq   $0x0,(%r14)
   0x00000000004efa55 <+21>:	je     0x4efd78 <_d_dso_registry+824>
   0x00000000004efa5b <+27>:	mov    0x8(%r14),%rax
   0x00000000004efa5f <+31>:	mov    (%rax),%r15
   0x00000000004efa62 <+34>:	test   %r15,%r15
   0x00000000004efa65 <+37>:	je     0x4efac6 <_d_dso_registry+134>
   0x00000000004efa67 <+39>:	movq   $0x0,(%rax)
   0x00000000004efa6e <+46>:	lea    0x2d3f1b(%rip),%rax        # 0x7c3990 <_D2rt19sections_elf_shared21_isRuntimeInitializedb>
   0x00000000004efa75 <+53>:	cmpb   $0x0,(%rax)
   0x00000000004efa78 <+56>:	je     0x4efd26 <_d_dso_registry+742>
   0x00000000004efa7e <+62>:	mov    %r15,%rdi
   0x00000000004efa81 <+65>:	callq  0x4ef1c0 <_D2rt5minfo11ModuleGroup11runTlsDtorsMFZv>
   0x00000000004efa86 <+70>:	mov    %r15,%rdi
   0x00000000004efa89 <+73>:	callq  0x4ef210 <_D2rt5minfo11ModuleGroup8runDtorsMFZv>
   0x00000000004efa8e <+78>:	lea    0x30(%r15),%r14
   0x00000000004efa92 <+82>:	mov    %r14,%rdi
   0x00000000004efa95 <+85>:	callq  0x4f1bb0 <_D2rt4util9container5array13__T5ArrayTAvZ5Array7opSliceMNgFNaNbNiZANgAv>
   0x00000000004efa9a <+90>:	mov    %rax,%r12
   0x00000000004efa9d <+93>:	mov    %rdx,%rbx
   0x00000000004efaa0 <+96>:	test   %r12,%r12
   0x00000000004efaa3 <+99>:	je     0x4efd2a <_d_dso_registry+746>
   0x00000000004efaa9 <+105>:	add    $0x8,%rbx
   0x00000000004efaad <+109>:	nopl   (%rax)
   0x00000000004efab0 <+112>:	mov    (%rbx),%rdi
   0x00000000004efab3 <+115>:	callq  0x4dd950 <_D4core6memory2GC11removeRangeFNbNixPvZv>
   0x00000000004efab8 <+120>:	add    $0x10,%rbx
   0x00000000004efabc <+124>:	dec    %r12
   0x00000000004efabf <+127>:	jne    0x4efab0 <_d_dso_registry+112>
   0x00000000004efac1 <+129>:	jmpq   0x4efd2a <_d_dso_registry+746>
   0x00000000004efac6 <+134>:	lea    0x2d3eb3(%rip),%rdi        # 0x7c3980 <_D2rt19sections_elf_shared11_loadedDSOsS2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array>
   0x00000000004efacd <+141>:	callq  0x4f1ca0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb>
   0x00000000004efad2 <+146>:	mov    $0x1,%edi
   0x00000000004efad7 <+151>:	mov    $0x58,%esi
   0x00000000004efadc <+156>:	callq  0x4048e0 <calloc@plt>
   0x00000000004efae1 <+161>:	mov    %rax,0x8(%rsp)
   0x00000000004efae6 <+166>:	mov    0x8(%r14),%rcx
   0x00000000004efaea <+170>:	mov    %rcx,0x50(%rax)
   0x00000000004efaee <+174>:	mov    %rax,(%rcx)
   0x00000000004efaf1 <+177>:	mov    0x10(%r14),%rdx
   0x00000000004efaf5 <+181>:	mov    0x18(%r14),%rax
   0x00000000004efaf9 <+185>:	cmp    %rax,%rdx
   0x00000000004efafc <+188>:	jb     0x4efb09 <_d_dso_registry+201>
   0x00000000004efafe <+190>:	jmp    0x4efb0f <_d_dso_registry+207>
   0x00000000004efb00 <+192>:	add    $0x8,%rdx
   0x00000000004efb04 <+196>:	cmp    %rax,%rdx
   0x00000000004efb07 <+199>:	jae    0x4efb0f <_d_dso_registry+207>
   0x00000000004efb09 <+201>:	cmpq   $0x0,(%rdx)
   0x00000000004efb0d <+205>:	je     0x4efb00 <_d_dso_registry+192>
   0x00000000004efb0f <+207>:	cmp    %rax,%rdx
   0x00000000004efb12 <+210>:	mov    %rdx,%rcx
   0x00000000004efb15 <+213>:	jae    0x4efb2f <_d_dso_registry+239>
   0x00000000004efb17 <+215>:	mov    %rdx,%rcx
   0x00000000004efb1a <+218>:	nopw   0x0(%rax,%rax,1)
   0x00000000004efb20 <+224>:	cmpq   $0x0,(%rcx)
   0x00000000004efb24 <+228>:	je     0x4efb2f <_d_dso_registry+239>
   0x00000000004efb26 <+230>:	add    $0x8,%rcx
   0x00000000004efb2a <+234>:	cmp    %rax,%rcx
   0x00000000004efb2d <+237>:	jb     0x4efb20 <_d_dso_registry+224>
   0x00000000004efb2f <+239>:	mov    0x8(%rsp),%r15
   0x00000000004efb34 <+244>:	sub    %rdx,%rcx
   0x00000000004efb37 <+247>:	mov    %rcx,%rsi
   0x00000000004efb3a <+250>:	sar    $0x3f,%rsi
   0x00000000004efb3e <+254>:	shr    $0x3d,%rsi
   0x00000000004efb42 <+258>:	add    %rcx,%rsi
   0x00000000004efb45 <+261>:	sar    $0x3,%rsi
   0x00000000004efb49 <+265>:	xorps  %xmm0,%xmm0
   0x00000000004efb4c <+268>:	movaps %xmm0,0x50(%rsp)
   0x00000000004efb51 <+273>:	movaps %xmm0,0x40(%rsp)
   0x00000000004efb56 <+278>:	movaps %xmm0,0x30(%rsp)
   0x00000000004efb5b <+283>:	lea    0x30(%rsp),%rdi
   0x00000000004efb60 <+288>:	callq  0x4ed870 <_D2rt5minfo11ModuleGroup6__ctorMFNbNcNiAyPS6object10ModuleInfoZS2rt5minfo11ModuleGroup>
   0x00000000004efb65 <+293>:	movaps 0x30(%rsp),%xmm0
   0x00000000004efb6a <+298>:	movaps 0x40(%rsp),%xmm1
   0x00000000004efb6f <+303>:	movaps 0x50(%rsp),%xmm2
   0x00000000004efb74 <+308>:	movups %xmm2,0x20(%r15)
   0x00000000004efb79 <+313>:	movups %xmm1,0x10(%r15)
   0x00000000004efb7e <+318>:	movups %xmm0,(%r15)
   0x00000000004efb82 <+322>:	mov    0x8(%r14),%rax
   0x00000000004efb86 <+326>:	mov    %rax,0x20(%rsp)
   0x00000000004efb8b <+331>:	lea    0x68(%rsp),%rax
   0x00000000004efb90 <+336>:	mov    %rax,0x28(%rsp)
   0x00000000004efb95 <+341>:	lea    0x1e4(%rip),%rdi        # 0x4efd80 <_D2rt19sections_elf_shared22findImageHeaderForAddrFNbNixPvPS4core3sys5linux4link12dl_phdr_infoZ8callbackUNbNiPS4core3sys5linux4link12dl_phdr_infomPvZi>
   0x00000000004efb9c <+348>:	lea    0x20(%rsp),%rsi
   0x00000000004efba1 <+353>:	callq  0x404670 <dl_iterate_phdr@plt>
   0x00000000004efba6 <+358>:	test   %eax,%eax
   0x00000000004efba8 <+360>:	je     0x4efd7a <_d_dso_registry+826>
   0x00000000004efbae <+366>:	movzwl 0x80(%rsp),%r12d
   0x00000000004efbb7 <+375>:	test   %r12,%r12
   0x00000000004efbba <+378>:	je     0x4efc24 <_d_dso_registry+484>
   0x00000000004efbbc <+380>:	mov    0x78(%rsp),%rbx
   0x00000000004efbc1 <+385>:	lea    0x30(%r15),%r14
   0x00000000004efbc5 <+389>:	add    $0x28,%rbx
   0x00000000004efbc9 <+393>:	nopl   0x0(%rax)
   0x00000000004efbd0 <+400>:	mov    -0x28(%rbx),%eax
   0x00000000004efbd3 <+403>:	cmp    $0x7,%eax
   0x00000000004efbd6 <+406>:	je     0x4efc00 <_d_dso_registry+448>
   0x00000000004efbd8 <+408>:	cmp    $0x1,%eax
   0x00000000004efbdb <+411>:	jne    0x4efc1b <_d_dso_registry+475>
   0x00000000004efbdd <+413>:	testb  $0x2,-0x24(%rbx)
   0x00000000004efbe1 <+417>:	je     0x4efc1b <_d_dso_registry+475>
   0x00000000004efbe3 <+419>:	mov    -0x18(%rbx),%rdx
   0x00000000004efbe7 <+423>:	mov    (%rbx),%rsi
   0x00000000004efbea <+426>:	add    0x68(%rsp),%rdx
   0x00000000004efbef <+431>:	mov    %r14,%rdi
   0x00000000004efbf2 <+434>:	callq  0x4f2150 <_D2rt4util9container5array13__T5ArrayTAvZ5Array16__T10insertBackZ10insertBackMFNbNiAvZv>
   0x00000000004efbf7 <+439>:	jmp    0x4efc1b <_d_dso_registry+475>
   0x00000000004efbf9 <+441>:	nopl   0x0(%rax)
   0x00000000004efc00 <+448>:	mov    0x98(%rsp),%rax
   0x00000000004efc08 <+456>:	mov    %rax,0x40(%r15)
   0x00000000004efc0c <+460>:	mov    (%rbx),%rax
   0x00000000004efc0f <+463>:	add    $0x7,%rax
   0x00000000004efc13 <+467>:	and    $0xfffffffffffffff8,%rax
   0x00000000004efc17 <+471>:	mov    %rax,0x48(%r15)
   0x00000000004efc1b <+475>:	add    $0x38,%rbx
   0x00000000004efc1f <+479>:	dec    %r12
   0x00000000004efc22 <+482>:	jne    0x4efbd0 <_d_dso_registry+400>
   0x00000000004efc24 <+484>:	lea    0x2d3d55(%rip),%rdi        # 0x7c3980 <_D2rt19sections_elf_shared11_loadedDSOsS2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array>
   0x00000000004efc2b <+491>:	callq  0x4f1ca0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb>
   0x00000000004efc30 <+496>:	test   %al,%al
   0x00000000004efc32 <+498>:	je     0x4efd7a <_d_dso_registry+826>
   0x00000000004efc38 <+504>:	lea    0x2d3d41(%rip),%rbx        # 0x7c3980 <_D2rt19sections_elf_shared11_loadedDSOsS2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array>
   0x00000000004efc3f <+511>:	mov    %rbx,%rdi
   0x00000000004efc42 <+514>:	callq  0x4f1cb0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array7opSliceMNgFNaNbNiZANgPS2rt19sections_elf_shared3DSO>
   0x00000000004efc47 <+519>:	lea    0x8(%rsp),%rsi
   0x00000000004efc4c <+524>:	mov    %rbx,%rdi
   0x00000000004efc4f <+527>:	callq  0x4f2090 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array16__T10insertBackZ10insertBackMFNbNiKPS2rt19sections_elf_shared3DSOZv>
   0x00000000004efc54 <+532>:	mov    0x8(%rsp),%rax
   0x00000000004efc59 <+537>:	mov    0x48(%rax),%rbx
   0x00000000004efc5d <+541>:	callq  0x4ef860 <_D2rt19sections_elf_shared11getTLSRangeFNbNimmZ10endOfBlockFNaNbNiZPv>
   0x00000000004efc62 <+546>:	sub    %rbx,%rax
   0x00000000004efc65 <+549>:	mov    %rbx,0x10(%rsp)
   0x00000000004efc6a <+554>:	mov    %rax,0x18(%rsp)
   0x00000000004efc6f <+559>:	mov    %fs:0x0,%rax
   0x00000000004efc78 <+568>:	lea    -0x10(%rax),%rax
   0x00000000004efc7f <+575>:	mov    (%rax),%rbx
   0x00000000004efc82 <+578>:	test   %rbx,%rbx
   0x00000000004efc85 <+581>:	jne    0x4efcb5 <_d_dso_registry+629>
   0x00000000004efc87 <+583>:	mov    $0x1,%edi
   0x00000000004efc8c <+588>:	mov    $0x10,%esi
   0x00000000004efc91 <+593>:	callq  0x4048e0 <calloc@plt>
   0x00000000004efc96 <+598>:	mov    %rax,%rbx
   0x00000000004efc99 <+601>:	mov    %fs:0x0,%rax
   0x00000000004efca2 <+610>:	lea    -0x10(%rax),%rax
   0x00000000004efca9 <+617>:	mov    %rbx,(%rax)
   0x00000000004efcac <+620>:	test   %rbx,%rbx
   0x00000000004efcaf <+623>:	je     0x4efd7a <_d_dso_registry+826>
   0x00000000004efcb5 <+629>:	lea    0x10(%rsp),%rsi
   0x00000000004efcba <+634>:	mov    %rbx,%rdi
   0x00000000004efcbd <+637>:	callq  0x4f20f0 <_D2rt4util9container5array13__T5ArrayTAvZ5Array16__T10insertBackZ10insertBackMFNbNiKAvZv>
   0x00000000004efcc2 <+642>:	lea    0x2d3cc7(%rip),%rax        # 0x7c3990 <_D2rt19sections_elf_shared21_isRuntimeInitializedb>
   0x00000000004efcc9 <+649>:	cmpb   $0x0,(%rax)
   0x00000000004efccc <+652>:	je     0x4efd69 <_d_dso_registry+809>
   0x00000000004efcd2 <+658>:	mov    0x8(%rsp),%rdi
   0x00000000004efcd7 <+663>:	add    $0x30,%rdi
   0x00000000004efcdb <+667>:	callq  0x4f1bb0 <_D2rt4util9container5array13__T5ArrayTAvZ5Array7opSliceMNgFNaNbNiZANgAv>
   0x00000000004efce0 <+672>:	mov    %rax,%r14
   0x00000000004efce3 <+675>:	mov    %rdx,%rbx
   0x00000000004efce6 <+678>:	test   %r14,%r14
   0x00000000004efce9 <+681>:	je     0x4efd07 <_d_dso_registry+711>
   0x00000000004efceb <+683>:	add    $0x8,%rbx
   0x00000000004efcef <+687>:	nop
   0x00000000004efcf0 <+688>:	mov    -0x8(%rbx),%rsi
   0x00000000004efcf4 <+692>:	mov    (%rbx),%rdx
   0x00000000004efcf7 <+695>:	xor    %edi,%edi
   0x00000000004efcf9 <+697>:	callq  0x4dd940 <_D4core6memory2GC8addRangeFNbNixPvmxC8TypeInfoZv>
   0x00000000004efcfe <+702>:	add    $0x10,%rbx
   0x00000000004efd02 <+706>:	dec    %r14
   0x00000000004efd05 <+709>:	jne    0x4efcf0 <_d_dso_registry+688>
   0x00000000004efd07 <+711>:	mov    0x8(%rsp),%rbx
   0x00000000004efd0c <+716>:	mov    %rbx,%rdi
   0x00000000004efd0f <+719>:	callq  0x4eed60 <_D2rt5minfo11ModuleGroup9sortCtorsMFZv>
   0x00000000004efd14 <+724>:	mov    %rbx,%rdi
   0x00000000004efd17 <+727>:	callq  0x4ef110 <_D2rt5minfo11ModuleGroup8runCtorsMFZv>
   0x00000000004efd1c <+732>:	mov    %rbx,%rdi
   0x00000000004efd1f <+735>:	callq  0x4ef180 <_D2rt5minfo11ModuleGroup11runTlsCtorsMFZv>
   0x00000000004efd24 <+740>:	jmp    0x4efd69 <_d_dso_registry+809>
   0x00000000004efd26 <+742>:	lea    0x30(%r15),%r14
   0x00000000004efd2a <+746>:	mov    %fs:0x0,%rax
   0x00000000004efd33 <+755>:	lea    -0x10(%rax),%rax
   0x00000000004efd3a <+762>:	mov    (%rax),%rdi
   0x00000000004efd3d <+765>:	callq  0x4f1bc0 <_D2rt4util9container5array13__T5ArrayTAvZ5Array7popBackMFNbNiZv>
   0x00000000004efd42 <+770>:	lea    0x2d3c37(%rip),%rbx        # 0x7c3980 <_D2rt19sections_elf_shared11_loadedDSOsS2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array>
   0x00000000004efd49 <+777>:	mov    %rbx,%rdi
   0x00000000004efd4c <+780>:	callq  0x4f1cc0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array7popBackMFNbNiZv>
   0x00000000004efd51 <+785>:	mov    %r14,%rdi
   0x00000000004efd54 <+788>:	callq  0x4f1ae0 <_D2rt4util9container5array13__T5ArrayTAvZ5Array5resetMFNbNiZv>
   0x00000000004efd59 <+793>:	mov    %r15,%rdi
   0x00000000004efd5c <+796>:	callq  0x404c10 <free@plt>
   0x00000000004efd61 <+801>:	mov    %rbx,%rdi
   0x00000000004efd64 <+804>:	callq  0x4f1ca0 <_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb>
   0x00000000004efd69 <+809>:	add    $0xa8,%rsp
   0x00000000004efd70 <+816>:	pop    %rbx
   0x00000000004efd71 <+817>:	pop    %r12
   0x00000000004efd73 <+819>:	pop    %r14
   0x00000000004efd75 <+821>:	pop    %r15
   0x00000000004efd77 <+823>:	retq   
   0x00000000004efd78 <+824>:	ud2    
=> 0x00000000004efd7a <+826>:	ud2    
End of assembler dump.

@kinke
Copy link
Member

kinke commented Sep 25, 2017

@tchaloupka: Could you please test whether it's working without -flto=thin?

@tchaloupka
Copy link

@kinke: Sure. Tried that just getting the verbose output from combined build generated with dub and removed the switch. It indeed worked without it.

@kinke
Copy link
Member

kinke commented Sep 25, 2017

Thx. What linker are you using? If it's bfd, can you give gold a try via -Xcc=-fuse-ld=gold?

@tchaloupka
Copy link

Yes it is bfd. Tested it with the flag and with -flto=thin again and it worked.

@kinke
Copy link
Member

kinke commented Sep 25, 2017

Alright, so you're seeing #2278. -Xcc=-fuse-ld=gold is mentioned in the release log.

@tchaloupka
Copy link

Thx and sorry for the noise :)

@kinke
Copy link
Member

kinke commented Oct 30, 2017

Interestingly, one binary, vibe-test_utils, which is the only binary that doesn't link to shared libraries, does not crash with SIGILL

@ximion: I checked the dependencies of libvibe-utils.so.0 in your archive. It's not linked against shared druntime/Phobos; the static runtime libs have been linked in. I guess the same is happening with other binaries, each featuring its own embedded runtime, and causing the issues.
Your Debian package most likely only ships with shared runtime libs, while the official one used by Travis ships with both sets. The static libs are used by default; the shared ones (with -shared name suffix) are currently to be selected via -{default,debug}lib.

@ximion
Copy link
Contributor Author

ximion commented Oct 30, 2017

Are you really sure about that? The Debian archive tolls warn about these things, and the package depends on the LDC phobos package, as expected. The LDC-Phobos Debian package also ships with both the shared and static libraries, while only dependencies on the shared lib are allowed in the archive.
Furthermore:

:~$ ldd /usr/lib/x86_64-linux-gnu/libvibe-utils.so.0 
        linux-vdso.so.1 (0x00007ffc56f8d000)
        libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f1c184b0000)
        libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f1c18245000)
        libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 (0x00007f1c17fef000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1c17dd5000)
        libphobos2-ldc.so.74 => /usr/lib/x86_64-linux-gnu/libphobos2-ldc.so.74 (0x00007f1c1771e000)
        libdruntime-ldc.so.74 => /usr/lib/x86_64-linux-gnu/libdruntime-ldc.so.74 (0x00007f1c17406000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1c171fe000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1c16ffa000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1c16ddd000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1c16ad9000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1c1673c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1c18ba0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1c16525000)

Everything looks exactly like it should look.

@kinke
Copy link
Member

kinke commented Oct 30, 2017

I'm talking about the vibe library in the archive you posted, compiled with an official release package on Travis, not about the official Debian lib you are apparently referring to:

ldd /media/sf_temp/libvibe-utils.so.0
	linux-vdso.so.1 =>  (0x00007ffdeafe4000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3af0db7000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3af0b9a000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3af0984000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3af05ba000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3af141e000)

[Related to 'Interestingly, this only happens on Travis with the prebuilt binaries.']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants