Skip to content

Hello World segfault with Phobos as shared library #194

@kefahi

Description

@kefahi

Hello,

I'm using the latest Fedora 18 (spherical cow) 64 bits on my Ivy Bridge i7-3520M Lenovo T430.
Running the simplest hello-world program segfaults.

It looks to me like an alignment issue due to the cpu arch.
Note : This very code runs without issues on a Virtual Machine (Fedora 18 with latest updates).

Here are more details :

Fedora 18 64bits latest updates.

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.6.1-1.fc18.x86_64 #1 SMP Mon Oct 8
17:19:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#  rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' ldc
ldc-2-33.20121007git0777102.fc18

[kefah@localhost Development]$ cat hello.d 
import std.stdio;
void main() { writeln("Hello, World!"); }
[kefah@localhost Development]$ rm hello hello.o
[kefah@localhost Development]$ ldc2 -g hello.d
[kefah@localhost Development]$ gdb ./hello 
GNU gdb (GDB) Fedora (7.5.0.20120926-25.fc18)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/kefah/Development/hello...done.
(gdb) run
Starting program: /home/kefah/Development/hello 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
core.cpuid.cpuidX86() () at cpuid.d:610
610         xfeatures = cast(ulong)d << 32 | a;

(Edit by @klickverbot: I moved the strace output here, as it doesn't seem to be interesting, yet is huge.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions