<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 7, 2020 at 6:47 PM John Reagan via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I had thought about "used", but not aware of the @llvm.used, et al.<br>
<br>
I wrote some test programs with __attribute__((used)) but that felt like<br>
something you'd put on function definitions to force code to be<br>
generated regardless.<br></blockquote><div><br></div><div>Isn't that what you're asking for?<br><br>Though I'm slightly confused by your original statement - /LLVM/ (the middle/backend, compiler - generating object files) wouldn't discard an external-linkage function with no calls, because the call might be in another module. Oh, a declaration? <br><br>You have a declaration (without a definition) of a function in an llvm::Module and you want some remnant of that to appear in the object file? Yeah, I don't think that's supported - how's that done on other compilers/what's the prior art you're trying to emulate here?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
In the worst case, I'll do some metadata hack (I've ready had to do that<br>
for BLISS' GLOBAL BIND feature).<br>
<br>
Thanks for the response.  I'll let folks know what I find out.<br>
<br>
P.S. we're about to enter field test for OpenVMS after 2+ years of work<br>
on the system and compilers.  I can now boot it under VBox on my W10<br>
system here at home.<br>
<br>
On 5/7/2020 4:16 PM, Robinson, Paul wrote:<br>
> <br>
> <br>
>> -----Original Message-----<br>
>> From: llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> On Behalf Of John Reagan<br>
>> via llvm-dev<br>
>> Sent: Wednesday, May 6, 2020 9:29 PM<br>
>> To: via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
>> Subject: [llvm-dev] How to force unused external routine declaration into<br>
>> object<br>
>><br>
>> I'm defining an external function in the IR that has no uses at all.  No<br>
>> calls, no address taken, nada.<br>
>><br>
>> Such an unused declaration seems to be just dropped on the floor as not<br>
>> needed.  Seems reasonable in most cases.<br>
>><br>
>> However, one of my OpenVMS compilers (BLISS) has a language rule that<br>
>> expects such definitions to get into the ELF symbol table as a way to<br>
>> compel the linker to include certain object modules.<br>
>><br>
>> With our backend for our older targets, we had a "required_om_entry"<br>
>> function attribute that told our backend to put it out regardless.<br>
>><br>
>> I was looking at the list of function attributes and don't see anything<br>
>> that would accomplish this.<br>
>><br>
>> I could just create a bogus variable and initialize it with the<br>
>> function's value, but that seems unsavory.<br>
>><br>
>> I'm still using a way old version but I'll adapt as needed.<br>
>><br>
>> Any suggestions?  Did I miss something?<br>
> <br>
> Hi John,<br>
> <br>
> This sounds like __attribute__((used)) which Clang turns into<br>
> entries in the @llvm.used list.  There's also @llvm.compiler.used<br>
> and I'm not clear what the difference is, but hopefully that's<br>
> enough of a pointer that you can get it to work for Bliss.<br>
> <br>
> --paulr<br>
> <br>
>><br>
>> John (safely at home with sufficient food & wine)<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>