Skip to content

Cross-module inlining: Linker errors wrt. functions taking __FILE__ as default template parameter #1712

@tchaloupka

Description

@tchaloupka

Just tried to build sample project (dub init -t vibe.d test) with dub build -b release --compiler=ldc2 --combined and it fails. Its ok with dmd.

It's ok without combined flag and also when built without release optimisations, so I guess something with the inlining.

DUB version 1.0.0+28-geeff313, built on Aug 20 2016
It issues these flags to ldc2: -release -enable-inlining -O -w -oq

LDC the LLVM D compiler (1.1.0-beta2):
based on DMD v2.071.1 and LLVM 3.8.0
built with LDC - the LLVM D compiler (1.1.0-beta2)
Default target: x86_64-unknown-linux-gnu
Host CPU: broadwell

Fedora 24

Output:

$ dub build --combined --compiler=ldc2 -b release | ddemangle
Performing "release" build using ldc2 for x86_64.
depstest ~master: building configuration "application"...
.dub/obj/vibe.crypto.cryptorand.o: In function `vibe.crypto.cryptorand.SystemRNG vibe.crypto.cryptorand.SystemRNG.__ctor()':
../../../.dub/packages/vibe-d-0.7.30-alpha.4/vibe-d/source/vibe/crypto/cryptorand.d:(.text.vibe.crypto.cryptorand.SystemRNG vibe.crypto.cryptorand.SystemRNG.__ctor()[vibe.crypto.cryptorand.SystemRNG vibe.crypto.cryptorand.SystemRNG.__ctor()]+0x66): undefined reference to `@safe shared(core.stdc.stdio._IO_FILE)* std.exception.__T12errnoEnforceTPOS4core4stdc5stdio8_IO_FILEVAyaa60_2f6f70742f6c6463322d312e312e302d62657461322d6c696e75782d7838365f36342f62696e2f2e2e2f696d706f72742f7374642f737464696f2e64Vmi498Z.errnoEnforce(shared(core.stdc.stdio._IO_FILE)*, lazy immutable(char)[])'
../../../.dub/packages/vibe-d-0.7.30-alpha.4/vibe-d/source/vibe/crypto/cryptorand.d:(.text.vibe.crypto.cryptorand.SystemRNG vibe.crypto.cryptorand.SystemRNG.__ctor()[vibe.crypto.cryptorand.SystemRNG vibe.crypto.cryptorand.SystemRNG.__ctor()]+0x12a): undefined reference to `@safe bool std.exception.errnoEnforce!(bool, "/opt/ldc2-1.1.0-beta2-linux-x86_64/bin/../import/std/stdio.d", 1161uL).errnoEnforce(bool, lazy immutable(char)[])'
.dub/obj/vibe.core.log.o: In function `@safe void vibe.core.log.FileLogger.endLine()':
../../../.dub/packages/vibe-d-0.7.30-alpha.4/vibe-d/source/vibe/core/log.d:(.text.@safe void vibe.core.log.FileLogger.endLine()[@safe void vibe.core.log.FileLogger.endLine()]+0x64): undefined reference to `@safe bool std.exception.errnoEnforce!(bool, "/opt/ldc2-1.1.0-beta2-linux-x86_64/bin/../import/std/stdio.d", 850uL).errnoEnforce(bool, lazy immutable(char)[])'
.dub/obj/vibe.core.log.o: In function `void vibe.core.log.HTMLLogger.__dtor()':
../../../.dub/packages/vibe-d-0.7.30-alpha.4/vibe-d/source/vibe/core/log.d:(.text.void vibe.core.log.HTMLLogger.__dtor()[void vibe.core.log.HTMLLogger.__dtor()]+0x6c): undefined reference to `@safe bool std.exception.errnoEnforce!(bool, "/opt/ldc2-1.1.0-beta2-linux-x86_64/bin/../import/std/stdio.d", 850uL).errnoEnforce(bool, lazy immutable(char)[])'
.dub/obj/vibe.core.log.o: In function `@safe void vibe.core.log.HTMLLogger.endLine()':
../../../.dub/packages/vibe-d-0.7.30-alpha.4/vibe-d/source/vibe/core/log.d:(.text.@safe void vibe.core.log.HTMLLogger.endLine()[@safe void vibe.core.log.HTMLLogger.endLine()]+0x80): undefined reference to `@safe bool std.exception.errnoEnforce!(bool, "/opt/ldc2-1.1.0-beta2-linux-x86_64/bin/../import/std/stdio.d", 850uL).errnoEnforce(bool, lazy immutable(char)[])'
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
ldc2 failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions