Bug 11406 – ld.gold breaks switch table jumps

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-31T20:39:00Z
Last change time
2015-06-09T05:11:55Z
Keywords
link-failure, pull
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2013-10-31T20:39:09Z
cat > bug.d << CODE import std.stdio; void main() { writefln("Hello %1$s!", "World"); } CODE dmd -run bug ---- When debugging this gdb constantly barks that it can't find the function frames. In this specific program the format spec is incorrect. It seems that some data/code is corrupted when linking with gold. We should investigate whether this is an issue in dmd's codegen.
Comment #1 by atila.neves — 2013-11-14T04:28:29Z
*** Issue 11492 has been marked as a duplicate of this issue. ***
Comment #2 by atila.neves — 2013-11-14T04:31:49Z
I think the importance is higher than normal. It's not just not being able to debug, the produced executables can actually crash and do so if using std.concurrency. See this duplicate I filed: https://d.puremagic.com/issues/show_bug.cgi?id=11492
Comment #3 by code — 2013-11-14T07:00:48Z
(In reply to comment #2) > I think the importance is higher than normal. I think so too, raised to critical. Seems like more people (distributions?) begin to use ld.gold. Probably due to reduced link times.
Comment #4 by code — 2013-11-14T09:30:49Z
cat > bug.d << CODE enum Op { a, b, c, d, } void bug(Op op) { final switch (op) { case Op.a: case Op.b: case Op.c: case Op.d: } } void main() { bug(Op.a); } CODE There are an extra 8-bytes at the start of the switch table. Maybe an alignment issue?
Comment #5 by code — 2013-11-14T12:09:07Z
Comment #6 by github-bugzilla — 2013-11-17T00:38:23Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/905d00af03efc9f8bbdb3d25e9776b0d0061783e fix Issue 11406 - ld.gold breaks switch table jumps - This is due to the fact that gold doesn't add target addends to relocations (only uses the 64-bit rela addend). https://github.com/D-Programming-Language/dmd/commit/854896cab40632cd3d2cd40d6461c62c36e6a79a Merge pull request #2768 from dawgfoto/fix11406 fix Issue 11406 - ld.gold breaks switch table jumps
Comment #7 by github-bugzilla — 2013-11-17T00:44:40Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/774eb391bbf324a5ab064a19cc48e549719958b1 Merge pull request #2768 from dawgfoto/fix11406 fix Issue 11406 - ld.gold breaks switch table jumps