Hey Martin, Glad to see you following up on my various LLVM adventures :)
From what I remember the initialization is done in mingw-w64/crt/gccmain.c. I believe it may be possible to add this code and not make is clang specific. Before the iteration loop check in __do_global_ctors and __do_global_dtors check if nptrs+1 is equal to -1 and if so just bump the counter and continue. This would mean that programs linked with LD would have an extra 2 pointers in the table but it should be fine otherwise. Not sure how others would feel about this though. Best, Martell On Wed, Aug 2, 2017 at 10:22 PM, Martin Storsjö <mar...@martin.st> wrote: > Hi Martell, André and Kai, > > On Sun, 28 Aug 2016, André Hentschel wrote: > > Am 09.08.2016 um 11:16 schrieb Kai Tietz: >> >>> Hallo Martell, >>> >>> patch is ok. Wouldn't it be better to have those symbols in linker >>> scrpt instead? That is actually the way used in ld for it. >>> >>> Thanlks, >>> Kai >>> >>> 2016-08-06 5:14 GMT+02:00 Martell Malone <martellmal...@gmail.com>: >>> >>>> This patch should be the last piece of the puzzle. >>>> Now c++ works, it relied heavily on ctors which was broken with clang >>>> and >>>> lld. >>>> >>>> >> >> Hi, >> >> Kai could you please point Martell on some examples or related files in >> the mingw-w64 tree? >> I hope this way we can continue to fix this. >> > > I see that this matter stalled last year when this was discussed... > > I had a look at this, and if I understand things correctly, this is > handled somewhere in e.g. https://sourceware.org/git/git > web.cgi?p=binutils-gdb.git;a=blob;f=ld/scripttempl/pe.sc. > > I don't think the LLD COFF linker supports such linker scripts, so I think > a clang/lld-based mingw needs to do things differently, using something > like Martell's patch. > > One of the downsides of doing things differently between the two, is that > you basically need to link your executables using a linker that matches the > compiler used to build the mingw CRT. But I guess this is the only way to > handle it if things are to work with clang at all, right? > > Kai approved the patch last year, so I guess it could be applied as a > first attempt at least? It shouldn't break the setup for normal users, > contrary to the patch that was reverted before. > > // Martin > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > _______________________________________________ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public