[Issue 18526] New: Linker error when calling rt_init from C code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 26 18:52:37 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18526

          Issue ID: 18526
           Summary: Linker error when calling rt_init from C code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: mihails.strasuns at gmail.com

Linux, both Ubuntu and Arch, both tarball downloads and from package manager:

---
$ cat main.c
extern int rt_init();

int main ( )
{
    rt_init();
    return 0;
}
$ gcc ./main.c /path/to/druntime.a
/usr/bin/ld: error: /path/to/libdruntime.a(dmain2_65f_2f9.o): size of section
.dtors.d_dso_dtor[.data.d_dso_rec] is not multiple of address size
/usr/bin/ld: final link failed: Error reading (null): No error
---

Am I missing something obvious here? Adding trivial D wrapper like this:

---
extern(C) void rt_init ( );

extern(C) void foo ( )
{
    rt_init();
}
---

.. fixes the problem, so the assumption is it is somehow related to how runtime
library is built.

--


More information about the Digitalmars-d-bugs mailing list