[PATCH] Start adding support for dllimport/dllexport on classes (PR11170)
Hans Wennborg
hans at chromium.org
Thu May 29 17:14:44 PDT 2014
On Thu, May 29, 2014 at 4:23 PM, Reid Kleckner <rnk at google.com> wrote:
> On Thu, May 29, 2014 at 4:01 PM, Hans Wennborg <hans at chromium.org> wrote:
>>
>> I tested my patch with Nico's tests from
>> https://github.com/gix/clang/commit/ea6cb1d71c6ef8dac2afd5f40219de9460a92b3f,
>> and fixed the two asserts we were hitting when exporting defaulted trivial
>> constructors and destructors.
>>
>> There were two remaining test failures: 1) we emit RTTI type descriptor,
>> etc. as weak_odr instead of linkonce_odr when exporting the class. Not a big
>> deal since we're exporting the vtable anyway, but I'm not sure why it's
>> happening.
>
>
> It's pretty simple: I told Warren to use the vftable linkage for RTTI data.
That makes sense :) I'll see if I can add the dllexport case to that logic.
> Can RTTI data be imported? What happens when you use typeid?
MSVC doesn't export the RTTI data, so it can't be imported. When I use
typeid it seems to materialize the things it needs, it doesn't try to
import anything.
> I seem to
> recall they don't let you import the type descriptor and you have to use
> string comparison on the mangled name to compare types for equality. In
> that case, linkonce_odr is correct.
Yes, I think linkonce_odr would be the correct one, but I don't think
emitting it as weak_odr until we fix it is breaking anything. Since
we're exporting the vtable, which references these things, we can't
drop them anyway.
Does the patch look good to you otherwise?
More information about the cfe-commits
mailing list