www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Linker error when building dmd backend

reply Thomas Mader <thomas.mader gmail.com> writes:
Hello,

I updated dmd on NixOS from 2.081.2 to 2.083.1 but get the 
following linker errors when the backend is linked:

../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

I use ldc 1.13.0 as my bootstrap compiler but Archlinux does that 
too so I don't think that's the reason.
Anybody an idea?

Thomas
Dec 22 2018
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Saturday, 22 December 2018 at 21:58:13 UTC, Thomas Mader wrote:
 Hello,

 I updated dmd on NixOS from 2.081.2 to 2.083.1 but get the 
 following linker errors when the backend is linked:

 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to
'_Z7_moduloeS_'
 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to
'_Z7_moduloeS_'
 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/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

 I use ldc 1.13.0 as my bootstrap compiler but Archlinux does 
 that too so I don't think that's the reason.
 Anybody an idea?

 Thomas
run a make clean. probably files which changed in the backend are not recompiled? Otherwise it's mangling bugs.
Dec 22 2018
parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Saturday, 22 December 2018 at 22:40:18 UTC, Stefan Koch wrote:
 On Saturday, 22 December 2018 at 21:58:13 UTC, Thomas Mader 
 wrote:
 Hello,

 I updated dmd on NixOS from 2.081.2 to 2.083.1 but get the 
 following linker errors when the backend is linked:

 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to
'_Z7_moduloeS_'
 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/evalu8.d:function evalu8(elem*, unsigned int): error: undefined reference to
'_Z7_moduloeS_'
 ../generated/linux/release/64/backend.a(evalu8.o):dmd/backe
d/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

 I use ldc 1.13.0 as my bootstrap compiler but Archlinux does 
 that too so I don't think that's the reason.
 Anybody an idea?

 Thomas
run a make clean. probably files which changed in the backend are not recompiled? Otherwise it's mangling bugs.
It's always a fresh build when building a NixOS package. I looked into backend.a for the symbol: objdump -D backend.a | grep modulo 0000000000000040 <_Z7_moduloee>: 40: e9 00 00 00 00 jmpq 45 <_Z7_moduloee+0x5> Maybe that's connected to https://forum.dlang.org/post/odimguuqtekosmtliyhf forum.dlang.org
Dec 22 2018
parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Saturday, 22 December 2018 at 23:02:04 UTC, Thomas Mader wrote:
 It's always a fresh build when building a NixOS package.
 I looked into backend.a for the symbol:

 objdump -D backend.a | grep modulo
 0000000000000040 <_Z7_moduloee>:
   40:	e9 00 00 00 00       	jmpq   45 <_Z7_moduloee+0x5>

 Maybe that's connected to 
 https://forum.dlang.org/post/odimguuqtekosmtliyhf forum.dlang.org
I enabled more debug output from the Nix environment so the compiler flags can be seen. CC="c++" ldmd2 -of../generated/linux/release/64/dmd -m64 -vtls -J../generated/linux/release/64 -J../res -L-lstdc++ -version=MARS -fPIC -J../generated/linux/release/64 -w -de -O -release -inline dmd/access.d dmd/aggregate.d dmd/aliasthis.d dmd/apply.d dmd/argtypes.d dmd/arrayop.d dmd/arraytypes.d dmd/astcodegen.d dmd/attrib.d dmd/builtin.d dmd/canthrow.d dmd/cli.d dmd/clone.d dmd/compiler.d dmd/complex.d dmd/cond.d dmd/constfold.d dmd/cppmangle.d dmd/cppmanglewin.d dmd/ctfeexpr.d dmd/ctorflow.d dmd/dcast.d dmd/dclass.d dmd/declaration.d dmd/delegatize.d dmd/denum.d dmd/dimport.d dmd/dinifile.d dmd/dinterpret.d dmd/dmacro.d dmd/dmangle.d dmd/dmodule.d dmd/doc.d dmd/dscope.d dmd/dstruct.d dmd/dsymbol.d dmd/dsymbolsem.d dmd/dtemplate.d dmd/dversion.d dmd/escape.d dmd/expression.d dmd/expressionsem.d dmd/func.d dmd/hdrgen.d dmd/id.d dmd/impcnvtab.d dmd/imphint.d dmd/init.d dmd/initsem.d dmd/inline.d dmd/inlinecost.d dmd/intrange.d dmd/json.d dmd/lambdacomp.d dmd/lib.d dmd/libelf.d dmd/libmach.d dmd/link.d dmd/mars.d dmd/mtype.d dmd/nogc.d dmd/nspace.d dmd/objc.d dmd/opover.d dmd/optimize.d dmd/parse.d dmd/permissivevisitor.d dmd/sapply.d dmd/templateparamsem.d dmd/sideeffect.d dmd/statement.d dmd/staticassert.d dmd/target.d dmd/typesem.d dmd/traits.d dmd/transitivevisitor.d dmd/parsetimevisitor.d dmd/visitor.d dmd/typinf.d dmd/utils.d dmd/scanelf.d dmd/scanmach.d dmd/statement_rewrite_walker.d dmd/statementsem.d dmd/staticcond.d dmd/safe.d dmd/blockexit.d dmd/printast.d dmd/semantic2.d dmd/semantic3.d dmd/irstate.d dmd/toctype.d dmd/glue.d dmd/gluelayer.d dmd/todt.d dmd/tocsym.d dmd/toir.d dmd/dmsc.d dmd/tocvdebug.d dmd/s2ir.d dmd/toobj.d dmd/e2ir.d dmd/eh.d dmd/iasm.d dmd/iasmdmd.d dmd/iasmgcc.d dmd/objc_glue.d dmd/backend/cc.d dmd/backend/cdef.d dmd/backend/cgcv.d dmd/backend/code.d dmd/backend/cv4.d dmd/backend/dt.d dmd/backend/el.d dmd/backend/global.d dmd/backend/obj.d dmd/backend/oper.d dmd/backend/outbuf.d dmd/backend/rtlsym.d dmd/backend/code_x86.d dmd/backend/iasm.d dmd/backend/ty.d dmd/backend/type.d dmd/backend/exh.d dmd/backend/mach.d dmd/backend/mscoff.d dmd/backend/dwarf.d dmd/backend/dwarf2.d dmd/backend/xmm.d dmd/backend/dlist.d dmd/backend/melf.d dmd/backend/varstats.d dmd/root/aav.d dmd/root/man.d dmd/root/response.d dmd/root/speller.d dmd/root/longdouble.d ../generated/linux/release/64/newdelete.o ../generated/linux/release/64/backend.a ../generated/linux/release/64/lexer.a HARDENING: disabled flags: pie HARDENING: Is active (not completely disabled with "all" flag) HARDENING: enabling fortify HARDENING: enabling stackprotector HARDENING: enabling strictoverflow HARDENING: enabling format HARDENING: enabling pic extra flags before to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -Wformat -Wformat-security -Werror=format-security -fPIC -Wl\,-dynamic-linker -Wl\,/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ld-linux-x86-64.so.2 original flags to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: ../generated/linux/release/64/dmd.o ../generated/linux/release/64/newdelete.o ../generated/linux/release/64/backend.a ../generated/linux/release/64/lexer.a -o ../generated/linux/release/64/dmd -fuse-ld=gold -lstdc++ -L/nix/store/r29igl9gz0r6cvb3i28xh03anx936qbl-ldcBuild-1.13.0/lib -lphobos2-ldc -ldruntime-ldc -Wl\,--gc-sections -lrt -ldl -lpthread -lm -m64 extra flags after to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -B/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -B/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ -idirafter /nix/store/psqblh5bsgkbkhn4r648pgjw5rq4npkv-glibc-2.27-dev/include -idirafter /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -B/nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin/ -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include -Wl\,-rpath -Wl\,/nix/store/r2xapv59sz4cpa9zy9ydzck857r6xmrx-dmdBuild-2.083.1/lib64 -Wl\,-rpath -Wl\,/nix/store/r2xapv59sz4cpa9zy9ydzck857r6xmrx-dmdBuild-2.083.1/lib -L/nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/lib -L/nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/lib -L/nix/store/9vh9ysqr8hahnph1gppniv7zrdf218ds-nghttp2-1.35.0-lib/lib -L/nix/store/nsrwlly5ikwhppcslaazp547kh7q7j6s-zlib-1.2.11/lib -L/nix/store/yi0pwf9hybx6vhj2qdfa6krvxgvcbyi0-libkrb5-1.15.2/lib -L/nix/store/3lk4hcp1r6pnrvf91kd5p0ni97nd2dj3-openssl-1.0.2q/lib -L/nix/store/za7psqbn9laq73vc5rh657jqpiqn0wag-libssh2-1.8.0/lib -L/nix/store/blrfb9855rrxva4xch4r7knwya0il5rl-curl-7.62.0/lib -L/nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/lib -L/nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/lib -L/nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/lib -L/nix/store/9vh9ysqr8hahnph1gppniv7zrdf218ds-nghttp2-1.35.0-lib/lib -L/nix/store/nsrwlly5ikwhppcslaazp547kh7q7j6s-zlib-1.2.11/lib -L/nix/store/yi0pwf9hybx6vhj2qdfa6krvxgvcbyi0-libkrb5-1.15.2/lib -L/nix/store/3lk4hcp1r6pnrvf91kd5p0ni97nd2dj3-openssl-1.0.2q/lib -L/nix/store/za7psqbn9laq73vc5rh657jqpiqn0wag-libssh2-1.8.0/lib -L/nix/store/blrfb9855rrxva4xch4r7knwya0il5rl-curl-7.62.0/lib -L/nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/lib -L/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib -L/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib HARDENING: disabled flags: pie HARDENING: Is active (not completely disabled with "all" flag) HARDENING: enabling bindnow HARDENING: enabling relro extra flags before to /nix/store/jdlb06c0kp6sms277xcclfr3gdl8pb9r-binutils-2.30/bin/ld.gold: -z now -z relro original flags to /nix/store/jdlb06c0kp6sms277xcclfr3gdl8pb9r-binutils-2.30/bin/ld.gold: -plugin /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/libexec/gcc/x86_64-unknown-linux-gnu/7.3.0/liblto_plugin.so -plugin-opt=/nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/libexec/gcc/x86_64-unknown-linux-gnu/7.3.0/lto-wrapper -plugin-opt=-fresolution=/build/ccNnlge1.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib64/ld-linux-x86-64.so.2 -o ../generated/linux/release/64/dmd /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/crt1.o /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/crti.o /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/crtbegin.o -L/nix/store/r29igl9gz0r6cvb3i28xh03anx936qbl-ldcBuild-1.13.0/lib -L/nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/lib -L/nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/lib -L/nix/store/9vh9ysqr8hahnph1gppniv7zrdf218ds-nghttp2-1.35.0-lib/lib -L/nix/store/nsrwlly5ikwhppcslaazp547kh7q7j6s-zlib-1.2.11/lib -L/nix/store/yi0pwf9hybx6vhj2qdfa6krvxgvcbyi0-libkrb5-1.15.2/lib -L/nix/store/3lk4hcp1r6pnrvf91kd5p0ni97nd2dj3-openssl-1.0.2q/lib -L/nix/store/za7psqbn9laq73vc5rh657jqpiqn0wag-libssh2-1.8.0/lib -L/nix/store/blrfb9855rrxva4xch4r7knwya0il5rl-curl-7.62.0/lib -L/nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/lib -L/nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/lib -L/nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/lib -L/nix/store/9vh9ysqr8hahnph1gppniv7zrdf218ds-nghttp2-1.35.0-lib/lib -L/nix/store/nsrwlly5ikwhppcslaazp547kh7q7j6s-zlib-1.2.11/lib -L/nix/store/yi0pwf9hybx6vhj2qdfa6krvxgvcbyi0-libkrb5-1.15.2/lib -L/nix/store/3lk4hcp1r6pnrvf91kd5p0ni97nd2dj3-openssl-1.0.2q/lib -L/nix/store/za7psqbn9laq73vc5rh657jqpiqn0wag-libssh2-1.8.0/lib -L/nix/store/blrfb9855rrxva4xch4r7knwya0il5rl-curl-7.62.0/lib -L/nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/lib -L/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib -L/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -L/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -L/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib -L/nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin -L/nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0 -L/nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/../../../../lib64 -L/nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/../../.. -dynamic-linker /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ld-linux-x86-64.so.2 ../generated/linux/release/64/dmd.o ../generated/linux/release/64/newdelete.o ../generated/linux/release/64/backend.a ../generated/linux/release/64/lexer.a -lstdc++ -lphobos2-ldc -ldruntime-ldc --gc-sections -lrt -ldl -lpthread -rpath /nix/store/r2xapv59sz4cpa9zy9ydzck857r6xmrx-dmdBuild-2.083.1/lib64 -rpath /nix/store/r2xapv59sz4cpa9zy9ydzck857r6xmrx-dmdBuild-2.083.1/lib -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/crtend.o /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/crtn.o extra flags after to /nix/store/jdlb06c0kp6sms277xcclfr3gdl8pb9r-binutils-2.30/bin/ld.gold: -rpath /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib -rpath /nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib ../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
Dec 22 2018
parent Thomas Mader <thomas.mader gmail.com> writes:
On Saturday, 22 December 2018 at 23:29:13 UTC, Thomas Mader wrote:
 I enabled more debug output from the Nix environment so the 
 compiler flags can be seen.
The part with fp.c: (CC) BACK_OBJS dmd/backend/fp.c c++ -c -o../generated/linux/release/64/fp.o -Wno-deprecated -Wstrict-aliasing -Werror -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -fPIC -std=gnu++98 -O2 -Idmd/root -Idmd/tk -Idmd/backend -I../generated/linux/release/64 -Idmd -DDMDV2=1 -MMD -MF ../generated/linux/release/64/fp.deps dmd/backend/fp.c (CC) BACK_OBJS dmd/backend/cgen.c c++ -c -o../generated/linux/release/64/cgen.o -Wno-deprecated -Wstrict-aliasing -Werror -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -fPIC -std=gnu++98 -O2 -Idmd/root -Idmd/tk -Idmd/backend -I../generated/linux/release/64 -Idmd -DDMDV2=1 -MMD -MF ../generated/linux/release/64/cgen.deps dmd/backend/cgen.c HARDENING: disabled flags: pie HARDENING: Is active (not completely disabled with "all" flag) HARDENING: enabling fortify HARDENING: enabling stackprotector HARDENING: enabling strictoverflow HARDENING: enabling format HARDENING: enabling pic extra flags before to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -Wformat -Wformat-security -Werror=format-security -fPIC original flags to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -c -o../generated/linux/release/64/os.o -Wno-deprecated -Wstrict-aliasing -Werror -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -fPIC -std=gnu++98 -O2 -Idmd/root -Idmd/tk -Idmd/backend -I../generated/linux/release/64 -Idmd -DDMDV2=1 -MMD -MF ../generated/linux/release/64/os.deps dmd/backend/os.c extra flags after to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -B/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -B/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ -idirafter /nix/store/psqblh5bsgkbkhn4r648pgjw5rq4npkv-glibc-2.27-dev/include -idirafter /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -B/nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin/ -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include HARDENING: disabled flags: pie HARDENING: Is active (not completely disabled with "all" flag) HARDENING: enabling fortify HARDENING: enabling stackprotector HARDENING: enabling strictoverflow HARDENING: enabling format HARDENING: enabling pic HARDENING: disabled flags: pie HARDENING: Is active (not completely disabled with "all" flag) extra flags before to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -Wformat -Wformat-security -Werror=format-security -fPIC original flags to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -c -o../generated/linux/release/64/fp.o -Wno-deprecated -Wstrict-aliasing -Werror -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -fPIC -std=gnu++98 -O2 -Idmd/root -Idmd/tk -Idmd/backend -I../generated/linux/release/64 -Idmd -DDMDV2=1 -MMD -MF ../generated/linux/release/64/fp.deps dmd/backend/fp.c extra flags after to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -B/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -B/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ -idirafter /nix/store/psqblh5bsgkbkhn4r648pgjw5rq4npkv-glibc-2.27-dev/include -idirafter /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -B/nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin/ -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include HARDENING: enabling fortify HARDENING: enabling stackprotector HARDENING: enabling strictoverflow HARDENING: enabling format HARDENING: enabling pic extra flags before to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -Wformat -Wformat-security -Werror=format-security -fPIC original flags to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -c -o../generated/linux/release/64/cgen.o -Wno-deprecated -Wstrict-aliasing -Werror -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -fPIC -std=gnu++98 -O2 -Idmd/root -Idmd/tk -Idmd/backend -I../generated/linux/release/64 -Idmd -DDMDV2=1 -MMD -MF ../generated/linux/release/64/cgen.deps dmd/backend/cgen.c extra flags after to /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/bin/g++: -B/nix/store/x6inizi5ahlyhqxxwv1rvn05a25icarq-gcc-7.3.0-lib/lib -B/nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/ -idirafter /nix/store/psqblh5bsgkbkhn4r648pgjw5rq4npkv-glibc-2.27-dev/include -idirafter /nix/store/p7j7qg5cri229ihf8nllwjhzgbvgx5d0-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -B/nix/store/klci955kxil7q32ggran6lnhpnkk8yjz-gcc-wrapper-7.3.0/bin/ -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include -isystem /nix/store/gvmijbjia22rskv7xfm36004zsyi62mr-ldc-1.13.0/include -isystem /nix/store/6yf8cndis3p9awh5wmwplyrqv55y4y3a-gdb-8.2/include -isystem /nix/store/yhckr5a12np73av4c4k1v1ffqj0bx53h-curl-7.62.0-dev/include -isystem /nix/store/s7f8awsadn61qmbz1mfniw2c3zxcifq0-nghttp2-1.35.0-dev/include -isystem /nix/store/a50sg2xm6vflzx5kma3sih39dq9wv7z6-zlib-1.2.11-dev/include -isystem /nix/store/jfyrrk9xkqm06x5vcx6cs4qm34bzl39h-libkrb5-1.15.2-dev/include -isystem /nix/store/v7gs3pmbg43ys16fbhhc9sq89s4vj236-openssl-1.0.2q-dev/include -isystem /nix/store/v42mn058w6gb8ycyf1phvi8f8c9a4k8m-libssh2-1.8.0-dev/include -isystem /nix/store/9nzy5rd0mk57va1sr4br936pjk24ns8p-tzdata-2018g-dev/include
Dec 22 2018
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 12/22/2018 1:58 PM, Thomas Mader wrote:
 Anybody an idea?
It means the file evalu8.d was referencing a function or symbol named "modulo" and the linker couldn't find it. 1) Look in evalu8.d for the reference. 2) grep "modulo" *.d to see where it may be.
Dec 22 2018
parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Sunday, 23 December 2018 at 00:11:05 UTC, Walter Bright wrote:
 On 12/22/2018 1:58 PM, Thomas Mader wrote:
 Anybody an idea?
It means the file evalu8.d was referencing a function or symbol named "modulo" and the linker couldn't find it. 1) Look in evalu8.d for the reference. 2) grep "modulo" *.d to see where it may be.
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. drtlsym.d seems to be creating a symbol and I guess that's somehow not working in my case. But if I am right I also don't understand why drtlsym is needed at all. Wouldn't it be possible to just declare _modulo as extern( C++ ) in evalu8.d? And how is it possible that drtlsym is not working in my case when it is for Archlinux with the same dependencies? I have not yet found a difference which could explain the problem.
Dec 22 2018
parent reply Walter Bright <newshound2 digitalmars.com> writes:
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. 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.
Dec 23 2018
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2018-12-23 11:15, Walter Bright wrote:

 I wonder why you're compile some parts with g++ and some with ldc.
Because fp.c is a C++ file? -- /Jacob Carlborg
Dec 23 2018
parent Walter Bright <newshound2 digitalmars.com> writes:
On 12/23/2018 2:25 AM, Jacob Carlborg wrote:
 On 2018-12-23 11:15, Walter Bright wrote:
 
 I wonder why you're compile some parts with g++ and some with ldc.
Because fp.c is a C++ file?
ldc should be paired with clang.
Dec 23 2018
prev sibling parent reply Thomas Mader <thomas.mader gmail.com> writes:
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 dmd/backend/evalu8.d
Dec 23 2018
next sibling parent Thomas Mader <thomas.mader gmail.com> writes:
On Sunday, 23 December 2018 at 12:16:53 UTC, Thomas Mader wrote:
 I also think that this might be one solution to the problem.
 Still, it's unclear to me what is going on.
No it's not a solution. The same problem is reproducible on OSX and the std environment of Nix is clang.
Dec 23 2018
prev sibling parent reply Johan Engelen <j j.nl> writes:
On Sunday, 23 December 2018 at 12:16:53 UTC, Thomas Mader wrote:
 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.
It is normal to use g++ with ldc. You should use your system compiler with ldc, and that's of course not necessarily clang. The mangling is done by LDC itself, not LLVM, and so it is a bug in LDC. In this particular case, the second argument of _modulo is the same as the first and the mangler is (incorrectly) replacing the type of the second with a backreference to the first type. That's what the mangler should do for user types, but not for builtin types. -Johan
Dec 23 2018
parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Sunday, 23 December 2018 at 13:05:06 UTC, Johan Engelen wrote:
 The mangling is done by LDC itself, not LLVM, and so it is a 
 bug in LDC.
I came to the same conclusion after finishing my tests. I created a bug: https://github.com/ldc-developers/ldc/issues/2954
Dec 23 2018
parent Joakim <dlang joakim.fea.st> writes:
On Sunday, 23 December 2018 at 14:48:29 UTC, Thomas Mader wrote:
 On Sunday, 23 December 2018 at 13:05:06 UTC, Johan Engelen 
 wrote:
 The mangling is done by LDC itself, not LLVM, and so it is a 
 bug in LDC.
I came to the same conclusion after finishing my tests. I created a bug: https://github.com/ldc-developers/ldc/issues/2954
According to Johan, this bug was introduced by a pull kinke and I wrote to add support for a different real mangling on Android/x64, which broke your mangling that wasn't covered by the test suite: https://github.com/ldc-developers/ldc/pull/2917/files It appears he is fixing both issues ATM. I suggest you either stick with LDC 1.12 as the compiler building DMD for now, or backport his eventual patch to LDC 1.13 if you can.
Dec 23 2018