[PATCH] D43184: [WIP] [ItaniunCXXABI] Add an option for loading the type info vtable with dllimport

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 15 14:11:39 PDT 2018

mstorsjo added a comment.

In https://reviews.llvm.org/D43184#1039385, @rnk wrote:

> In https://reviews.llvm.org/D43184#1039354, @mstorsjo wrote:
> > Ok - I'll put it on the backburner, and maybe see if I'd try implementing the linker part of fixing unannotated data imports at some point.
> I'm not sure that's feasible.

If we'd just fix the RTTI vtable case, this still would need to be implemented in the linker, right? That's what I meant originally - implementing enough of that to handle RTTI, optionally giving the larger usecase a shot.

> At least for x86, global addresses can be folded in ways that mean the linker cannot relax them. You can go the other way, though. If we start by assuming all data is imported, you can often relax an __imp_sym load to a LEA sym(%rip). This increases register pressure and generates worse code, but it has conceivable use cases.

Hmm, I think it seems like GCC does something like that. When accessing data symbols that aren't known to be DSO local, it seems to produce code like this: "movq .refptr.a(%rip), %rax; mov (%rax), %rax". My x86-fu is rather weak but I guess that's pretty much what you meant?

Anyway, good to know about that case.

  rC Clang


More information about the cfe-commits mailing list