Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name mangling problems with LDC 1.13.0 when building DMD 2.083.1 backend #2954

Closed
ThomasMader opened this issue Dec 23, 2018 · 5 comments
Closed

Comments

@ThomasMader
Copy link
Contributor

On NixOS building dmd 2.083.1 with LDC 1.13.0 doesn't work.
The link of the dmd backend fails with the following message:

../generated/linux/release/64/backend.a(evalu8.o):dmd/backend/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to 'Z7_moduloeS'
../generated/linux/release/64/backend.a(evalu8.o):dmd/backend/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to 'Z7_moduloeS'
../generated/linux/release/64/backend.a(evalu8.o):dmd/backend/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to 'Z7_moduloeS'
collect2: error: ld returned 1 exit status
Error: /nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin/c++ failed with status: 1

The created symbol Z7_moduloeS is not a valid name mangled symbol and the corresponding correctly mangled name created by the g++ or clang compilers is _Z7_moduloee .
The problem is reproducible on Linux and Mac OSX, the platform environments are listed below.
Keeping the same environment but switching to LDC version 1.11.0 solves the problem.

To reproduce the problem it's sufficient to just compile evalu8.d and check for the generated "modulo" symbol name:

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 dmd/backend/evalu8.d

I also tried with LLVM 7 but the unittests failed:

Test project /build/ldc-1.13.0-src/build
Start 1: build-ldc2-unittest
1/2 Test #1: build-ldc2-unittest .............. Passed 94.73 sec
Start 2: ldc2-unittest
2/2 Test #2: ldc2-unittest ....................***Exception: Child aborted 0.04 sec
Fatal error in EH code: DWARF header has unexpected format 2

It must be a bug in LDC 1.13.0 but what I don't understand is that Archlinux also uses LDC 1.13.0 to build DMD 2.083.1 at least according to their package repository. (https://www.archlinux.org/packages/community/x86_64/ldc/)

Platform environments:

LDC - the LLVM D compiler (1.13.0):
based on DMD v2.083.1 and LLVM 5.0.2 (also tried with LLVM 6)
built with LDC - the LLVM D compiler (0.17.6)

Linux:
Default target: x86_64-unknown-linux-gnu
Host CPU: ivybridge
C++ Compiler: g++ (GCC) 7.3.0

OSX:
Default target: x86_64-apple-darwin17.7.0
Host CPU: haswell
C++ Compiler: clang 5.0.2

See also the forum discussion at https://forum.dlang.org/post/dsrjmpnavxqsjqmlvotf@forum.dlang.org

@JohanEngelen
Copy link
Member

#2953

@JohanEngelen
Copy link
Member

Thanks for reporting this here btw :)

@joakim-noah
Copy link
Contributor

Archlinux also uses LDC 1.13.0 to build DMD 2.083.1 at least according to their package repository

Maybe they already built that DMD package with LDC 1.12, so they didn't hit the problem with 1.13 yet, which came out later.

@kinke
Copy link
Member

kinke commented Jan 20, 2019

Fixed in v1.14.

@ThomasMader
Copy link
Contributor Author

Tested building dmd 2.084 with ldc 1.14-beta1 under Linux and OSX with Nix.
It's working, on OSX dmd needs to be patched with dlang/dmd@e779043 for a successful build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants