<div dir="ltr">IIUC, the actual requirements for the proposed pltentry(@X) constant is:<div>1. The returned address MUST have a constant offset at link-time from some other unspecified but defined-in-the-same-binary/DSO symbol Y. Which symbol it is is presumed not to matter because all locally-defined symbols have constant offsets from each-other, anyhow.</div><div>2. The address is otherwise insignificant. (Therefore, coming up with a brand new unique address, by creating a local stub function, would be an acceptable implementation.)</div><div><div><br></div><div>These requirements do seem somewhat generic: even on a system which has a different way to make a call could still create a local stub function, and give you the address of that. However, "unnamed address" isn't a good name, because it doesn't capture the first requirement, only the second.</div></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 31, 2020 at 4:46 PM Leonard Chan 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"><div dir="ltr">I think I follow. So in this case, it's better to be explicit and say "this could lower to a PLT entry (which is only supported on specific targets)" rather than making something general that can exist on all targets. Makes sense. I wasn't sure if there was perhaps something equivalent on other targets that this could lower to, but we can make this target/PLT specific.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 30, 2020 at 3:55 PM Chris Lattner <<a href="mailto:clattner@nondot.org" target="_blank">clattner@nondot.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"><div><br><div><br><blockquote type="cite"><div>On Aug 29, 2020, at 6:53 PM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:</div><br><div><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div><br>Sorry for the delay responding Leonard.  I don’t really understand your rationale here.  A PLT entry is a completely target specific concept because some targets don’t have PLTs.  I don’t think there is any reason that a frontend would abstractly generate this unless they already have a target-specific plan in mind.</div><div><br></div><div>If you go with your “unnamedfunc” approach, you’ll have to define the semantics of what that means, and it will need to mean something on targets without a PLT.  If it isn’t generally implementable, then it is target specific again.</div><div><br></div><div>I feel like you are trying (earnestly!) to make the IR better here, but by making this abstract it is actually just making it more opaque for no obvious benefit.</div></blockquote><p style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></p><p style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">+1 to this. LLVM already has a large issue with implicit ABI contracts between Clang (and other frontends) and the various backends. We should not make that worse. The problem here is that there are multiple ways to represent the reference to the function symbol, and in this case, there's an ABI requirement to pick a specific one of them. We should make that clear and explicit. If there's an abstraction here that's useful, it's in the way to pass along that target-specific information -- I think of this like a target-specific attribute.</p></div></div></blockquote>Completely agreed, a lot of my perspective comes from bitter experience having messed up the ABI lowering design :-).  Sorry for that :)</div><div><br></div><div>-Chris</div></div></blockquote></div>
_______________________________________________<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>