April 07
https://issues.dlang.org/show_bug.cgi?id=24486

          Issue ID: 24486
           Summary: Compiling programs with statics produces complaints
                    from the linker and no executable
           Product: D
           Version: D2
          Hardware: x86_64
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: donaldcallen1942@icloud.com

import std.stdio;

int main(string[] args)
{
    static int foo;
    foo = 1;
    writefln("%d", foo);
    return 0;
}
Compiling with dmd produces some interesting complaints from the linker,
whereas compiling with ldc (1.35) does not:

(dmd-2.107.1)dca@giovanni:/tmp$ dmd testit.d
ld: error: testit.o:(function D main: .text._Dmain+0xe): R_X86_64_GOTTPOFF must
be used in MOVQ or ADDQ instructions only
ld: error: testit.o:(function D main: .text._Dmain+0x26): R_X86_64_GOTTPOFF
must be used in MOVQ or ADDQ instructions only
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
(dmd-2.107.1)dca@giovanni:/tmp$ ls -l testit
ls: testit: No such file or directory
(dmd-2.107.1)dca@giovanni:/tmp$ ldc2 testit.d
(dmd-2.107.1)dca@giovanni:/tmp$ testit
1
(dmd-2.107.1)dca@giovanni:/tmp$

--