Linker error when building dmd backend

Thomas Mader thomas.mader at
Sun Dec 23 12:16:53 UTC 2018

On Sunday, 23 December 2018 at 10:15:53 UTC, Walter Bright wrote:
> On 12/22/2018 6:29 PM, Thomas Mader wrote:
>> To me it looks like fp.c has the implementation and evalu8 is 
>> using it.
>> The name mangling of fp.c compiled with g++ is different from 
>> evalu8.d compiled with ldc.
> I wonder why you're compile some parts with g++ and some with 
> ldc.

You are right I also like to keep things the same and less 
complex but to be honest I tried to use clang but failed. The std 
environment in Nix on Linux is gcc and I don't know yet how to 
properly overwrite it.
I also think that this might be one solution to the problem.
Still, it's unclear to me what is going on.

> When I have trouble with name mangling variations, I use 'grep' 
> to see what the name mangling is in the various object files, 
> then I fiddle with the declarations until they line up.

Well the problem is that the mangling produced by g++ is 
_Z7_moduloee but the mangling produced with ldc 1.13.0 on my 
environment is _Z7_moduloeS_ .
The first is a valid mangling according to some online demanglers 
but the last one isn't.
I then tried to compile evalu8 [1] with ldc 1.11.0 and dmd 
2.081.2 and they both produced the correct name mangling.
I tried to change the llvm version used when building ldc but 
that didn't solve my problem or introduced new ones.
I will now try to try again with ldc 1.11.0 but with a fresh 
build so I am sure that the environment for building 1.11.0 is 
exactly the same as for 1.13.0.
If that still doesn't fail the problem must be somewhere in ldc 
1.13.0 in combination with the environment I am using.

[1] ldmd2 -c -of../generated/linux/release/64/evalu8.o  
-version=MARS -fPIC -J../generated/linux/release/64 -w -de -O 
-release -inline -m64 -mv=dmd.backend=dmd/backend -betterC 

More information about the Digitalmars-d mailing list