<div dir="ltr">I can't think of any construct in standard C that will get linkonce_odr linkage.<div><br></div><div>There is __attribute__((weak)) which gives 'weak' linkage.  There are two differences:<div>1. It is not "odr", meaning it can be overridden by a different definition.  Inlining or constant propagation is not allowed.</div>
<div>2. It is not discardable, meaning it cannot be dropped if unreferenced.</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 11:16 PM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com" target="_blank">viridia@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">OK that makes sense. So forget selectany for a moment - what I really want to know is, is there any way, from C, to give a symbol linkonce linkage? Or is this capability only available via the IR?</div>
<div class="gmail_extra"><div><div class="h5">

<br><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 11:13 PM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">Grepping the source code tells me that selectany is only implemented as microsoft extension. Test files use it in combination with __declspec and they enable this functionality with -fsm-compatibility. Note that I have no idea what this attribute actually does, I just did a search for you :)</div>




<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Wed, Jul 2, 2014 at 2:31 PM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com" target="_blank">viridia@gmail.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

<div dir="ltr">I'm working with a code generator that produces C code and I need linkonce to eliminate duplicate definitions - but the clang compiler complains that the 'selectany' attribute is not recognized (even though I see looking through the clang source code that there's code to handle it.) So I'm wondering why the attribute isn't recognized, I'm guessing it could be any number of things (platform [OS X], source language (.c), and so on...)<span><font color="#888888"><br clear="all">






<div><br></div>-- <br>-- Talin
</font></span></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>-- Talin
</font></span></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>