Attaching patch that was done against gdc-6 (6.2.1-5). Fixes against version 7 is already in master, so I imagine it's easier to just grab the latest source tarballs (and remove gdc-hacks.diff).
Regards Iain On 4 December 2016 at 18:39, Iain Buclaw <ibuc...@gdcproject.org> wrote: > On 4 December 2016 at 10:15, Iain Buclaw <ibuc...@gdcproject.org> wrote: >> On 3 December 2016 at 22:29, Matthias Klose <d...@debian.org> wrote: >>> On 03.12.2016 22:13, Markus Koschany wrote: >>>> On 03.12.2016 22:00, Matthias Klose wrote: >>>>> reassign 846669 gdc-6 >>>>> forcemerge 845377 846669 >>>>> thanks >>>>> >>>>> please see #845377. >>>>> >>>>> This build is configured with --enable-default-pie. The linker is now >>>>> called >>>>> with -pie, but cc1d isn't passed either -fPIE, or -fPIC. The work around >>>>> is to >>>>> pass either -fPIC, or -no-pie. Also passing -fPIE doesn't have an effect. >>>> >>>> Hi, >>>> >>>> sorry I'm not a D expert. Do you intend to fix #845377 before the Freeze >>>> or are all >>>> reverse-dependencies supposed to work around this issue by passing either >>>> -fPIC or -no-pie to configure? >>> >>> Please give Iain some time to have a look at this. >>> >> >> I'll be spending today on this. Hopefully not all. :-) >> >> Regards > > It looks like the pre-emptive check for "is this symbol external?" is > not right. The codegen pass thinks it should be static, but it is > infact not, and so it emits the call without @PLT. This only affects > D templates. > > Incidentally, I recently cleaned up the area where this is done, > making it a small fix in upstream. Will have a look at debian's > source package to prepare the relevant patch. > > Regards > Iain
Index: gcc-6-6.2.1/src/gcc/d/d-objfile.cc =================================================================== --- gcc-6-6.2.1.orig/src/gcc/d/d-objfile.cc +++ gcc-6-6.2.1/src/gcc/d/d-objfile.cc @@ -1727,21 +1727,17 @@ d_comdat_linkage(tree decl) void get_template_storage_info (Dsymbol *dsym, bool *local_p, bool *template_p) { - *local_p = output_module_p(dsym->getModule()); + TemplateInstance *ti = dsym->isInstantiated(); + *local_p = false; *template_p = false; - Dsymbol *sym = dsym->toParent(); - while (sym) + if (ti != NULL) { - TemplateInstance *ti = sym->isTemplateInstance(); - if (ti) - { - *local_p = output_module_p(ti->minst); - *template_p = true; - break; - } - sym = sym->toParent(); + *local_p = ti->needsCodegen(); + *template_p = true; } + else + *local_p = (dsym->getModule() && dsym->getModule()->isRoot()); } // Set a DECL's STATIC and EXTERN based on the decl's storage class