summaryrefslogtreecommitdiff
path: root/tools/gccld
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-08 05:18:12 +0000
committerChris Lattner <sabre@nondot.org>2002-04-08 05:18:12 +0000
commit2b59837f02350a0bd25bce93808bdb838cda0e08 (patch)
tree0d4b3b828071373dc2d24bd02ff0868b0395a81b /tools/gccld
parent1907aba9f4a2e4b9abb41657a37c3ea8be35248c (diff)
downloadllvm-2b59837f02350a0bd25bce93808bdb838cda0e08.tar.gz
llvm-2b59837f02350a0bd25bce93808bdb838cda0e08.tar.bz2
llvm-2b59837f02350a0bd25bce93808bdb838cda0e08.tar.xz
Add support for the gnu ld -s (strip) option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld')
-rw-r--r--tools/gccld/gccld.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 4d369cdeba..66d1afb4f3 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -19,6 +19,7 @@
#include "llvm/PassManager.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/WriteBytecodePass.h"
+#include "llvm/Transforms/SymbolStripping.h"
#include "llvm/Transforms/CleanupGCCOutput.h"
#include "llvm/Transforms/ConstantMerge.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
@@ -36,7 +37,7 @@ cl::String OutputFilename("o", "Override output filename", cl::NoFlags,"a.out");
cl::Flag Verbose ("v", "Print information about actions taken");
cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
cl::StringList Libraries ("l", "Specify libraries to link to", cl::ZeroOrMore);
-
+cl::Flag Strip ("s", "Strip symbol info from executable");
// FileExists - Return true if the specified string is an openable file...
static inline bool FileExists(const std::string &FN) {
@@ -136,6 +137,13 @@ int main(int argc, char **argv) {
//
Passes.add(createCleanupGCCOutputPass());
+ // If the -s command line option was specified, strip the symbols out of the
+ // resulting program to make it smaller. -s is a GCC option that we are
+ // supporting.
+ //
+ if (Strip)
+ Passes.add(createSymbolStrippingPass());
+
// Now that composite has been compiled, scan through the module, looking for
// a main function. If main is defined, mark all other functions internal.
//