Index: tools/lto/Makefile
===================================================================
--- tools/lto/Makefile	(revision 198076)
+++ tools/lto/Makefile	(working copy)
@@ -37,9 +37,6 @@
                         -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
                         -Wl,-compatibility_version -Wl,1
     endif
-    # extra options to override libtool defaults 
-    LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                         -Wl,-dead_strip
 
     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
Index: tools/opt/Makefile
===================================================================
--- tools/opt/Makefile	(revision 198076)
+++ tools/opt/Makefile	(working copy)
@@ -11,4 +11,7 @@
 TOOLNAME := opt
 LINK_COMPONENTS := bitreader bitwriter asmparser irreader instrumentation scalaropts objcarcopts ipo vectorize all-targets
 
+# Support plugins.
+NO_DEAD_STRIP := 1
+
 include $(LEVEL)/Makefile.common
Index: tools/bugpoint/Makefile
===================================================================
--- tools/bugpoint/Makefile	(revision 198076)
+++ tools/bugpoint/Makefile	(working copy)
@@ -12,4 +12,7 @@
 LINK_COMPONENTS := asmparser instrumentation scalaropts ipo linker bitreader \
                    bitwriter irreader vectorize objcarcopts
 
+# Support plugins.
+NO_DEAD_STRIP := 1
+
 include $(LEVEL)/Makefile.common
Index: tools/llvm-shlib/Makefile
===================================================================
--- tools/llvm-shlib/Makefile	(revision 198076)
+++ tools/llvm-shlib/Makefile	(working copy)
@@ -49,9 +49,6 @@
     endif
     # Include everything from the .a's into the shared library.
     LLVMLibsOptions    := $(LLVMLibsOptions) -all_load
-    # extra options to override libtool defaults 
-    LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                         -Wl,-dead_strip
 
     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
Index: tools/llc/Makefile
===================================================================
--- tools/llc/Makefile	(revision 198076)
+++ tools/llc/Makefile	(working copy)
@@ -11,5 +11,8 @@
 TOOLNAME := llc
 LINK_COMPONENTS := all-targets bitreader asmparser irreader
 
+# Support plugins.
+NO_DEAD_STRIP := 1
+
 include $(LEVEL)/Makefile.common
 
Index: Makefile.rules
===================================================================
--- Makefile.rules	(revision 198076)
+++ Makefile.rules	(working copy)
@@ -608,6 +608,22 @@
   Install.StripFlag += -s
 endif
 
+# By default, strip dead symbols at link time
+ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ifneq ($(HOST_OS),Darwin)
+  CXX.Flags += -ffunction-sections -fdata-sections
+endif
+endif
+ifndef NO_DEAD_STRIP
+  ifeq ($(HOST_OS),Darwin)
+    LD.Flags += -Wl,-dead_strip
+  else
+    ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+      LD.Flags += -Wl,--gc-sections
+    endif
+  endif
+endif
+
 # Adjust linker flags for building an executable
 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   ifndef TOOL_NO_EXPORTS
