Bug 20279 – druntime PR #2821 causes link error for Fiber-dependent code
Status
RESOLVED
Resolution
WORKSFORME
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-10-07T21:04:05Z
Last change time
2019-10-07T21:44:58Z
Assigned to
No Owner
Creator
hsteoh
Comments
Comment #0 by hsteoh — 2019-10-07T21:04:05Z
Druntime PR #2821 (core.thread.refactor) has broken druntime for code that needs to link with Fiber routines like core.thread.Fiber.yield:
Sample code:
------------
import core.thread : Fiber;
void main() {
auto f = new Fiber(() {
Fiber.yield();
});
}
------------
Compiler output:
------------
/usr/bin/ld: test.o: in function `_Dmain':
test.d:(.text._Dmain[_Dmain]+0xb): undefined reference to `_D4core6thread5fiber5Fiber7__ClassZ'
/usr/bin/ld: test.d:(.text._Dmain[_Dmain]+0x1e): undefined reference to `_D4core6thread8osthread8PAGESIZEym'
/usr/bin/ld: test.d:(.text._Dmain[_Dmain]+0x35): undefined reference to `_D4core6thread5fiber5Fiber6__ctorMFNbPFZvmmZCQBrQBpQBlQBi'
/usr/bin/ld: test.o: in function `_D4test4mainFZ9__lambda1FNbNiZv':
test.d:(.text._D4test4mainFZ9__lambda1FNbNiZv[_D4test4mainFZ9__lambda1FNbNiZv]+0x5): undefined reference to `_D4core6thread5fiber5Fiber5yieldFNbNiZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
------------
Reverting to druntime commit 44d25a123616bd7f9332d67a28153286a5442f91 (the one just before PR #2821 was merged) fixes the problem.
Comment #1 by hsteoh — 2019-10-07T21:44:58Z
Gah, looks like this was a problem with an unclean local druntime build environment. Nuking all build products from druntime and phobos and rebuilding everything from scratch seems to have made this problem go away. Sorry for the false alarm. :-(