<div dir="ltr">Is that actually an important use case? It sounded like it wasn't, and if we pursue option 3, we need to staple three pieces of data to every global: the default section to use if the global would live in .data, .rdata, or .bss.<div><br></div><div>My main goal here is to eliminate complexity for what is for most users probably going to be a very niche feature, so if we can simply document that the pragma affects all globals in the TU and call it a day, I'd be happy with that.</div><div><br></div><div>If we do go with approach 3, I'd recommend adding a single metadata attachment that controls all sections a global could possibly live in (text, data, rdata, bss). This avoids having three attachments with three separate hashtable entries on every global variable we emit when the pragma is active.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 14, 2017 at 2:25 AM, Javed Absar <span dir="ltr"><<a href="mailto:Javed.Absar@arm.com" target="_blank">Javed.Absar@arm.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">
<div id="m_-7725832211118495635divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p></p>
<div>
<p>Thanks Reid/Jonathon for your replies.</p>
<p><br>
</p>
<p>Reid, <br>
</p>
<p>An important case against module level flags is that it wont allow changing or resetting section names e.g.</p>
<p><br>
</p>
<p>int a;</p>
<p>#pragma clang section bss = "xyz"</p>
<p>int b;</p>
<p><br>
</p>
<p>In case above, users would like to see only 'b' placed in 'xyz' and not 'a' as well.<br>
</p>
<p>Link pointed to by Jonathon seems to require same behavior. <br>
</p>
<p><br>
</p>
<p>Jonathon,</p>
<p>We are happy to revise the spelling to -<br>
</p>
<p>#pragma clang section bss = "xyz" <br>
</p>
<p>as you propose.</p>
Best Regards, Javed.</div>
<font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b><br>
</b></font>
<p></p>
<p><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Jonathan Roelofs <<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></font><br>
</p>
<div dir="ltr">
<div id="m_-7725832211118495635x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Sent:</b> 13 March 2017 18:12:57<br>
<b>To:</b> James Molloy; Reid Kleckner; Javed Absar<br>
<b>Cc:</b> LLVM Dev; nd; <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] [cfe-dev] proposal - pragma section directive in clang</font>
<div> </div>
</div>
</div><div><div class="h5">
<font size="2"><span style="font-size:10pt">
<div class="m_-7725832211118495635PlainText"><br>
<br>
On 3/10/17 2:47 AM, James Molloy via llvm-dev wrote:<br>
> +llvm-dev properly this time.<br>
><br>
> On Fri, 10 Mar 2017 at 09:42 James Molloy <<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</a><br>
> <<a href="mailto:james@jamesmolloy.co.uk" target="_blank">mailto:james@jamesmolloy.co.<wbr>uk</a>>> wrote:<br>
><br>
<br>
><br>
> The documentation is here:<br>
> <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359124985290.html" target="_blank">
http://infocenter.arm.com/<wbr>help/index.jsp?topic=/com.arm.<wbr>doc.dui0472m/chr1359124985290.<wbr>html</a><br>
><br>
> ** Proposed syntax and (vague) semantics **<br>
><br>
> As this is a new pragma for Clang and isn't ARM-specific, we've<br>
> invented a less ARM-specific syntax. Bikeshedding is expected and<br>
> welcome.<br>
><br>
> #pragma clang section bss(".mybss") rodata(".myrodata")<br>
> data(".mydata") text(".mytext")<br>
<br>
There's some prior art in the GreenHills compiler too, where the example <br>
above would be spelled:<br>
<br>
#pragma ghs section bss=".mybss", rodata=".myrodata", <br>
data=".mydata", text=".mytext"<br>
<br>
Maybe it's worth using that syntax, i.e:<br>
<br>
#pragma clang section bss=".mybss", rodata=".myrodata", <br>
data=".mydata", text=".mytext"<br>
<br>
Alternatively, supporting vendor-specific spellings might be useful, if <br>
there's a consistency argument to be made for clang doing it its own way.<br>
<br>
Docs are pages 108/109 here:<br>
<a href="http://www.ece.ualberta.ca/~cmpe490/documents/ghs/build_arm.pdf" target="_blank">http://www.ece.ualberta.ca/~<wbr>cmpe490/documents/ghs/build_<wbr>arm.pdf</a><br>
<br>
<br>
Jon<br>
<br>
><br>
> The pragma applies to all global variable and function declarations<br>
> from the pragma to the end of the translation unit. The pragma<br>
> should ideally be pushable and poppable, but that is outside the<br>
> scope of this RFC. The pragma also applies to static local<br>
> declarations within functions.<br>
><br>
> All global variables and functions affected by this pragma have<br>
> their default ELF section destinations changed. Globals with<br>
> __attribute__((section())) are not affected (the attribute trumps<br>
> the pragma).<br>
><br>
> This pragma is only defined to work sensibly for ELF targets.<br>
><br>
<br>
<br>
-- <br>
Jon Roelofs<br>
<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
CodeSourcery / Mentor Embedded<br>
</div>
</span></font></div></div></div>
</div>
</blockquote></div><br></div>