<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62428>62428</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[x86][Linux] setting relocation model to 'static' still produces PLT-based relocations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
amitin
</td>
</tr>
</table>
<pre>
Hello.
Consider the following LLVM IR code
```
target triple = "i686-unknown-linux-gnu"
declare i32 @foo(i32)
define internal i32 @bar(i32 %src) align 4 "frame-pointer=none" {
%1 = call i32 @foo(i32 %src)
ret i32 %1
}
```
In this code I'm trying to invoke an 'external' function 'foo'.
Starting from LLVM 12 there is a PTL-based relocation generated for the 'foo' call site.
Trying to force relocations to be static by setting relocation-model=static has no effect.
Additionally, LLVM does not initialize 'ebx' register before the call (probably assuming it's already initialized), which leads to a segfault. LLVM does it for relocation model 'pic', which seems correct.
A corresponding godbolt.org link is here: https://godbolt.org/z/7x5qYP8zY
Could this be a regression? If not, could someone please suggest a workaround preventing LLVM to use PLT-based relocation?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVNtq6zgU_Rr5ZZPgbF_z4IeehjCFDpSZMnAeZWnb0VSWPJLcJv36QXLa5lwgxNheWl6XLXHv1WiIOlZ9Y9Uh40s4WdfxSQVlst7KS_cHaW23wPIDy-_W_3trvJLkIJwIBqu1fVNmhMfHf_6Eh79AWElXeJ1ff-k2cDdSgODUrAlYcQCGqOq23izmxdg3s9HKLOfNaBaGePtFSUJzR6AKBFbmg7UMW1Ugw_2PsEEZAmUCOcP1B7znboUDw8o7wXAPXKvRQBkVDI5PtJltWsaKg7GGGCKw5ttKC3HdLgkWXOtfVHzRfuAdBbi-2F0FNodbpT8l82AgnJRP0cEDw2aC4C4x1GBBmVf7QsANMGzovHpj2MCwGBGUTc-TmGa70v0duAtx9eDstPayw9hWjNADh6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