Thread overview
[Issue 23209] Linker error for valid code.
Jun 23, 2022
mhh
Jun 24, 2022
kdevel
Jun 24, 2022
kdevel
Sep 21, 2022
Luís Marques
Dec 17, 2022
Iain Buclaw
June 23, 2022
https://issues.dlang.org/show_bug.cgi?id=23209

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #1 from mhh <maxhaton@gmail.com> ---
What happens with dmd -run rather than dmd?

--
June 24, 2022
https://issues.dlang.org/show_bug.cgi?id=23209

kdevel <kdevel@vogtner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kdevel@vogtner.de

--
June 24, 2022
https://issues.dlang.org/show_bug.cgi?id=23209

--- Comment #2 from kdevel <kdevel@vogtner.de> ---
$ dmd k.d
k.o: In function
`_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv':
k.d:(.text._D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv[_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv]+0x19):
undefined reference to
`_D4core9exception__T15__switch_errorTZQsFNaNbNiNeAyamZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

$ dmd -allinst -run k.d
{}

[for the record: binutils < 2.26 raises unrecognized relocation (0x2a) in section `.text', https://stackoverflow.com/questions/52737698]

--
September 21, 2022
https://issues.dlang.org/show_bug.cgi?id=23209

Luís Marques <luis@luismarques.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luis@luismarques.eu

--- Comment #3 from Luís Marques <luis@luismarques.eu> ---
I also ran into this issue. The scenario is a bit different, I'm using LDC2 on macOS and I'm linking D code with C code. The linker driver is clang++. The same D code compiled with dub/ldc2 didn't seem to cause issues, but various D libraries are involved so it's hard to tell for sure without reducing it, which I haven't done yet. I also have two linker errors, instead of one. For now, I'm working around it with:

C code:

void _D4core9exception__T15__switch_errorTZQsFNaNbNiNeAyamZv(void) {
   assert(0);
}
void
_D3std4math10operations__T17extractBitpatternTfZQwFNaNbNiNexfZSQCjQCiQCg__T23FloatingPointBitpatternTfZQBc(void)
{
   assert(0);
}

I.e. trapping implementations for the missing:

pure nothrow @nogc @trusted void
core.exception.__switch_errorT!().__switch_errorT(immutable(char)[], long);

pure nothrow @nogc @trusted
std.math.operations.FloatingPointBitpattern!(float).FloatingPointBitpattern
std.math.operations.extractBitpattern!(float).extractBitpattern(const(float))

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23209

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
January 08
https://issues.dlang.org/show_bug.cgi?id=23209

Bastiaan Veelo <Bastiaan@Veelo.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Bastiaan@Veelo.net

--- Comment #4 from Bastiaan Veelo <Bastiaan@Veelo.net> ---
Further reduced:

```d
void main()
{
    import std.net.curl, std.stdio;
    auto http = HTTP();
    http.setAuthentication("", "");
    writeln(1.0);
}
```

The missing symbol is `pure nothrow @nogc @trusted void
core.exception.__switch_errorT!().__switch_errorT(immutable(char)[], ulong)`.

--
January 08
https://issues.dlang.org/show_bug.cgi?id=23209

--- Comment #5 from Bastiaan Veelo <Bastiaan@Veelo.net> ---
Workaround: use the `-allinst` option.

--
February 20
https://issues.dlang.org/show_bug.cgi?id=23209

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ibuclaw@gdcproject.org
         Resolution|---                         |DUPLICATE

--- Comment #6 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Marking this as a duplicate.

*** This issue has been marked as a duplicate of issue 20802 ***

--