Bug 18526 – Linker error when calling rt_init from C code

Status
NEW
Severity
minor
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-26T18:52:37Z
Last change time
2024-12-07T13:38:03Z
Assigned to
No Owner
Creator
Mihails Strasuns
Moved to GitHub: dmd#17164 →

Comments

Comment #0 by mihails.strasuns — 2018-02-26T18:52:37Z
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.
Comment #1 by robert.schadek — 2024-12-07T13:38:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17164 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB