http://d.puremagic.com/issues/show_bug.cgi?id=5278



--- Comment #13 from Chad Joan <chadj...@gmail.com> 2011-09-19 23:26:19 PDT ---
I have taken another crack at this.

After some compiling of D on a roommate's non-hardened Gentoo system I found
that if I recompile my gcc without the hardened useflag and then compile my D
programs, the D programs won't segfault.  This round of testing was done with
64-bit DMD.  

In short: using hardened GCC will trigger this.

I was pointed in this direction by observing the last line of the output of
compiling with dmd -v:
gcc main.o -o main -m64 -Xlinker
-L/usr/local/share/dcompilers/dmd/linux/bin64/../lib64 -Xlinker
-L/usr/local/share/dcompilers/dmd/linux/bin64/../lib32 -Xlinker
--no-warn-search-mismatch -Xlinker --export-dynamic -lrt -lphobos2 -lpthread
-lm 

Notably, it is using gcc for its linking step.

After a bit of browsing in the DMD sources, a workaround presents itself.  DMD
just uses the CC environment variable to determine what to use for linking, so
it is possible to build an isolated non-hardened GCC and then use that to
compile D programs.  It would look like this:
CC=custom-gcc dmd -v main.d -ofmain

At some point I may bisect the older changes in DMD to find out where this
regression was introduced.  I can see this ending up in the backend though, so
I'm not sure I'll be able to understand the code I end up in.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to