Jump to page: 1 2
Thread overview
[Issue 21294] [REG 2.095]: DMD fails to link since PR11743
Oct 05, 2020
Iain Buclaw
Oct 05, 2020
Iain Buclaw
Oct 05, 2020
Iain Buclaw
Oct 06, 2020
RazvanN
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Iain Buclaw
Oct 06, 2020
Dlang Bot
Oct 08, 2020
Dlang Bot
October 05, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org
            Summary|[Regression: DMD fails to   |[REG 2.095]: DMD fails to
                   |link since PR11743          |link since PR11743

--
October 05, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: /build/gcc/d/dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: /build/gcc/d/dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.allocValue(const(char)[],
dmd.mtype.Type)':
dmd/root/stringtable.d:261: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: /build/gcc/d/dmd/root/stringtable.d:262: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.grow()':
dmd/root/stringtable.d:303: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toString()
inout'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: /build/gcc/d/dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.grow()':
dmd/root/stringtable.d:303: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toString()
inout'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.allocValue(const(char)[],
dmd.mtype.Type)':
dmd/root/stringtable.d:261: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: /build/gcc/d/dmd/root/stringtable.d:262: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.allocValue(const(char)[],
dmd.mtype.Type)':
dmd/root/stringtable.d:261: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: /build/gcc/d/dmd/root/stringtable.d:262: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.grow()':
dmd/root/stringtable.d:303: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toString()
inout'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: /build/gcc/d/dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.allocValue(const(char)[],
dmd.mtype.Type)':
dmd/root/stringtable.d:261: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: /build/gcc/d/dmd/root/stringtable.d:262: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.grow()':
dmd/root/stringtable.d:303: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toString()
inout'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: /build/gcc/d/dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.allocValue(const(char)[],
dmd.mtype.Type)':
dmd/root/stringtable.d:261: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: /build/gcc/d/dmd/root/stringtable.d:262: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.lstring()'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.grow()':
dmd/root/stringtable.d:303: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toString()
inout'
ld: d/func.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/mtype.o: in function
`dmd.root.stringtable.StringTable!(dmd.mtype.Type).StringTable.findSlot(ulong,
const(char)[]) const':
dmd/root/stringtable.d:285: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
ld: d/typesem.o: in function `dmd.typesem.merge(dmd.mtype.Type)':
dmd/gcc/../../gcc/d/dmd/typesem.d:2122: undefined reference to
`dmd.root.stringtable.StringValue!(dmd.mtype.Type).StringValue.toDchars()
const'
collect2: error: ld returned 1 exit status

--
October 05, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Reverting the removal of imports in https://github.com/dlang/dmd/pull/11743 fixes the link error.

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
Which imports exactly are you referring to? Also, how can we reproduce this?

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #4 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to RazvanN from comment #3)
> Which imports exactly are you referring to?

It looks like a single import is the trigger over whether StringValue!Type is emitted or not.

import dmd.dscope;

Adding this back to dmd/aliasthis.d fixes the stage1 bootstrap.  Currently running stage2 bootstrap.

Without the import, this outputs nothing, and leaves undefined symbol references to StringValue!(Type).toDchars and others.

$ gdc -fno-PIE -c  -g -O2 -fversion=IN_GCC -frelease -fPIC   -Wall -Wdeprecated
 -o d/mtype.o -MT d/mtype.o -MMD -MP -MF d/.deps/mtype.TPo -I../../gcc/d
-J../../gcc/d/dmd -J../../gcc/d/dmd/res ../../gcc/d/dmd/mtype.d -v 2>&1 | grep
StringValue
$ nm d/mtype.o | grep StringValue8toDchars
                 U
_D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toDcharsMxFNaNbNiNjZPxa


With the import however.

$ gdc -fno-PIE -c  -g -O2 -fversion=IN_GCC -frelease -fPIC   -Wall -Wdeprecated
 -o d/mtype.o -MT d/mtype.o -MMD -MP -MF d/.deps/mtype.TPo -I../../gcc/d
-J../../gcc/d/dmd -J../../gcc/d/dmd/res ../../gcc/d/dmd/mtype.d -v 2>&1 | grep
StringValue
function  dmd.root.stringtable.StringValue!(Type).StringValue.lstring
function  dmd.root.stringtable.StringValue!(Type).StringValue.len
function  dmd.root.stringtable.StringValue!(Type).StringValue.toDchars
function  dmd.root.stringtable.StringValue!(Type).StringValue.toString
function  dmd.root.stringtable.StringValue!(Type).StringValue.__xopEquals
function  dmd.root.stringtable.StringValue!(Type).StringValue.__xtoHash
$ nm d/mtype.o | grep StringValue8toDchars
0000000000000000 W
_D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toDcharsMxFNaNbNiNjZPxa

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to RazvanN from comment #3)
> Also, how can we reproduce this?

It looks like DMD is in a worse state, a simple reproducer script shows that reverting the PR doesn't help DMD at all (using v2.091.1 as host compiler).

```
#!/bin/bash

mkdir -p build
echo "/etc" > build/SYSCONFDIR.imp
echo "v2.094.0" > build/VERSION

for dir in . root backend; do
    mkdir -p build/${dir}
    for src in src/dmd/${dir}/*.d; do
        echo dmd -version=MARS -I=src -J=src/dmd/res -J=build -c
-od=build/${dir} ${src}
        dmd -version=MARS -I=src -J=src/dmd/res -J=build -c -od=build/${dir}
${src}
    done
done

echo dmd build/*.o build/root/*.o build/backend/*.o -of=build/dmd dmd build/*.o build/root/*.o build/backend/*.o -of=build/dmd

echo ===================
dmd --version
```

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #6 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Slightly tweaked for some added parallelism for bisecting dmd.  I'll see if there's a first good commit with dmd.

```
#!/bin/bash

if [ -d build ]; then rm -r build; fi
mkdir build
echo "/etc" > build/SYSCONFDIR.imp
echo "v2.000.0" > build/VERSION

for dir in . root backend; do
    mkdir -p build/${dir}
    for src in src/dmd/${dir}/*.d; do
        echo dmd -version=MARS -I=src -J=src/dmd/res -J=build \
            -c -od=build/${dir} ${src}
        dmd -version=MARS -I=src -J=src/dmd/res -J=build \
            -c -od=build/${dir} ${src} &
        sleep 0.05
    done
done

echo dmd build/*.o build/root/*.o build/backend/*.o -of=build/dmd dmd build/*.o build/root/*.o build/backend/*.o -of=build/dmd

echo =========================
dmd --version

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #7 from Iain Buclaw <ibuclaw@gdcproject.org> ---
When building 2.092.1 using dmd as host compiler, it still fails to link due to
missing StringValue!(Symbol).toDchars, but the missing StringValue!(Type) is
now gone.

((v2.092.1)|BISECTING) $ nm build/mtype.o | grep
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
0000000000000000 W
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
((v2.092.1)|BISECTING) $ nm build/typesem.o | grep
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
                 U
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #8 from Iain Buclaw <ibuclaw@gdcproject.org> ---
The first bad commit for dmd was https://github.com/dlang/dmd/pull/11083

Adding the import of stringtable in that PR now means that all modules think it's OK to omit generating code for StringValue!(Type).

((9fa18aa20...)|BISECTING) $ nm build/func.o | grep
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
                 U
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
((9fa18aa20...)|BISECTING) $ nm build/typesem.o | grep
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
                 U
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
((9fa18aa20...)|BISECTING) $ nm build/mtype.o | grep
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa
                 U
_D3dmd4root11stringtable__T11StringValueTCQBo5mtype4TypeZQBe8toDcharsMxFNaNbNiNjZPxa

--
October 06, 2020
https://issues.dlang.org/show_bug.cgi?id=21294

--- Comment #9 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Iain Buclaw from comment #8)
> The first bad commit for dmd was https://github.com/dlang/dmd/pull/11083
> 
> Adding the import of stringtable in that PR now means that all modules think it's OK to omit generating code for StringValue!(Type).
> 

Adding -allinst does not help either.

```
#!/bin/bash

# Toggle testing using -allinst
dflags="-allinst"

if [ -d build ]; then rm -r build; fi
mkdir build
echo "/etc" > build/SYSCONFDIR.imp
echo "v2.000.0" > build/VERSION
echo "" > build/default_ddoc_theme.ddoc

for dir in . root backend; do
    mkdir -p build/${dir}
    for src in src/dmd/${dir}/*.d; do
        echo dmd ${dflags} -version=MARS -I=src -J=src/dmd/res -J=build \
            -c -od=build/${dir} ${src}
        dmd ${dflags} -version=MARS -I=src -J=src/dmd/res -J=build \
            -c -od=build/${dir} ${src} &
        sleep 0.05
    done
done
wait
echo dmd build/backend/*.o build/root/*.o build/*.o -of=build/dmd
dmd build/backend/*.o build/root/*.o build/*.o -of=build/dmd

echo =========================
dmd --version
```

--
« First   ‹ Prev
1 2