www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18507] New: Linker errors on FreeBSD related to .data.d_dso_rec

https://issues.dlang.org/show_bug.cgi?id=18507

          Issue ID: 18507
           Summary: Linker errors on FreeBSD related to .data.d_dso_rec
           Product: D
           Version: D2
          Hardware: x86_64
                OS: FreeBSD
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

Created attachment 1681
  --> https://issues.dlang.org/attachment.cgi?id=1681&action=edit
File which reproduces the issue

If the attached file is compiled with

dmd -main -unittest test.d

on x86_64 FreeBSD 11.1 then I get this linker error:

/usr/bin/ld: test.o: no group info for section .data.d_dso_rec
/usr/bin/ld: test.o: no group info for section .text.d_dso_init
/usr/bin/ld: test.o: no group info for section .dtors.d_dso_dtor
/usr/bin/ld: test.o: no group info for section .ctors.d_dso_ctor

I have no idea if x86 has the same problem or not, but the problem does not
seem to occur on 64-bit Linux. So, the problem seems to be FreeBSD-specific. I
have no clue whether older versions of FreeBSD have the problem or not, but in
theory, we're only supporting the latest version of FreeBSD, which is currently
11.1.

I'm sorry that the example code is as disgusting-looking as it is, but it's the
result of several runs of dustmite on one of my projects, and the linker errors
seem to happen only under some fairly specific circumstances, since it doesn't
take much to tweak the code to make the problem go away - though I did manage
to get the actual project to into a state where it was very hard to make the
problem go away. Fortunately for the project, after some serious refactoring to
remove some templated stuff that didn't turn out to be necessary, the problem
went away, so this isn't currently blocking my project, but we really shouldn't
be getting linker errors like this - especially when other platforms have no
problem with the exact same code.

--
Feb 23 2018