On 26.11.2016 11:38, Peter De Wachter wrote: > Hello Matthias and Iain, > > Is it an expected effect that some programs now need to be build with > -fPIC? For example: > > $ cat >test.d > import std.conv; > void main() { > string b; > float c; > to!int(b); > to!string(c); > } > > $ gdc -o test test.d > /usr/bin/ld: /tmp/cc6LR10G.o: relocation R_X86_64_PC32 against symbol > `_D3std6format18__T10FormatSpecTaZ10FormatSpec6flPlusMxFNaNbNdNiNfZb' > can not be used when making a shared object; recompile with -fPIC > /usr/bin/ld: final link failed: Bad value > collect2: error: ld returned 1 exit status > > $ gdc --version > gdc (Debian 6.2.1-5) 6.2.1 20161124 > Copyright (C) 2016 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This build is configured with --enable-default-pie. The linker is now called with -pie, but cc1d isn't passed either -fPIE, or -fPIC. The work around is to pass either -fPIC, or -no-pie. Also passing -fPIE doesn't have an effect.