[PATCH] Change representation of dllexport/dllimport

Nick Lewycky nlewycky at google.com
Thu Sep 12 11:43:15 PDT 2013


On 11 September 2013 15:26, Robinson, Paul <
Paul_Robinson at playstation.sony.com> wrote:

> > > From: Chandler Carruth [mailto:chandlerc at google.com]
> > > Sent: Wednesday, September 11, 2013 12:22 PM
> > > To: Robinson, Paul
> > > Cc: Nick Lewycky; Reid Kleckner; Nico Rieck;
> > reviews+D1110+public+872068f434b7231c at llvm-reviews.chandlerc.com; llvm-
> > commits
> > > Subject: Re: [PATCH] Change representation of dllexport/dllimport
> > >
> > >
> > > > On Wed, Sep 11, 2013 at 12:04 PM, Robinson, Paul
> > <Paul_Robinson at playstation.sony.com> wrote:
> > > > It means we have a proprietary extension to ELF that does the right
> > things.
> > >
> > > I think he was asking what it is you consider "the right things" to do
> > > here. Do you have a spec or something else you can share? Without
> > > knowing the exact behavior, it is essentially impossible to really
> > > consider this case in designing stuff in LLVM.
> >
> > Hm, I'll ask, and maybe I'll be able to say what we do in .o files
> > which is really the point as far as LLVM is concerned.
> > --paulr
>
> With the caveat that I didn't actually do the work, it looks like:
> - We emit lists of dllimport/dllexport symbols to a linker-command
>   section, conceptually similar to what Windows does.
> - We invented a DLLExportLinkOnceLinkage for the special case of inline
>   functions marked dllexport.  For this we added a new IR attribute.
> - We fiddled a few places in lib/Target to get the right kinds of
> references
>   to happen (relocs & which instruction is used). These look like some
>   combination of ABI stuff and "do what the linker wants to see" stuff.
>
> Is that the kind of info you were looking for?
>

Yes, thanks. This is roughly what I was guessing -- a way of encoding the
exposed symbols list (see tools/gold/gold.exports for an llvm example) in
the source code.

I do not understand how visibility is orthogonal to dllimport/dllexport. I
can't think of any way that hidden + dllimport/dllexport makes sense.
Neither does protected + dllimport, since there is no local copy of the
symbol to bind to (we're importing it). Protected + dllexport could make
sense, except that I don't see how it differs from protected (or on a
regular windows system, dllexport). The only combination that makes sense
is default + dllimport/dllexport.

Could you give me an example where you'd actually want to use these
visibilities in combination?

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/245bfe39/attachment.html>


More information about the llvm-commits mailing list