[Issue 5278] gentoo's 'hardended' gcc doesn't work with dmd

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 25 21:05:24 PST 2012


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



--- Comment #26 from Chad Joan <chadjoan at gmail.com> 2012-01-25 21:05:07 PST ---
(In reply to comment #25)
> >I suspect this -fno-pie thing will make shared libraries impossible on my setup
> >until this gets resolved though, right?
> No, it doesn't.
> PIE simply means randomized address space for the executable.
> I do even think that PIE should work out of the box if you
> compile phobos and you executables with -fPIC.

Oh, my bad.  I confused PIE with PIC.  

So, just to be clear, -fpie is not passed by default on most systems, but it is
on mine (a feature of the hardened GCC).  DMD's binary release of phobos is
then compiled WITHOUT -fpie because that's the usual course of things, thus
causing it to complain when I link it with something that compiles WITH -fpie.  

Is there any chance that -fno-pie could make it into the list of things DMD
passes to GCC by default?  

Assuming I understand this all correctly, then other systems won't care if
-fno-pie gets passed because they don't use PIE anyways.  On my system it will
convert a dead-on-arrival binary release into something that works.  

If someone still wanted to build with PIE then the ideal, I suppose, would be
to have portage (the package manager) build everything from source, adding
-fpie and -fPIC as necessary and adjusting the dmd.conf file to reflect it.

Also, is it even possible to get -fno-pie in there through dmd.conf?

When I add -L-fno-pie in dmd.conf it adds "-Xlinker -fno-pie" instead of just
"-fno-pie" to the GCC args and it seems to end up going to the wrong place. 
Then I get linker errors and stuff won't build: http://pastebin.com/wEcuyUqp

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


More information about the Digitalmars-d-bugs mailing list