<div dir="ltr">On 11 September 2013 15:26, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>></span> wrote:<br><div class="gmail_extra">


<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>> > From: Chandler Carruth [mailto:<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>]<br>



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


<div><br></div><div>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.<br>

<br>Could you give me an example where you'd actually want to use these visibilities in combination?<br><br></div><div>Nick<br></div>
</div></div></div>