reassign 846742 gdc
stop

On Sat, Dec 3, 2016 at 9:21 AM, Lucas Nussbaum <lu...@debian.org> wrote:

> Relevant part (hopefully):
>> /usr/bin/ld: dsimpleapp@exe/utils.d.o: relocation R_X86_64_PC32 against 
>> symbol 
>> `_D3std5array17__T8appenderTAyaZ8appenderFNaNbNfZS3std5array17__T8AppenderTAyaZ8Appender'
>>  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

This seems to be a bug in GDC since it happens on only this one
platform and net searching says that GCC has had problems with symbol
interpositioning in the past. This is easy to replicate without Meson.
Write this code to source.d:

import std.stdio;
import utils;
import std.string : format;

void printGreeting (string name)
{
    writeln ("Hello, I am %s.".format (name));
}

void main ()
{
    printGreeting ("a Meson D test");
}

Compiling it with 'gdc -o prog source.d' gives the same error.
Removing the string formatting portion makes it work again as does
compiling with -fPIC, but if that is somehow always needed GDC should
either add -fPIC itself, error out earlier or, at the very least,
print a more relevant error message. LDC compiles this same program
without errors without needing -fPIC.

If this issue is in GDC and it is not fixed until the next release,
Meson will fix the issue by changing the build dep from gdc to ldc.

Thanks,

Reply via email to