On 06/18/2014 08:51 AM, Reuben wrote:
On Sunday, 15 June 2014 at 09:08:10 UTC, Mike Wey wrote:
In that case the static Phobos needs to be build with -fPIC, which
currently isn't the case looking at the Ebuild.

Compiling DMD with PIC=1 doesn't seem to do the trick. -fPIC is used for
the C files, but when linking Phobos the following appears:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld:
generated/linux/release/64/libphobos2.so.0..o: warning: relocation in
readonly section `.deh_eh'.
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld:
warning: creating a DT_TEXTREL in object.

Compiling dmd with -fPIC shoudn't matter, building the static version of Phobos works for me (make -f posix.mak DFLAGS="-fPIC"), but i don't have an hardened gcc, so that may be why.

Google tells me the DT_TEXTREL error is because of non -fPIC objects in a shared library.

Compiling with it then gives the following:
$ ./dmd test.d
... error ...

readelf doesn't show any TEXTRELs in libc, so I assume it is also hardened.

test.d still needs to be build with -fPIC.

--
Mike Wey

Reply via email to