<div dir="ltr">This looks like a bug/limitation in bfd ld.<div><br></div><div><div>$ gcc test.c -o test -static -Wl,-export-dynamic -fuse-ld=bfd</div><div>ld.bfd: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie</div><div>collect2: error: ld returned 1 exit status</div><div>$ gcc test.c -o test -static -Wl,-export-dynamic -fuse-ld=gold</div></div><div><div>$ cat test.c</div><div>#include <string.h></div><div><br></div><div>int main(int argc, char *argv[]) {</div><div>  return strcmp(argv[0], argv[1]);</div><div>}</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 December 2014 at 12:49, Vince Harron <span dir="ltr"><<a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The first checkin with support for LLVM_BUILD_STATIC has this linking error, so the flag just isn't intended do what I expected.  I am able to build lldb-platform/lldb-gdbserver statically with this flag so it's working for me.<span class="HOEnZb"><font color="#888888"><div><br><div><div><div>Vince</div><div><br></div></div></div></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 28, 2014 at 7:56 AM, Vince Harron <span dir="ltr"><<a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi all,</div><div><br></div><div>I just grabbed tot.  I'm still able to build dynamic but static linking isn't working for me anymore.</div><div><br></div><div>I'm not sure if I should be directing this to cfe-dev or llvm-dev</div>







<p>[305/306] Linking CXX executable bin/clang-3.6</p><p>/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie"<br></p><div><br></div><div>Repro steps:<br></div><p>#!/bin/bash -ex<br><br>ROOT_DIR=$HOME/ll/static-fail<br><br>mkdir $ROOT_DIR<br>cd $ROOT_DIR<br>svn co <a href="http://llvm.org/svn/llvm-project/llvm/trunk" target="_blank">http://llvm.org/svn/llvm-project/llvm/trunk</a> llvm<br>cd llvm/tools<br>svn co <a href="http://llvm.org/svn/llvm-project/cfe/trunk" target="_blank">http://llvm.org/svn/llvm-project/cfe/trunk</a> clang<br>cd $ROOT_DIR<br>mkdir build<br>cd build<br>cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_STATIC=True<br>ninja clang</p><span><font color="#888888"><div><br></div><div><br></div>-- <br><div><div dir="ltr"><br><table cellspacing="0" cellpadding="0" style="font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Vince Harron |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Technical Lead Manager |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:858-442-0868" value="+18584420868" target="_blank">858-442-0868</a></td></tr></tbody></table><br></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><br><table cellspacing="0" cellpadding="0" style="font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Vince Harron |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Technical Lead Manager |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:858-442-0868" value="+18584420868" target="_blank">858-442-0868</a></td></tr></tbody></table><br></div></div>
</div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>