<div dir="ltr"><div><div dir="auto"><div class="gmail_quote"><div dir="ltr">On Thu, Jul 5, 2018, 2:11 AM Peter Smith <<a href="mailto:peter.smith@linaro.org" target="_blank">peter.smith@linaro.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">On 4 July 2018 at 23:20, Wink Saville via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> Executive summary: In _dl_get_origin lld is linking a call to mempcpy which<br>
> I'd call "thunking code" as it returns in rax the address of the code<br>
> that should be called instead of the address of the next available<br>
> address of the<br>
> destination buffer. And specifically, since rax is pointing at code, when a zero<br>
> is stored to try to terminate the string we seg fault.<br>
><br>
> I'd be glad to file a bug if you like.<br>
<br>
I think that would be the best idea. As Rui suggested earlier it would<br>
be helpful to add -Wl,--reproduce=repro.tar so that all the libraries<br>
are included. My suspicion here is that this is related to a newer<br>
version of libc.a as I can't reproduce a crash on my Ubuntu 16.04<br>
machine. Looking at an annotate of some of the glibc source it looks<br>
like indirect functions (ifunc) have been used with __mempcpy have<br>
been added relatively recently. The ifunc resolution mechanism is not<br>
particularly well documented so it is possible that there is a case<br>
that LLD isn't handling as expected.<br>
<br>
Unfortunately I can't tell much from the disassembly of the final<br>
image about what the linker has got wrong. We really need to see the<br>
input objects and how LLD and Gold differ in the resolution of symbols<br>
and relocations to work that out.<br>
<br>
Sorry I can't be of much more help here.<br></blockquote><div><br></div><div><span>I'd added the --reproduce tar file to a previous post but it looks like it got stuck being approved by the list admin,</span><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I'll add it to the bug report.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">I'll file the bug at <a href="https://bugs.llvm.org">https://bugs.llvm.org</a>, is there someone I should assign the bug to?</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> </div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div dir="auto"><div class="gmail_quote">-- Wink</div></div></div></div></div></div></div></div>
</div>