Bug 19701 – undefined reference to `_D6object__T6hashOf
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-02-26T18:53:26Z
Last change time
2019-05-16T08:37:11Z
Keywords
pull
Assigned to
No Owner
Creator
Andre
Comments
Comment #0 by andre — 2019-02-26T18:53:26Z
This is a regression occuring on linux and windows and started about ~ 2.084.0.
Create file app.d with these 2 lines
import std.string;
void main(){}
And execute dmd with command (this is the linux version):
dmd -m64 -c -ofdlang-sample.o -unittest -Xfdocs.json -Df__dummy.html -Isource app.d && dmd -ofdlang-sample dlang-sample.o -m64
dlang-sample.o: In function `_D3std8typecons__T5TupleTaTaZQl6toHashMxFNaNbNiNfZm':
app.d:(.text._D3std8typecons__T5TupleTaTaZQl6toHashMxFNaNbNiNfZm[_D3std8typecons__T5TupleTaTaZQl6toHashMxFNaNbNiNfZm]+0x19): undefined reference to `_D6object__T6hashOfTxaZQlFNaNbNiNfKxaZm'
app.d:(.text._D3std8typecons__T5TupleTaTaZQl6toHashMxFNaNbNiNfZm[_D3std8typecons__T5TupleTaTaZQl6toHashMxFNaNbNiNfZm]+0x32): undefined reference to `_D6object__T6hashOfTxaZQlFNaNbNiNfKxaZm'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
Comment #1 by kinke — 2019-02-26T19:32:49Z
Simpler command line (yes, -Df is mandatory):
dmd -m64 -unittest -Df__dummy.html app.d
On Windows, -m32 somehow links successfully, -m32mscoff doesn't.
Comment #2 by kinke — 2019-02-26T19:47:34Z
The object files differ. With `-Df`, there's an external reference to _D6object__T6hashOfTxaZQlFNaNbNiNfKxaZm, while it's _D4core8internal4hash__T6hashOfTaZQkFNaNbNiNexaZm without that switch.
Looking at object.d, that's because -Df defines `version=D_Ddoc`, so that object.hashOf isn't an alias, but a wrapper: https://github.com/dlang/druntime/blob/58dcda229e0658451325b70243fb5cb67c6cda46/src/object.d#L4080-L4115
@rainers created dlang/druntime pull request #2609 "fix Issue 19701 - undefined reference to _D6object__T6hashOf" fixing this issue:
- fix Issue 19701 - undefined reference to _D6object__T6hashOf
use CoreDdoc instead of D_Ddoc
https://github.com/dlang/druntime/pull/2609
Comment #5 by dlang-bot — 2019-05-16T08:37:11Z
dlang/druntime pull request #2609 "fix Issue 19701 - undefined reference to _D6object__T6hashOf" was merged into stable:
- 3262245e82074bb068a367e4fee69ef1969d0982 by Rainer Schuetze:
fix Issue 19701 - undefined reference to _D6object__T6hashOf
use CoreDdoc instead of D_Ddoc
https://github.com/dlang/druntime/pull/2609