-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate definitions of vtables/interface info with a templated class #535
Comments
Using git-bisect I determined that this bug was introduced by commit: 787c147 |
@SiegeLord Thanks for working this out. I will start working on this bug soon. I think this causes at least one unit test failure in the 2.064 merge branch. |
The symbols must have weak_odr linkage if they result from a template instantiation.
The symbols must have weak_odr linkage if they result from a template instantiation.
@SiegeLord Should be fixed now. Please check if it solves your problem. |
This particular issue is fixed, although I'm still having problems with slightly different error messages. Once I make a test case, I'll submit a new bug. Thanks! EDIT: Actually, nevermind. The rest were an issue of my own build system... looks like I'm all set! Thanks again for the rapid turnaround. |
I got similar issue, should this be in a separate issue? Error: Linking globals named '_D1b1B11__interface1b1A6__vtblZ': symbol multiply
b.d:
this crashes ldc
|
I re-opened the issue because I think it has the same root cause. |
I see something similar using ldc2 on osx and iOS. Appears that some 16__interfaceInfosZ symbols for instantiated interfaces end up (__DATA,__datacoal_nt) weak external, but for some reason, occasionally one will end up in section (__DATA,__const) external. Here is one way to see the issue. Build format and type cons unit tests separately and then link together.
|
I don't really have a good idea what could be going on here, unfortunately. To track this down, I'd probably check what is going on at the IR level, and if it's indeed a case of a global being emitted as a constant, just add a breakpoint to the emission code (with a condition on the name of the affected symbol). |
Good idea. I'll try that. |
I spent some time in gdb today. The issue seems to happen when there is a interface inheritance chain consisting of templates. The code in IrAggr::addFieldInitializers() iterates through the immediate vtbInterfaces and calls getInterfaceVtbl() for each, changing the linkage to weak. However, all the super interfaces are not visited and the linkage is not changed from ExternalLinkage. I feel like there should be a recursive call somewhere in there, but don't know my way around ldc code well enough to attempt yet. |
@smolt: Good catch! Just to be sure, the problematic interfaces are actually templates, i.e. are supposed to be emitted as weak data, right? |
Yes. Here is a small sample. module a; // a.d
interface Apple {}
interface Banana(T) : Apple
{
// my virtual interface InfosZ array is not weak (bummber)
}
class Cranberry(T) : Banana!T
{
// my virtual interface InfosZ array is weak (yeah)
}
Cranberry!int x;
|
Oops. Need to learn markdown ;-) |
I took the liberty to add code tags. Not that hard. ;P |
Add types and constants for Linux/PPC64.
Consider these three files:
test1.d
test2.d
test3.d
Running these commands produces errors:
The equivalent calls with dmd work fine. LDC revision: 8408afc . DMD version: 2.063.2
The text was updated successfully, but these errors were encountered: