digitalmars.D.bugs - [Issue 19551] New: corrupt ELF library when using
- d-bugmail puremagic.com (43/43) Jan 05 2019 https://issues.dlang.org/show_bug.cgi?id=19551
https://issues.dlang.org/show_bug.cgi?id=19551 Issue ID: 19551 Summary: corrupt ELF library when using pragma(crt_constructor) Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: r.sagitario gmx.de building these 2 files to a library: ////////////////////////////////// module lib18456; __gshared int initVar; pragma(crt_constructor) extern(C) void mir_cpuid_crt_init() { initVar = 42; } ///////////////////////////////// module test18456b; class ManualGC { void enable() {} void disable() {} } with "dmd -m64 -oftest.a -lib test18456b.d test18456.d" produces a corrupt library that when linked with ///////////////////////////////// import lib18456; void main() { assert(initVar == 42); } via via "dmd -m64 test18456.d test.a" produces: /usr/bin/ld: error: test.a(lib18456.o): size of section .ctors is not multiple of address size /usr/bin/ld: final link failed: Bad value As the root corruption is not limited to use of pragma(crt_constructor), but just goes unnoticed otherwise, I've raised severity to "critical". --
Jan 05 2019