<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - hello world example linker error"
href="https://bugs.llvm.org/show_bug.cgi?id=39419">39419</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>hello world example linker error
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Xunlei.wu@sas.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hello,
First time user of LLVM here. My environment is Ubuntu18.04 64-bit in
VirtualBox. Host OS is Windows 10 professional.
VirtualBox:~/tmp$ uname -a
Linux VirtualBox 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
VirtualBox:~/tmp$ gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Ubuntu18.04 has LLVM 6.0.0 pre-installed.
VirtualBox:~/tmp$ /usr/bin/clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
I followed the hello world example
<a href="https://llvm.org/docs/GettingStarted.html#an-example-using-the-llvm-tool-chain">https://llvm.org/docs/GettingStarted.html#an-example-using-the-llvm-tool-chain</a>
till step 7
Assemble the native assembly language file into a program:
% /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native # On Solaris
% gcc hello.s -o hello.native # On others
The failed message is
"
VirtualBox:~/tmp$ gcc hello.s -o hello.native
/usr/bin/ld: /tmp/ccaIxQSy.o: relocation R_X86_64_32 against `.rodata.str1.1'
can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
"
I then added -fPIC to "% clang -fPIC -O3 -emit-llvm hello.c -c -o hello.bc".
However, it did not help.
I then installed clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz. The
same issue persists.
Would you please help? Thanks a lot.</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>