<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 3/24/11 7:10 PM, Sangmin Park wrote:
<blockquote
cite="mid:AANLkTimYXDbwLntQH85Xi3Gu=4eXC9nM0i6eET3PiKQ-@mail.gmail.com"
type="cite">
<div>Hi John,</div>
<div><br>
</div>
<div>Thank you for your advice.</div>
<div>LIBS and LDFLAGS work for the configure script,</div>
<div>but they gave errors in the make stage for apache and mysql.</div>
<div><br>
</div>
<div>I used either of the following ones with other flags:</div>
<div>- export LIBS="-L/home/sangmin/Dropbox/Falcon/bin/ -ldummy"</div>
<div>- export LDFLAGS="-L/home/sangmin/Dropbox/Falcon/bin/
-ldummy"</div>
<div><br>
</div>
<div>Here are the error messages:</div>
<div>
<br>
</div>
<div>Compile error (apache): </div>
<div>make[3]: Entering directory
`/home/sangmin/Concurrency/apache/srclib/apr'</div>
<div>/bin/bash /home/sangmin/Concurrency/apache/srclib/apr/libtool
--silent --mode=link llvm-gcc -use-gold-plugin -pthread -O4
-DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I./include
-I../include -version-info 9:5:9
-L/home/sangmin/Dropbox/Falcon/bin/ -ldummy -o <a
moz-do-not-send="true" href="http://libapr-0.la">libapr-0.la</a>
-rpath /home/sangmin/Concurrency/apache-25520-llvm//lib
strings/apr_cpystrn.lo strings/apr_fnmatch.lo
strings/apr_snprintf.lo <skip></div>
<div>collect2: ld terminated with signal 6 [Aborted]</div>
<div>ld:
/home/sangmin/Dropbox/Falcon/src/llvm-2.7/include/llvm/Support/Casting.h:200:
typename llvm::cast_retty<To, From>::ret_type
llvm::cast(const Y&) [with X = llvm::Instruction, Y =
llvm::Value*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.</div>
</blockquote>
<br>
It looks like there is something wrong with your instrumentation
pass. You'll need to run the debugger on the linker. I think you
can get llvm-gcc to dump out the command line it uses for linking
with some option; checks the gcc docs.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:AANLkTimYXDbwLntQH85Xi3Gu=4eXC9nM0i6eET3PiKQ-@mail.gmail.com"
type="cite">
<div>Stack dump:</div>
<div>0.<span class="Apple-tab-span" style="white-space: pre;"> </span>Running
pass 'Function Pass Manager' on module 'ld-temp.o'.</div>
<div>1.<span class="Apple-tab-span" style="white-space: pre;"> </span>Running
pass 'Function pass' on function
'@apr_proc_other_child_refresh_all'</div>
<div><br>
</div>
<div>Compile error (mysql): </div>
<div>ake[2]: Entering directory
`/home/sangmin/Concurrency/mysql/libmysql'</div>
<div>/bin/bash ../libtool --mode=link llvm-gcc -use-gold-plugin
-O3 -DDBUG_OFF -O4 -L/home/sangmin/Dropbox/Falcon/bin/
-ldummy -rdynamic -o conf_to_src conf_to_src.o -lz -lcrypt
-lnsl -lm </div>
<div>llvm-gcc -use-gold-plugin -O3 -DDBUG_OFF -O4 -rdynamic -o
conf_to_src conf_to_src.o -L/home/sangmin/Dropbox/Falcon/bin/
-ldummy -lz -lcrypt -lnsl -lm</div>
<div>collect2: ld terminated with signal 6 [Aborted]</div>
<div>
ld:
/home/sangmin/Dropbox/Falcon/src/llvm-2.7/include/llvm/Support/Casting.h:200:
typename llvm::cast_retty<To, From>::ret_type
llvm::cast(const Y&) [with X = llvm::Instruction, Y =
llvm::Value*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.</div>
<div>Stack dump:</div>
<div>0.<span class="Apple-tab-span" style="white-space: pre;"> </span>Running
pass 'Function Pass Manager' on module 'ld-temp.o'.</div>
<div>1.<span class="Apple-tab-span" style="white-space: pre;"> </span>Running
pass 'Function pass' on function '@print_arrays_for'</div>
<div><br>
</div>
<div>Any thoughts?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Sangmin</div>
<br>
<div class="gmail_quote">On Thu, Mar 24, 2011 at 7:26 PM, John
Criswell <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div>
<div class="h5">On 3/24/11 6:23 PM, Sangmin Park wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
Hi,<br>
<br>
I need advice in instrumenting programs using liblto and
gold plugin.<br>
Specifically, I added my pass in
tools/lto/LTOCodeGenerator.cpp.<br>
My pass inserts functions (myLoad and myStore) for some
load and store instructions.<br>
The functions exist in a library file.<br>
<br>
I found that the approach works for the example in the
link:<br>
<a moz-do-not-send="true"
href="http://llvm.org/docs/GoldPlugin.html"
target="_blank">http://llvm.org/docs/GoldPlugin.html</a><br>
$ llvm-gcc -flto a.c -c -o a.o<br>
$ ar q a.a a.o<br>
$ llvm-gcc b.c -c -o b.o<br>
$ llvm-gcc -use-gold-plugin a.a b.o
-L<path_to_my_lib> -l<my_lib> -o main<br>
<br>
I also found that I can compile large programs (apache
and mysql) with gold plugin.<br>
Here is the command:<br>
$ export CC="llvm-gcc -use-gold-plugin"; export
CXX="llvm-g++ -use-gold-plugin"; export
RANLIB=/bin/true; export CFLAGS="-O4";<br>
$ ./configure<br>
$ make<br>
$ make install<br>
<br>
However, I cannot compile large programs with modified
liblto and gold plugin.<br>
That is because I have to specify the path to my library
containing myLoad and myStore in configure and makefile.<br>
<br>
Is there any fancy way to handle this problem?<br>
</blockquote>
<br>
</div>
</div>
The configure scripts might recognize the LIBS and LDFLAGS
variables and add them to the linker options as it does for
CFLAGS above.<br>
<br>
-- John T.<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<br>
Thanks in advance.<br>
<br>
Sangmin<br>
</blockquote>
<br>
</blockquote>
</div>
<br>
</blockquote>
<br>
</body>
</html>