From c6bed6debe26cc4225ac0db0ff625dd55bc9f9e1 Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Thu, 7 May 1998 12:19:32 +0000
Subject: [PATCH] [project @ 1998-05-07 12:19:31 by simonm] - New option
 $(StripLibraries) removes local symbols from library objects.   Turned off by
 default, as it only works with linkers that support   the '-x' (remove local
 symbols) option.

---
 mk/config.mk.in |  7 ++++++-
 mk/target.mk    | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/mk/config.mk.in b/mk/config.mk.in
index 14195e9a0969..2a2982110487 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -148,7 +148,7 @@ ProjectPatchLevel = $($(Project)ProjectPatchLevel)
 
 GhcProjectName         = The Glorious Glasgow Haskell Compilation System
 GhcProjectNameShort    = ghc
-GhcProjectVersion      = 3.02
+GhcProjectVersion = proto-3.02-6-May
 GhcProjectVersionInt   = 302
 GhcProjectPatchLevel   = 0
 
@@ -275,6 +275,11 @@ ReadlineIncludePath=
 #
 GhcLibsWithSockets=YES
 
+# Strip local symbols from libraries?  This can make the libraries smaller,
+# but makes debugging somewhat more difficult.  Doesn't work with all ld's.
+#
+StripLibraries=NO
+
 # what to include in a binary distribution
 
 GhcMainDir = ghc
diff --git a/mk/target.mk b/mk/target.mk
index 3c46011cff1d..463e0bc2e6ad 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -324,6 +324,23 @@ endef
 endif # $(filter...
 endif
 
+#
+# Remove local symbols from library objects if requested.
+#
+
+ifneq "$(StripLibraries)" ""
+ifneq "$(filter -split-objs,$(HC_OPTS))" ""
+SRC_HC_POST_OPTS += \
+  for i in $(basename $@)/*; do \
+	ld -r -x -o $$i.tmp $$i; \
+	$(MV) $$i.tmp $$i; \
+  done
+else
+SRC_HC_POST_OPTS += \
+  ld -r -x -o $@.tmp; $(MV) $@.tmp $@
+endif
+endif
+
 $(LIBRARY) :: $(LIBOBJS)
 	$(BUILD_LIB)
 endif
-- 
GitLab