http://d.puremagic.com/issues/show_bug.cgi?id=5278
--- Comment #29 from Chad Joan <chadj...@gmail.com> 2012-02-05 14:06:08 PST --- (In reply to comment #28) > Yeah, it's a limitation that dmd doesn't let you pass flags to gcc. It's a > different bug though. > > Have you actually tried to build PIE using dmd's -fPIC flag. > You'd need to rebuild druntime and phobos with the fPIC too. > I think PIE will work without further changes. It seemed like it was working before, but I did it again with more rigor to try and confirm that all of the flags are what I think they are. It didn't work too well. Here's what happened: druntime compile: http://pastebin.com/e5HjcVRb phobos compile: http://pastebin.com/4uATCBt1 executable compile: chad@Hugin /mnt/bulk/dprojects/helloD2 $ dmd -fPIC -c main.d chad@Hugin /mnt/bulk/dprojects/helloD2 $ gcc main.o -o main -m32 -Xlinker -L/usr/local/share/dcompilers/dmd/linux/bin/../lib -lphobos2 -lpthread -lm -lrt -fPIC -pie /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object. chad@Hugin /mnt/bulk/dprojects/helloD2 $ main main: error while loading shared libraries: cannot make segment writable for relocation: Permission denied chad@Hugin /mnt/bulk/dprojects/helloD2 $ sudo paxctl -m main chad@Hugin /mnt/bulk/dprojects/helloD2 $ main Killed chad@Hugin /mnt/bulk/dprojects/helloD2 $ If I did something wrong, please let me know a better way. What's the issue# for the bug preventing DMD from forwarding arguments to GCC? It's actually really easy to write a patch for that. In fact, I did it so that I could continue working on my system. Otherwise there is no way for me to have DMD work on my system without hardcoding "-fno-pie" into dmd/src/link.c and compiling from git. Now, this is probably the wrong place for it, and I could stand to improve it slightly and make sure it works off of the latest git sources (I was working offline with this), but here is the patch for adding a -cflags parameter in DMD, just in case anyone wants it: http://pastebin.com/U6cTmryQ -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------