[LLVMdev] memory hog llvm-ld

Holger Schurig hs4233 at mail.mn-solutions.de
Wed Jul 18 08:06:25 PDT 2007


Seems like the memory-hog status is related to debug info, e.g. to -g. Because I later compiled the same program with RELEASE
settings, e.g.

$ /usr/src/llvm/dist/bin/g++ -c -pipe --emit-llvm \
    -fvisibility=hidden -fvisibility-inlines-hidden \
    -Wall -Wextra -Wno-sign-compare -Os \
    ... lots of -Dxxxx ... \
    -I/usr/share/qt3/mkspecs/default -I. -I.. \
    -I../../../include/qt3 -I.obj/ \
    -o .obj/FILENAME.o .obj/FILENAME.cpp

and linked the result like this:

$ /usr/src/llvm/dist/bin/llvm-ld \
    -v -stats -native -verify-each -strip-all \
    -o main \
    ... lots of *.o files ... \
    -L/usr/share/qt3/lib -L/usr/X11R6/lib \
    -lcrypto -lusb -lutil -lqt-mt -lXext -lX11 -lm -lpthread

This time LLVM did not eat too much memory. I got a nice
executable.


$ size main
   text    data     bss     dec     hex filename
1170074   74586    8456 1253116  131efc main

The same compiled with "g++ (GCC) 4.1.2 20061115 (prerelease)
(Debian 4.1.1-21)" and "GNU ld version 2.17 Debian GNU/Linux"
gave me:

$ size main
 952074    8572    4528  965174   eba36 main

In the gcc case, I link with "g++", with link options "-Wl,--gc-sections -Wl,-O2 -Wl,--as-needed
-Wl,--enable-new-dtags -Wl,-s"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070718/6375d58a/attachment.html>


More information about the llvm-dev mailing list