<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [ELF] wrong functions are called when linking against DSO"
href="https://llvm.org/bugs/show_bug.cgi?id=26222">26222</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ELF] wrong functions are called when linking against DSO
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>grimar@accesssoftek.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider the following code. We have Test1 and Test2 defined in DSO and the
functions with the same name in executable. When they are called from inside
DSO I believe exe versions should be used, but lld uses DSO versions of them.
-- code start --
main.cpp:
#include <stdio.h>
void Test1() { printf("main-test1\n"); }
void Test2() { printf("main-test2\n"); }
void Do();
int main()
{
Do();
Test2();
}
shared.cpp:
#include <stdio.h>
void Test1() { printf("dso-test1\n"); }
void Test2() { printf("dso-test2\n"); }
void Do()
{
Test1();
Test2();
}
-- code end--
If it is linked with lld:
clang -fuse-ld=lld main.cpp -c -o main.o
clang -fuse-ld=lld main.o shared.so -o main
Output is:
dso-test1
dso-test2
main-test2
But when linking with default linker ouput is different:
main-test1
main-test2
main-test2
And the last one I think is correct.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>